|
14 | 14 | #import "RCTEventDispatcher.h" |
15 | 15 | #import "RCTUtils.h" |
16 | 16 |
|
17 | | -NSString *const RNVoipRemoteNotificationsRegistered = @"VoipRemoteNotificationsRegistered"; |
18 | | -NSString *const RNVoipLocalNotificationReceived = @"VoipLocalNotificationReceived"; |
19 | | -NSString *const RNVoipRemoteNotificationReceived = @"VoipRemoteNotificationReceived"; |
| 17 | +NSString *const RNVoipRemoteNotificationsRegistered = @"voipRemoteNotificationsRegistered"; |
| 18 | +NSString *const RNVoipLocalNotificationReceived = @"voipLocalNotificationReceived"; |
| 19 | +NSString *const RNVoipRemoteNotificationReceived = @"voipRemoteNotificationReceived"; |
| 20 | + |
| 21 | +static NSString *RCTCurrentAppBackgroundState() |
| 22 | +{ |
| 23 | + static NSDictionary *states; |
| 24 | + static dispatch_once_t onceToken; |
| 25 | + dispatch_once(&onceToken, ^{ |
| 26 | + states = @{ |
| 27 | + @(UIApplicationStateActive): @"active", |
| 28 | + @(UIApplicationStateBackground): @"background", |
| 29 | + @(UIApplicationStateInactive): @"inactive" |
| 30 | + }; |
| 31 | + }); |
| 32 | + |
| 33 | + if (RCTRunningInAppExtension()) { |
| 34 | + return @"extension"; |
| 35 | + } |
| 36 | + |
| 37 | + return states[@(RCTSharedApplication().applicationState)] ? : @"unknown"; |
| 38 | +} |
20 | 39 |
|
21 | 40 | @implementation RCTConvert (UILocalNotification) |
22 | 41 |
|
@@ -64,6 +83,13 @@ - (void)setBridge:(RCTBridge *)bridge |
64 | 83 | object:nil]; |
65 | 84 | } |
66 | 85 |
|
| 86 | +- (NSDictionary<NSString *, id> *)constantsToExport |
| 87 | +{ |
| 88 | + NSString *currentState = RCTCurrentAppBackgroundState(); |
| 89 | + NSLog(@"[RNVoipPushNotificationManager] constantsToExport currentState = %@", currentState); |
| 90 | + return @{@"wakeupByPush": (currentState == @"background") ? @"true" : @"false"}; |
| 91 | +} |
| 92 | + |
67 | 93 | - (void)registerUserNotification:(NSDictionary *)permissions |
68 | 94 | { |
69 | 95 | UIUserNotificationType types = UIUserNotificationTypeNone; |
|
0 commit comments