From 6cc2c6a578cb7adf3a1555c50bf7b4208fd1f30a Mon Sep 17 00:00:00 2001 From: Krille Date: Sun, 4 Feb 2024 08:02:02 +0100 Subject: [PATCH] fix: Request notification permission on android --- lib/utils/background_push.dart | 5 +++++ lib/utils/push_helper.dart | 2 ++ 2 files changed, 7 insertions(+) diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart index ff2b432bea..9381e6a64d 100644 --- a/lib/utils/background_push.dart +++ b/lib/utils/background_push.dart @@ -139,6 +139,11 @@ class BackgroundPush { }) async { if (PlatformInfos.isIOS) { await firebase?.requestPermission(); + } else if (PlatformInfos.isAndroid) { + _flutterLocalNotificationsPlugin + .resolvePlatformSpecificImplementation< + AndroidFlutterLocalNotificationsPlugin>() + ?.requestNotificationsPermission(); } final clientName = PlatformInfos.clientName; oldTokens ??= {}; diff --git a/lib/utils/push_helper.dart b/lib/utils/push_helper.dart index 2b4b561bf1..ccf5c38aa0 100644 --- a/lib/utils/push_helper.dart +++ b/lib/utils/push_helper.dart @@ -61,6 +61,7 @@ Future pushHelper( ticker: l10n.unreadChats(notification.counts?.unread ?? 1), importance: Importance.max, priority: Priority.max, + shortcutId: notification.roomId, fullScreenIntent: true, // To show notification popup ), ), @@ -233,6 +234,7 @@ Future _tryPushHelper( channelDescription: groupName, number: notification.counts?.unread, category: AndroidNotificationCategory.message, + shortcutId: event.room.id, styleInformation: messagingStyleInformation ?? MessagingStyleInformation( person,