mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-01-12 22:50:20 +08:00
[ios] Use RCTSharedApplication() instead of [UIApplication sharedApplication]
This commit is contained in:
@@ -296,7 +296,7 @@ RCT_EXPORT_METHOD(requestPermissions:(RCTPromiseResolveBlock)resolve rejecter:(R
|
||||
#endif
|
||||
}
|
||||
|
||||
[[UIApplication sharedApplication] registerForRemoteNotifications];
|
||||
[RCTSharedApplication() registerForRemoteNotifications];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(subscribeToTopic: (NSString*) topic)
|
||||
@@ -380,10 +380,10 @@ RCT_EXPORT_METHOD(cancelLocalNotification:(NSString*) notificationId)
|
||||
if([UNUserNotificationCenter currentNotificationCenter] != nil){
|
||||
[[UNUserNotificationCenter currentNotificationCenter] removePendingNotificationRequestsWithIdentifiers:@[notificationId]];
|
||||
}else {
|
||||
for (UILocalNotification *notification in [UIApplication sharedApplication].scheduledLocalNotifications) {
|
||||
for (UILocalNotification *notification in RCTSharedApplication().scheduledLocalNotifications) {
|
||||
NSDictionary<NSString *, id> *notificationInfo = notification.userInfo;
|
||||
if([notificationId isEqualToString:[notificationInfo valueForKey:@"id"]]){
|
||||
[[UIApplication sharedApplication] cancelLocalNotification:notification];
|
||||
[RCTSharedApplication() cancelLocalNotification:notification];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
- (void)testRendersWelcomeScreen
|
||||
{
|
||||
UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
|
||||
UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
|
||||
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
|
||||
BOOL foundElement = NO;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user