플랫폼별 초기화 분기를 추가해 웹 실행 시 Firebase와 Mattermost 초기화를 건너뛰고, Edge local 운영 문서와 기본 설정값을 실제 운영 연계 흐름에 맞춰 정리한다.
50 lines
1.6 KiB
Dart
50 lines
1.6 KiB
Dart
import 'package:firebase_core/firebase_core.dart';
|
|
import 'package:flutter/foundation.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();
|
|
final initializeExternalPush = !kIsWeb;
|
|
if (initializeExternalPush && options.initializeFirebase) {
|
|
await Firebase.initializeApp();
|
|
}
|
|
if (initializeExternalPush && options.initializeMattermost) {
|
|
final host = options.mattermostHost ?? defaultMattermostHost;
|
|
await host.initialize();
|
|
}
|
|
}
|
|
|
|
Future<void> runIopClient({
|
|
IopClientBootstrapOptions options = const IopClientBootstrapOptions(),
|
|
}) async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
await bootstrapIopClient(options: options);
|
|
final initializeExternalPush = !kIsWeb;
|
|
runApp(
|
|
IopClientApp(
|
|
mattermostHost: initializeExternalPush && options.initializeMattermost
|
|
? (options.mattermostHost ?? defaultMattermostHost)
|
|
: null,
|
|
),
|
|
);
|
|
}
|