Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33037347
D6071.1768410624.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D6071.1768410624.diff
View Options
diff --git a/native/ios/Comm/AppDelegate.mm b/native/ios/Comm/AppDelegate.mm
--- a/native/ios/Comm/AppDelegate.mm
+++ b/native/ios/Comm/AppDelegate.mm
@@ -26,8 +26,8 @@
@end
#endif
+#import "CommIOSNotifications.h"
#import "Orientation.h"
-#import "RNNotifications.h"
#import <React/RCTConvert.h>
#import <React/RCTBridge+Private.h>
@@ -158,13 +158,13 @@
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
- [RNNotifications
+ [CommIOSNotifications
didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
- (void)application:(UIApplication *)application
didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
- [RNNotifications didFailToRegisterForRemoteNotificationsWithError:error];
+ [CommIOSNotifications didFailToRegisterForRemoteNotificationsWithError:error];
}
// Required for the notification event. You must call the completion handler
@@ -173,6 +173,7 @@
didReceiveRemoteNotification:(NSDictionary *)notification
fetchCompletionHandler:
(void (^)(UIBackgroundFetchResult))completionHandler {
+ comm::Logger::log("AppDelegate: Received Remote Notification");
BOOL handled = NO;
if (notification[@"aps"][@"content-available"] &&
notification[backgroundNotificationTypeKey]) {
@@ -184,8 +185,8 @@
return;
}
- [RNNotifications didReceiveRemoteNotification:notification
- fetchCompletionHandler:completionHandler];
+ [CommIOSNotifications didReceiveRemoteNotification:notification
+ fetchCompletionHandler:completionHandler];
}
- (BOOL)handleBackgroundNotification:(NSDictionary *)notification
@@ -202,22 +203,9 @@
comm::ThreadOperations::updateSQLiteUnreadStatus(threadID, false);
});
}
- [[UNUserNotificationCenter currentNotificationCenter]
- getDeliveredNotificationsWithCompletionHandler:^(
- NSArray<UNNotification *> *notifications) {
- for (UNNotification *notif in notifications) {
- if ([notification[@"notificationId"]
- isEqual:notif.request.content.userInfo[@"id"]]) {
- NSArray *identifiers =
- [NSArray arrayWithObjects:notif.request.identifier, nil];
- [[UNUserNotificationCenter currentNotificationCenter]
- removeDeliveredNotificationsWithIdentifiers:identifiers];
- }
- }
- dispatch_async(dispatch_get_main_queue(), ^{
- completionHandler(UIBackgroundFetchResultNewData);
- });
- }];
+ [CommIOSNotifications
+ clearNotificationFromNotificationsCenter:notification[@"notificationId"]
+ completionHandler:completionHandler];
return YES;
}
return NO;
@@ -226,7 +214,7 @@
// Required for the localNotification event.
- (void)application:(UIApplication *)application
didReceiveLocalNotification:(UILocalNotification *)notification {
- [RNNotifications didReceiveLocalNotification:notification];
+ [CommIOSNotifications didReceiveLocalNotification:notification];
}
- (UIInterfaceOrientationMask)application:(UIApplication *)application
diff --git a/native/push/ios.js b/native/push/ios.js
--- a/native/push/ios.js
+++ b/native/push/ios.js
@@ -1,6 +1,8 @@
// @flow
-import NotificationsIOS from 'react-native-notifications';
+import { NativeModules } from 'react-native';
+
+const { CommIOSNotifications } = NativeModules;
type PushPermissions = { alert?: boolean, badge?: boolean, sound?: boolean };
@@ -12,7 +14,7 @@
firstRun = false;
if (!permissionNeeded) {
- const permissions: PushPermissions = await NotificationsIOS.checkPermissions();
+ const permissions: PushPermissions = await CommIOSNotifications.checkPermissions();
permissionNeeded = permissionMissing(permissions);
}
@@ -21,10 +23,10 @@
return;
}
currentlyActive = true;
- await NotificationsIOS.requestPermissions();
+ await CommIOSNotifications.requestPermissions();
}
- NotificationsIOS.consumeBackgroundQueue();
+ CommIOSNotifications.consumeBackgroundQueue();
}
function iosPushPermissionResponseReceived() {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 14, 5:10 PM (1 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5933050
Default Alt Text
D6071.1768410624.diff (4 KB)
Attached To
Mode
D6071: Use CommIOSNotifications in AppDelegate and in JavaScript to request permissions
Attached
Detach File
Event Timeline
Log In to Comment