mirror of
https://github.com/zhigang1992/react-native-notifications.git
synced 2026-06-13 01:28:11 +08:00
Merge pull request #62 from Benjamin-Dobell/fcm-ios
Accept string device tokens
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user