fix: uni links failed to be invoked with --cm running on macOS

This commit is contained in:
Kingtous
2023-02-07 01:31:11 +08:00
parent b2afde4b27
commit 1426771ec9
3 changed files with 21 additions and 5 deletions

View File

@@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
@@ -31,6 +32,9 @@ int? kWindowId;
WindowType? kWindowType;
late List<String> kBootArgs;
/// Uni links.
StreamSubscription? _uniLinkSubscription;
Future<void> main(List<String> args) async {
WidgetsFlutterBinding.ensureInitialized();
debugPrint("launch args: $args");
@@ -203,7 +207,7 @@ void runMultiWindow(
await restoreWindowPosition(WindowType.PortForward, windowId: kWindowId!);
break;
default:
// no such appType
// no such appType
exit(0);
}
// show window from hidden status
@@ -222,6 +226,8 @@ void runConnectionManagerScreen(bool hide) async {
} else {
showCmWindow();
}
// Start the uni links handler and redirect links to Native, not for Flutter.
_uniLinkSubscription = listenUniLinks(handleByFlutter: false);
}
void showCmWindow() {