Page MenuHomePhabricator

D6065.id21005.diff
No OneTemporary

D6065.id21005.diff

diff --git a/native/ios/Comm.xcodeproj/project.pbxproj b/native/ios/Comm.xcodeproj/project.pbxproj
--- a/native/ios/Comm.xcodeproj/project.pbxproj
+++ b/native/ios/Comm.xcodeproj/project.pbxproj
@@ -205,6 +205,8 @@
CB38F2BE286C6C980010535C /* DeleteEntryMessageSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DeleteEntryMessageSpec.h; path = PersistentStorageUtilities/MessageOperationsUtilities/MessageSpecs/DeleteEntryMessageSpec.h; sourceTree = "<group>"; };
CB38F2BF286C6C980010535C /* UpdateRelationshipMessageSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UpdateRelationshipMessageSpec.h; path = PersistentStorageUtilities/MessageOperationsUtilities/MessageSpecs/UpdateRelationshipMessageSpec.h; sourceTree = "<group>"; };
CB3C621327CE66540054F24C /* libEXSecureStore.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libEXSecureStore.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ CB7EF17B295C580500B17035 /* CommIOSNotificationsBridgeQueue.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = CommIOSNotificationsBridgeQueue.mm; path = Comm/CommIOSNotifications/CommIOSNotificationsBridgeQueue.mm; sourceTree = "<group>"; };
+ CB7EF17C295C580500B17035 /* CommIOSNotificationsBridgeQueue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CommIOSNotificationsBridgeQueue.h; path = Comm/CommIOSNotifications/CommIOSNotificationsBridgeQueue.h; sourceTree = "<group>"; };
CB90951929531663002F2A7F /* CommIOSNotifications.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommIOSNotifications.h; path = Comm/CommIOSNotifications/CommIOSNotifications.h; sourceTree = "<group>"; };
CBDEC69928ED859600C17588 /* GlobalDBSingleton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GlobalDBSingleton.h; sourceTree = "<group>"; };
CBDEC69A28ED867000C17588 /* GlobalDBSingleton.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = GlobalDBSingleton.mm; path = Comm/GlobalDBSingleton.mm; sourceTree = "<group>"; };
@@ -556,6 +558,8 @@
CB90951729531647002F2A7F /* CommIOSNotifications */ = {
isa = PBXGroup;
children = (
+ CB7EF17C295C580500B17035 /* CommIOSNotificationsBridgeQueue.h */,
+ CB7EF17B295C580500B17035 /* CommIOSNotificationsBridgeQueue.mm */,
CB90951929531663002F2A7F /* CommIOSNotifications.h */,
);
name = CommIOSNotifications;
diff --git a/native/ios/Comm/CommIOSNotifications/CommIOSNotificationsBridgeQueue.h b/native/ios/Comm/CommIOSNotifications/CommIOSNotificationsBridgeQueue.h
new file mode 100644
--- /dev/null
+++ b/native/ios/Comm/CommIOSNotifications/CommIOSNotificationsBridgeQueue.h
@@ -0,0 +1,15 @@
+#import <Foundation/Foundation.h>
+
+@interface CommIOSNotificationsBridgeQueue : NSObject
+
+@property BOOL jsReady;
+@property NSDictionary *openedRemoteNotification;
+
++ (nonnull instancetype)sharedInstance;
+
+- (void)putAction:(NSDictionary *)action;
+- (void)putNotification:(NSDictionary *)notifInfo;
+- (void)processActions:(void (^)(NSDictionary *))block;
+- (void)processNotifications:(void (^)(NSDictionary *))block;
+
+@end
diff --git a/native/ios/Comm/CommIOSNotifications/CommIOSNotificationsBridgeQueue.mm b/native/ios/Comm/CommIOSNotifications/CommIOSNotificationsBridgeQueue.mm
new file mode 100644
--- /dev/null
+++ b/native/ios/Comm/CommIOSNotifications/CommIOSNotificationsBridgeQueue.mm
@@ -0,0 +1,59 @@
+#import "CommIOSNotificationsBridgeQueue.h"
+
+@implementation CommIOSNotificationsBridgeQueue
+
+NSMutableArray<NSDictionary *> *commActionsQueue;
+NSMutableArray<NSDictionary *> *commNotificationsQueue;
+
++ (nonnull instancetype)sharedInstance {
+ static CommIOSNotificationsBridgeQueue *sharedInstance = nil;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ sharedInstance = [self new];
+ });
+
+ return sharedInstance;
+}
+
+- (instancetype)init {
+ commActionsQueue = [NSMutableArray new];
+ commNotificationsQueue = [NSMutableArray new];
+ self.jsReady = NO;
+ return self;
+}
+
+- (void)putNotification:(NSDictionary *)notifInfo {
+ if (!commNotificationsQueue) {
+ return;
+ }
+ [commNotificationsQueue addObject:notifInfo];
+}
+
+- (void)processNotifications:(void (^)(NSDictionary *))block {
+ if (!commNotificationsQueue) {
+ return;
+ }
+ for (id notifInfo in commNotificationsQueue) {
+ block(notifInfo);
+ }
+ commNotificationsQueue = nil;
+}
+
+- (void)putAction:(NSDictionary *)actionInfo {
+ if (!commActionsQueue) {
+ return;
+ }
+ [commActionsQueue addObject:actionInfo];
+}
+
+- (void)processActions:(void (^)(NSDictionary *))block {
+ if (!commActionsQueue) {
+ return;
+ }
+ for (id actionInfo in commActionsQueue) {
+ block(actionInfo);
+ }
+ commActionsQueue = nil;
+}
+
+@end

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 7:15 PM (21 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2678533
Default Alt Text
D6065.id21005.diff (4 KB)

Event Timeline