Merge pull request #62 from Benjamin-Dobell/fcm-ios

Accept string device tokens
This commit is contained in:
Ran Greenberg
2017-10-24 20:19:18 +03:00
committed by GitHub
2 changed files with 4 additions and 3 deletions

View File

@@ -9,7 +9,7 @@
@interface RNNotifications : NSObject <RCTBridgeModule>
+ (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
+ (void)didRegisterForRemoteNotificationsWithDeviceToken:(id)deviceToken;
+ (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
+ (void)didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings;
+ (void)didUpdatePushCredentials:(PKPushCredentials *)credentials forType:(NSString *)type;

View File

@@ -235,11 +235,12 @@ RCT_EXPORT_MODULE()
}
}
+ (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
+ (void)didRegisterForRemoteNotificationsWithDeviceToken:(id)deviceToken
{
NSString *tokenRepresentation = [deviceToken isKindOfClass:[NSString class]] ? deviceToken : [self deviceTokenToString:deviceToken];
[[NSNotificationCenter defaultCenter] postNotificationName:RNNotificationsRegistered
object:self
userInfo:@{@"deviceToken": [self deviceTokenToString:deviceToken]}];
userInfo:@{@"deviceToken": tokenRepresentation}];
}
+ (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {