From 1e70b9e09f282166c63dc283d4fa378e2cf2ce66 Mon Sep 17 00:00:00 2001 From: Van Leemput Dayron Date: Fri, 28 Nov 2025 20:27:29 +0100 Subject: [PATCH] feat: Enable iOS push notifications and improve APNS token retrieval. --- ios/Runner/Info.plist | 5 +++++ ios/Runner/Runner.entitlements | 2 ++ lib/services/notification_service.dart | 6 +++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index eb60f24..8e24ffb 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -39,6 +39,11 @@ 521527250907-3i1qe2656eojs8k9hjdi573j09i9p41m.apps.googleusercontent.com LSRequiresIPhoneOS + UIBackgroundModes + + fetch + remote-notification + NSLocationAlwaysUsageDescription Cette application a besoin de votre position pour afficher votre localisation sur la carte NSLocationWhenInUseUsageDescription diff --git a/ios/Runner/Runner.entitlements b/ios/Runner/Runner.entitlements index a812db5..f131604 100644 --- a/ios/Runner/Runner.entitlements +++ b/ios/Runner/Runner.entitlements @@ -6,5 +6,7 @@ Default + aps-environment + development diff --git a/lib/services/notification_service.dart b/lib/services/notification_service.dart index f613ed5..edf9096 100644 --- a/lib/services/notification_service.dart +++ b/lib/services/notification_service.dart @@ -62,11 +62,11 @@ class NotificationService { if (Platform.isIOS) { String? apnsToken = await _firebaseMessaging.getAPNSToken(); int retries = 0; - while (apnsToken == null && retries < 3) { + while (apnsToken == null && retries < 10) { LoggerService.info( - 'Waiting for APNS token... (Attempt ${retries + 1}/3)', + 'Waiting for APNS token... (Attempt ${retries + 1}/10)', ); - await Future.delayed(const Duration(seconds: 1)); + await Future.delayed(const Duration(seconds: 2)); apnsToken = await _firebaseMessaging.getAPNSToken(); retries++; }