diff --git a/flutter/lib/main.dart b/flutter/lib/main.dart index 960bfb667..3e507fd68 100644 --- a/flutter/lib/main.dart +++ b/flutter/lib/main.dart @@ -27,7 +27,7 @@ Future main(List args) async { print("launch args: $args"); if (!isDesktop) { - runMainApp(false); + runMobileApp(); return; } // main window @@ -72,9 +72,6 @@ Future initEnv(String appType) async { // focus on multi-ffi on desktop first await initGlobalFFI(); // await Firebase.initializeApp(); - if (isAndroid) { - toAndroidChannelInit(); - } refreshCurrentUser(); } @@ -96,6 +93,12 @@ void runMainApp(bool startService) async { runApp(App()); } +void runMobileApp() async { + await initEnv(kAppTypeMain); + if (isAndroid) androidChannelInit(); + runApp(App()); +} + void runRemoteScreen(Map argument) async { await initEnv(kAppTypeDesktopRemote); runApp(GetMaterialApp( diff --git a/flutter/lib/mobile/pages/server_page.dart b/flutter/lib/mobile/pages/server_page.dart index abbc5aadc..00c433fd8 100644 --- a/flutter/lib/mobile/pages/server_page.dart +++ b/flutter/lib/mobile/pages/server_page.dart @@ -510,7 +510,7 @@ Widget clientInfo(Client client) { ])); } -void toAndroidChannelInit() { +void androidChannelInit() { gFFI.setMethodCallHandler((method, arguments) { debugPrint("flutter got android msg,$method,$arguments"); try {