From 856d8111876ca8563cffd24a8589db30db2bf785 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 25 Aug 2025 23:14:59 +0800 Subject: [PATCH] :bug: Fix notification tap in system wide --- lib/main.dart | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 63caf300..28ad1338 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -169,12 +169,12 @@ class IslandApp extends HookConsumerWidget { final theme = ref.watch(themeProvider); void handleMessage(RemoteMessage notification) { - if (notification.data['action_uri'] != null) { - var uri = notification.data['action_uri'] as String; + if (notification.data['meta']?['action_uri'] != null) { + var uri = notification.data['meta']['action_uri'] as String; if (uri.startsWith('/')) { // In-app routes final router = ref.read(routerProvider); - router.go(notification.data['action_uri']); + router.push(notification.data['meta']['action_uri']); } else { // External links launchUrlString(uri); @@ -186,27 +186,6 @@ class IslandApp extends HookConsumerWidget { if (!kIsWeb && Platform.isLinux) { return null; } - const channel = MethodChannel('dev.solsynth.solian/notifications'); - - Future handleInitialLink() async { - final String? link = await channel.invokeMethod('initialLink'); - if (link != null) { - final router = ref.read(routerProvider); - router.go(link); - } - } - - if (!kIsWeb && Platform.isAndroid) { - handleInitialLink(); - } - - channel.setMethodCallHandler((call) async { - if (call.method == 'newLink') { - final String link = call.arguments; - final router = ref.read(routerProvider); - router.go(link); - } - }); // When the app is opened from a terminated state. FirebaseMessaging.instance.getInitialMessage().then((message) {