Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33078786
D6072.1768450667.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D6072.1768450667.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
Thu, Jan 15, 4:17 AM (19 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5935884
Default Alt Text
D6072.1768450667.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