Commit 736f4e98 authored by Francesco Degrassi's avatar Francesco Degrassi
Browse files

Gracefully handle unexpected registration notifications

parent 593ace35
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -117,6 +117,10 @@
}
}


- (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
- (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    if (self.callbackId == nil) {
        NSLog(@"Unexpected call to didRegisterForRemoteNotificationsWithDeviceToken, ignoring: %@", deviceToken);
        return;
    }
    NSLog(@"Push Plugin register success: %@", deviceToken);
    NSLog(@"Push Plugin register success: %@", deviceToken);
    
    
    NSMutableDictionary *results = [NSMutableDictionary dictionary];
    NSMutableDictionary *results = [NSMutableDictionary dictionary];
@@ -180,6 +184,10 @@


- (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
- (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
{
    if (self.callbackId == nil) {
        NSLog(@"Unexpected call to didFailToRegisterForRemoteNotificationsWithError, ignoring: %@", error);
        return;
    }
    NSLog(@"Push Plugin register failed");
    NSLog(@"Push Plugin register failed");
    [self failWithMessage:@"" withError:error];
    [self failWithMessage:@"" withError:error];
}
}