Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3497392
D6139.id21434.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D6139.id21434.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 20, 7:05 PM (14 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2678521
Default Alt Text
D6139.id21434.diff (1 KB)
Attached To
Mode
D6139: Export Background Fetch result constants from CommIOSNotifications to JavaScript
Attached
Detach File
Event Timeline
Log In to Comment