diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 13309fd19..0d8b3c560 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -570,7 +570,9 @@ - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { LOGI(@"[APNs] %@ : %@", NSStringFromSelector(_cmd), deviceToken); - [LinphoneManager.instance setRemoteNotificationToken:deviceToken]; + dispatch_async(dispatch_get_main_queue(), ^{ + [LinphoneManager.instance setRemoteNotificationToken:deviceToken]; + }); } - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { @@ -582,7 +584,7 @@ - (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(PKPushType)type { LOGI(@"[PushKit] credentials updated with voip token: %@", credentials.token); - dispatch_async(dispatch_get_main_queue(), ^{ // TODO PAUL : why? + dispatch_async(dispatch_get_main_queue(), ^{ [LinphoneManager.instance setPushKitToken:credentials.token]; }); } @@ -595,8 +597,9 @@ - (void)processPush:(NSDictionary *)userInfo { LOGI(@"[PushKit] Notification [%p] received with payload : %@", userInfo, userInfo.description); -// prevent app to crash if pushKit received for msg - if ([userInfo[@"aps"][@"loc-key"] isEqualToString:@"IM_MSG"]) { // TODO PAUL: a supprimer, fix temporaire: le serveur n'enverra plus de pushkit pr les msg + // prevent app to crash if PushKit received for msg + if ([userInfo[@"aps"][@"loc-key"] isEqualToString:@"IM_MSG"]) { + LOGE(@"Received a legacy PushKit notification for a chat message"); return; } [LinphoneManager.instance startLinphoneCore]; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 36bb19032..ce30dc8ed 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -2094,11 +2094,14 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { timeout = @""; } + // dummy value, for later use + NSString *teamId = @"ABCD1234"; + NSString *params = [NSString - stringWithFormat:@"pn-provider=apns%@;pn-prid=%@;pn-param=ABCD1234.%@.%@;pn-msg-str=IM_MSG;pn-call-str=IC_MSG;pn-" + stringWithFormat:@"pn-provider=apns%@;pn-prid=%@;pn-param=%@.%@.%@;pn-msg-str=IM_MSG;pn-call-str=IC_MSG;pn-" @"call-snd=%@;pn-msg-snd=msg.caf%@;pn-silent=1", - APPMODE_SUFFIX, token, [[NSBundle mainBundle] bundleIdentifier], services, ring, timeout]; - // TODO PAUL : do we need the team id? + APPMODE_SUFFIX, token, teamId, [[NSBundle mainBundle] bundleIdentifier], services, ring, timeout]; + LOGI(@"Proxy config %s configured for push notifications with contact: %@", linphone_proxy_config_get_identity(proxyCfg), params); linphone_proxy_config_set_contact_uri_parameters(proxyCfg, [params UTF8String]); diff --git a/msgNotificationContent/NotificationViewController.swift b/msgNotificationContent/NotificationViewController.swift index aa7866459..eb29f2689 100644 --- a/msgNotificationContent/NotificationViewController.swift +++ b/msgNotificationContent/NotificationViewController.swift @@ -57,9 +57,7 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi coreStopped = false } - func didReceive(_ notification: UNNotification) { - self.title = "test test test" // TODO PAUL : a enlever - } + func didReceive(_ notification: UNNotification) {} func didReceive(_ response: UNNotificationResponse, completionHandler completion: @escaping (UNNotificationContentExtensionResponseOption) -> Void) { diff --git a/msgNotificationService/NotificationService.swift b/msgNotificationService/NotificationService.swift index 89ca49d19..74fea9171 100644 --- a/msgNotificationService/NotificationService.swift +++ b/msgNotificationService/NotificationService.swift @@ -110,8 +110,8 @@ class NotificationService: UNNotificationServiceExtension { if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent { NSLog("[msgNotificationService] serviceExtensionTimeWillExpire") bestAttemptContent.categoryIdentifier = "app_active" - bestAttemptContent.title = NSLocalizedString("Message received", comment: "") + " [time out]" // TODO PAUL : a enlever - bestAttemptContent.body = NSLocalizedString("You have received a message.", comment: "") + bestAttemptContent.title = NSLocalizedString("Message received", comment: "") + bestAttemptContent.body = NSLocalizedString("You have received a message.", comment: "") contentHandler(bestAttemptContent) } }