[ios] Use RCTSharedApplication() instead of [UIApplication sharedApplication]

This commit is contained in:
Chris Bianca 2017-05-15 12:00:41 +01:00
parent 67960ddab4
commit 90a130c729
2 changed files with 4 additions and 4 deletions

View File

@ -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];
}
}
}

View File

@ -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;