update pushkit API

This commit is contained in:
Benjamin Reis 2018-01-04 11:09:16 +01:00
parent 557eca0821
commit bf34895c91

View file

@ -536,30 +536,32 @@
#pragma mark - PushKit Functions
- (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(PKPushType)type {
LOGI(@"PushKit credentials updated");
LOGI(@"voip token: %@", (credentials.token));
dispatch_async(dispatch_get_main_queue(), ^{
[LinphoneManager.instance setPushNotificationToken:credentials.token];
});
}
- (void)pushRegistry:(PKPushRegistry *)registry
didInvalidatePushTokenForType:(NSString *)type {
LOGI(@"PushKit Token invalidated");
dispatch_async(dispatch_get_main_queue(), ^{[LinphoneManager.instance setPushNotificationToken:nil];});
}
- (void)pushRegistry:(PKPushRegistry *)registry
didReceiveIncomingPushWithPayload:(PKPushPayload *)payload
forType:(NSString *)type {
#ifdef __IPHONE_11_0
- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion {
#else
- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(NSString *)type {
#endif
LOGI(@"PushKit : incoming voip notfication: %@", payload.dictionaryPayload);
[LinphoneManager.instance setupNetworkReachabilityCallback];
//to avoid IOS to suspend the app before being able to launch long running task
[self processRemoteNotification:payload.dictionaryPayload];
}
- (void)pushRegistry:(PKPushRegistry *)registry
didUpdatePushCredentials:(PKPushCredentials *)credentials
forType:(PKPushType)type {
LOGI(@"PushKit credentials updated");
LOGI(@"voip token: %@", (credentials.token));
dispatch_async(dispatch_get_main_queue(), ^{
[LinphoneManager.instance setPushNotificationToken:credentials.token];
});
#ifdef __IPHONE_11_0
dispatch_async(dispatch_get_main_queue(), ^{completion();});
#endif
}
#pragma mark - UNUserNotifications Framework