Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix notification permission dialog appearing on app startup

AmanRajSinghMourya529006a313c9
diff --git a/mobile/apps/auth/lib/services/notification_service.dart b/mobile/apps/auth/lib/services/notification_service.dart
index 63410eb7db..b41d9bbdb6 100644
--- a/mobile/apps/auth/lib/services/notification_service.dart
+++ b/mobile/apps/auth/lib/services/notification_service.dart
@@ -23,18 +23,19 @@ class NotificationService {
await _flutterLocalNotificationsPlugin.initialize(
initializationSettings,
);
- final implementation =
- _flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation<
- AndroidFlutterLocalNotificationsPlugin>();
- if (implementation != null) {
- await implementation.requestNotificationsPermission();
- }
}
Future<void> showNotification(String title, String message) async {
if (!Platform.isAndroid) {
return;
}
+ final implementation =
+ _flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation<
+ AndroidFlutterLocalNotificationsPlugin>();
+ if (implementation != null) {
+ final granted = await implementation.requestNotificationsPermission();
+ if (granted != true) return;
+ }
const AndroidNotificationDetails androidPlatformChannelSpecifics =
AndroidNotificationDetails(
'io.ente.auth',