appsok/lib/src/app.dart
toki ce27006e05 feat: usb install milestone update and service improvements
- Update usb-install.md milestone documentation
- Improve ADB service functionality and error handling
- Update app shell and settings page for usb install feature
- Add test coverage for adb service and widget
- Update dependencies in pubspec.yaml
- Archive completed task artifacts
2026-06-13 07:57:54 +09:00

68 lines
2.1 KiB
Dart

import 'package:flutter/material.dart';
import 'features/app_shell.dart';
import 'services/adb_service.dart';
import 'services/artifact_staging_service.dart';
import 'services/jenkins_artifact_session.dart';
import 'services/jenkins_client.dart';
import 'services/token_store.dart';
import 'theme/app_theme.dart';
class AppSokApp extends StatefulWidget {
const AppSokApp({
super.key,
this.tokenStore,
this.jenkinsClient,
this.artifactStagingService,
this.session,
this.adbDiagnosticsLoader,
});
final TokenStore? tokenStore;
final JenkinsClient? jenkinsClient;
final ArtifactStagingService? artifactStagingService;
final JenkinsArtifactSession? session;
final AdbDiagnosticsLoader? adbDiagnosticsLoader;
@override
State<AppSokApp> createState() => _AppSokAppState();
}
class _AppSokAppState extends State<AppSokApp> {
late final JenkinsArtifactSession _session =
widget.session ??
JenkinsArtifactSession(
store: widget.tokenStore ?? TokenStore(),
client: widget.jenkinsClient ?? JenkinsClient(),
stager: widget.artifactStagingService ?? ArtifactStagingService(),
);
late final AdbService _adbService = AdbService();
late final Future<bool> _startup = _session.restore();
@override
Widget build(BuildContext context) {
return FutureBuilder<bool>(
future: _startup,
builder: (context, snapshot) {
final isReady = snapshot.data ?? false;
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'AppSok',
theme: AppTheme.light(),
home: AppSokShell(
jobLoader: isReady ? _session.loadJobs : null,
buildLoader: isReady ? _session.loadBuilds : null,
artifactDownloader: isReady ? _session.downloadArtifact : null,
artifactStager: isReady ? _session.stageApk : null,
artifactCleaner: isReady ? _session.cleanup : null,
adbDiagnosticsLoader:
widget.adbDiagnosticsLoader ?? _adbService.collectDiagnostics,
),
);
},
);
}
}