- Move fleet polling logic to control orchestrator - Split client state management into separate controller/repository - Add client bootstrap and home page components - Update HTTP fleet handlers and views - Add unit tests for client bootstrap and status controller - Archive completed subtask documents
46 lines
1.4 KiB
Dart
46 lines
1.4 KiB
Dart
import 'package:firebase_core/firebase_core.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'main.dart';
|
|
import 'src/integrations/mattermost/mattermost_push_host_integration.dart';
|
|
import 'src/integrations/mattermost/mattermost_push_plugin_client.dart';
|
|
|
|
class IopClientBootstrapOptions {
|
|
final bool initializeFirebase;
|
|
final bool initializeMattermost;
|
|
final MattermostPushHostIntegration? mattermostHost;
|
|
|
|
const IopClientBootstrapOptions({
|
|
this.initializeFirebase = true,
|
|
this.initializeMattermost = true,
|
|
this.mattermostHost,
|
|
});
|
|
}
|
|
|
|
final MattermostPushHostIntegration defaultMattermostHost = MattermostPushHostIntegration(
|
|
pushClient: MattermostPushPluginClient(),
|
|
);
|
|
|
|
Future<void> bootstrapIopClient({
|
|
IopClientBootstrapOptions options = const IopClientBootstrapOptions(),
|
|
}) async {
|
|
applyFullscreenMode();
|
|
if (options.initializeFirebase) {
|
|
await Firebase.initializeApp();
|
|
}
|
|
if (options.initializeMattermost) {
|
|
final host = options.mattermostHost ?? defaultMattermostHost;
|
|
await host.initialize();
|
|
}
|
|
}
|
|
|
|
Future<void> runIopClient({
|
|
IopClientBootstrapOptions options = const IopClientBootstrapOptions(),
|
|
}) async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
await bootstrapIopClient(options: options);
|
|
runApp(IopClientApp(
|
|
mattermostHost: options.initializeMattermost
|
|
? (options.mattermostHost ?? defaultMattermostHost)
|
|
: null,
|
|
));
|
|
}
|