Push Notification Token Updates

HYPR SDK for iOS

HYPR uses Firebase as a push notification provider when authenticating users for web accounts. In some circumstances, the Firebase registration token can change, rendering the server unable to send push notifications to the device.

To allow iOS applications to update the push notification token when required, HYPR SDK for iOS implements the Firebase messaging delegate method for registration token updates:

- (void)messaging:(FIRMessaging *)messaging didReceiveRegistrationToken:(NSString *)fcmToken {
    HyprLogDebug(@"FCM registration token: %@", fcmToken);
    NSDictionary* userInfo = @{HYPRPushNotificationTokenKey : fcmToken};
    [[NSNotificationCenter defaultCenter] postNotificationName:HYPRPushNotificationRegistrationUpdated object:nil userInfo:userInfo];
}

Send the notification to HYPRPushNotificationRegistrationUpdated with the Firebase Cloud Messaging token value for key HYPRPushNotificationTokenKey in the user info dictionary.