feat: Enable iOS push notifications and improve APNS token retrieval.
This commit is contained in:
@@ -39,6 +39,11 @@
|
|||||||
<string>521527250907-3i1qe2656eojs8k9hjdi573j09i9p41m.apps.googleusercontent.com</string>
|
<string>521527250907-3i1qe2656eojs8k9hjdi573j09i9p41m.apps.googleusercontent.com</string>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>UIBackgroundModes</key>
|
||||||
|
<array>
|
||||||
|
<string>fetch</string>
|
||||||
|
<string>remote-notification</string>
|
||||||
|
</array>
|
||||||
<key>NSLocationAlwaysUsageDescription</key>
|
<key>NSLocationAlwaysUsageDescription</key>
|
||||||
<string>Cette application a besoin de votre position pour afficher votre localisation sur la carte</string>
|
<string>Cette application a besoin de votre position pour afficher votre localisation sur la carte</string>
|
||||||
<key>NSLocationWhenInUseUsageDescription</key>
|
<key>NSLocationWhenInUseUsageDescription</key>
|
||||||
|
|||||||
@@ -6,5 +6,7 @@
|
|||||||
<array>
|
<array>
|
||||||
<string>Default</string>
|
<string>Default</string>
|
||||||
</array>
|
</array>
|
||||||
|
<key>aps-environment</key>
|
||||||
|
<string>development</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -62,11 +62,11 @@ class NotificationService {
|
|||||||
if (Platform.isIOS) {
|
if (Platform.isIOS) {
|
||||||
String? apnsToken = await _firebaseMessaging.getAPNSToken();
|
String? apnsToken = await _firebaseMessaging.getAPNSToken();
|
||||||
int retries = 0;
|
int retries = 0;
|
||||||
while (apnsToken == null && retries < 3) {
|
while (apnsToken == null && retries < 10) {
|
||||||
LoggerService.info(
|
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();
|
apnsToken = await _firebaseMessaging.getAPNSToken();
|
||||||
retries++;
|
retries++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user