Page MenuHomePhabricator

D6139.diff
No OneTemporary

D6139.diff

diff --git a/native/ios/Comm/CommIOSNotifications/CommIOSNotifications.mm b/native/ios/Comm/CommIOSNotifications/CommIOSNotifications.mm
--- a/native/ios/Comm/CommIOSNotifications/CommIOSNotifications.mm
+++ b/native/ios/Comm/CommIOSNotifications/CommIOSNotifications.mm
@@ -2,6 +2,7 @@
#import "CommIOSNotificationsBridgeQueue.h"
#import "Logger.h"
#import <React/RCTBridge.h>
+#import <React/RCTConvert.h>
#import <React/RCTEventDispatcher.h>
#import <React/RCTUtils.h>
#import <UIKit/UIKit.h>
@@ -18,6 +19,24 @@
@"CommIOSNotificationsReceivedForeground";
NSString *const CommIOSNotificationsOpened = @"CommIOSNotificationsOpened";
+/*
+ UIBackgroundFetchResult enum converter to pass fetch result value
+ between Objective - C and JavaScript
+*/
+@implementation RCTConvert (UIBackgroundFetchResult)
+
+RCT_ENUM_CONVERTER(
+ UIBackgroundFetchResult,
+ (@{
+ @"UIBackgroundFetchResultNewData" : @(UIBackgroundFetchResultNewData),
+ @"UIBackgroundFetchResultNoData" : @(UIBackgroundFetchResultNoData),
+ @"UIBackgroundFetchResultFailed" : @(UIBackgroundFetchResultFailed),
+ }),
+ UIBackgroundFetchResultNoData,
+ integerValue)
+
+@end
+
@implementation CommIOSNotifications
RCT_EXPORT_MODULE()
@@ -85,6 +104,21 @@
];
}
+/*
+ Constants used un JavaScript
+*/
+- (NSDictionary *)constantsToExport {
+ return @{
+ @"FETCH_RESULT_NEW_DATA" : @"UIBackgroundFetchResultNewData",
+ @"FETCH_RESULT_NO_DATA" : @"UIBackgroundFetchResultNoData",
+ @"FETCH_RESULT_FAILED" : @"UIBackgroundFetchResultFailed"
+ };
+}
+
++ (BOOL)requiresMainQueueSetup {
+ return YES;
+}
+
/*
Public methods
*/

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 20, 3:32 PM (16 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2678521
Default Alt Text
D6139.diff (1 KB)

Event Timeline