Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3248325
D6072.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D6072.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
@@ -301,6 +301,25 @@
completionHandler:authorizationRequestCompletionHandler];
}
+RCT_EXPORT_METHOD(completeNotif
+ : (NSString *)completionKey fetchResult
+ : (UIBackgroundFetchResult)result) {
+ RCTRemoteNotificationCallback completionHandler =
+ self.remoteNotificationCallbacks[completionKey];
+ if (!completionHandler) {
+ NSLog(@"There is no completion handler with key: %@", completionKey);
+ return;
+ }
+ completionHandler(result);
+ [self.remoteNotificationCallbacks removeObjectForKey:completionKey];
+}
+
+RCT_EXPORT_METHOD(setBadgesCount : (int)count) {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [[UIApplication sharedApplication] setApplicationIconBadgeNumber:count];
+ });
+}
+
RCT_EXPORT_METHOD(consumeBackgroundQueue) {
CommIOSNotificationsBridgeQueue.sharedInstance.jsReady = YES;
@@ -344,4 +363,37 @@
}];
}
+RCT_EXPORT_METHOD(removeAllDeliveredNotifications) {
+ [UNUserNotificationCenter
+ .currentNotificationCenter removeAllDeliveredNotifications];
+}
+
+RCT_EXPORT_METHOD(removeDeliveredNotifications
+ : (NSArray<NSString *> *)identifiers) {
+ [UNUserNotificationCenter.currentNotificationCenter
+ removeDeliveredNotificationsWithIdentifiers:identifiers];
+}
+RCT_EXPORT_METHOD(getDeliveredNotifications
+ : (RCTResponseSenderBlock)callback) {
+ [UNUserNotificationCenter.currentNotificationCenter
+ getDeliveredNotificationsWithCompletionHandler:^(
+ NSArray<UNNotification *> *_Nonnull notifications) {
+ NSMutableArray<NSDictionary *> *formattedNotifications =
+ [NSMutableArray new];
+
+ for (UNNotification *notification in notifications) {
+ NSDictionary *jsReadableNotification = [CommIOSNotifications
+ parseNotificationToJSReadableObject:notification.request.content
+ .userInfo
+ withRequestIdentifier:notification.request
+ .identifier];
+ if (!jsReadableNotification) {
+ continue;
+ }
+ [formattedNotifications addObject:jsReadableNotification];
+ }
+ callback(@[ formattedNotifications ]);
+ }];
+}
+
@end
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 16, 9:22 AM (21 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2497120
Default Alt Text
D6072.diff (2 KB)
Attached To
Mode
D6072: Export all react-native methods needed to replace rect-native-notifications
Attached
Detach File
Event Timeline
Log In to Comment