Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
</config-file>
<framework src="com.android.support:support-v13:27.+"/>
<framework src="me.leolin:ShortcutBadger:1.1.17@aar"/>
<framework src="com.google.firebase:firebase-messaging:11.+"/>
<framework src="com.google.firebase:firebase-messaging:$FCM_VERSION"/>
<preference name="FCM_VERSION" default="11.6.2"/>
<framework src="push.gradle" custom="true" type="gradleReference"/>
<source-file src="src/android/com/adobe/phonegap/push/FCMService.java" target-dir="src/com/adobe/phonegap/push/"/>
<source-file src="src/android/com/adobe/phonegap/push/PushConstants.java" target-dir="src/com/adobe/phonegap/push/"/>
Expand Down
15 changes: 5 additions & 10 deletions src/ios/PushPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ -(void)initRegistration;
}
}

[self registerWithToken:registrationToken];
[self registerWithToken:registrationToken withRegistrationType:@"FCM"];
} else {
NSLog(@"FCM token is null");
}
Expand Down Expand Up @@ -405,9 +405,7 @@ - (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[results setValue:dev.model forKey:@"deviceModel"];
[results setValue:dev.systemVersion forKey:@"deviceSystemVersion"];

if(![self usesFCM]) {
[self registerWithToken: token];
}
[self registerWithToken: token withRegistrationType:@"APNS"];
#endif
}

Expand Down Expand Up @@ -547,15 +545,12 @@ -(void)successWithMessage:(NSString *)myCallbackId withMsg:(NSString *)message
}
}

-(void)registerWithToken:(NSString*)token; {
-(void)registerWithToken:(NSString*)token withRegistrationType:(NSString*)registrationType
{
// Send result to trigger 'registration' event but keep callback
NSMutableDictionary* message = [NSMutableDictionary dictionaryWithCapacity:2];
[message setObject:token forKey:@"registrationId"];
if ([self usesFCM]) {
[message setObject:@"FCM" forKey:@"registrationType"];
} else {
[message setObject:@"APNS" forKey:@"registrationType"];
}
[message setObject:registrationType forKey:@"registrationType"];
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:message];
[pluginResult setKeepCallbackAsBool:YES];
[self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
Expand Down