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 @@ -60,6 +60,7 @@ CB4821AF27CFB19D001AB7E1 /* PlatformSpecificTools.mm in Sources */ = {isa = PBXBuildFile; fileRef = 71762A74270D8AAE00F565ED /* PlatformSpecificTools.mm */; }; CB4821B127CFB1FA001AB7E1 /* GlobalNetworkSingleton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 726E5D762731A5E10032361D /* GlobalNetworkSingleton.cpp */; }; CB4821B227CFB20E001AB7E1 /* SQLiteQueryExecutor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 71BE84412636A944002849D2 /* SQLiteQueryExecutor.cpp */; }; + CB64AA76284F4DC900460699 /* ThreadOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CB64AA74284F4DC900460699 /* ThreadOperations.cpp */; }; D7DB6E0F85B2DBE15B01EC21 /* libPods-Comm.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 994BEBDD4E4959F69CEA0BC3 /* libPods-Comm.a */; }; F02C296C528B51ADAB5AA19D /* libPods-NotificationService.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EE4DCB430B05EC9DE7D7B01 /* libPods-NotificationService.a */; }; /* End PBXBuildFile section */ @@ -186,6 +187,8 @@ CB1648B027CFD07E00394D9D /* CommRelease.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = CommRelease.entitlements; path = Comm/CommRelease.entitlements; sourceTree = ""; }; CB30C12327D0ACF700FBE8DE /* NotificationService.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = NotificationService.entitlements; sourceTree = ""; }; CB3C621327CE66540054F24C /* libEXSecureStore.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libEXSecureStore.a; sourceTree = BUILT_PRODUCTS_DIR; }; + CB64AA74284F4DC900460699 /* ThreadOperations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadOperations.cpp; path = ../PersistentStorageUtilities/ThreadOperationsUtilities/ThreadOperations.cpp; sourceTree = ""; }; + CB64AA75284F4DC900460699 /* ThreadOperations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadOperations.h; path = ../PersistentStorageUtilities/ThreadOperationsUtilities/ThreadOperations.h; sourceTree = ""; }; F53DA7B3F26C2798DCE74A94 /* Pods-Comm.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Comm.debug.xcconfig"; path = "Target Support Files/Pods-Comm/Pods-Comm.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -345,6 +348,7 @@ 71BE843A2636A944002849D2 /* NativeModules */ = { isa = PBXGroup; children = ( + CBED0E2C284E086100CD3863 /* PersistentStorageUtilities */, 726E5D722731A4240032361D /* InternalModules */, 71BE843C2636A944002849D2 /* CommCoreModule.cpp */, 71BE843E2636A944002849D2 /* CommCoreModule.h */, @@ -491,6 +495,23 @@ name = ExpoModulesProviders; sourceTree = ""; }; + CB64AA73284F4D4C00460699 /* ThreadOperationsUtilities */ = { + isa = PBXGroup; + children = ( + CB64AA74284F4DC900460699 /* ThreadOperations.cpp */, + CB64AA75284F4DC900460699 /* ThreadOperations.h */, + ); + path = ThreadOperationsUtilities; + sourceTree = ""; + }; + CBED0E2C284E086100CD3863 /* PersistentStorageUtilities */ = { + isa = PBXGroup; + children = ( + CB64AA73284F4D4C00460699 /* ThreadOperationsUtilities */, + ); + name = PersistentStorageUtilities; + sourceTree = ""; + }; D533B93718E3B9684B508006 /* Pods */ = { isa = PBXGroup; children = ( @@ -852,6 +873,7 @@ 71BF5B7F26BBDD7400EDE27D /* CryptoModule.cpp in Sources */, 71BE844A2636A944002849D2 /* CommCoreModule.cpp in Sources */, 71D4D7CC26C50B1000FCDBCD /* CommSecureStore.mm in Sources */, + CB64AA76284F4DC900460699 /* ThreadOperations.cpp in Sources */, 711B408425DA97F9005F8F06 /* dummy.swift in Sources */, 726E5D782731A5E10032361D /* GlobalNetworkSingleton.cpp in Sources */, 13B07FC11A68108700A75B9A /* main.m in Sources */, 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 @@ -16,8 +16,10 @@ #import "CommCoreModule.h" #import "GlobalNetworkSingleton.h" +#import "Logger.h" #import "NetworkModule.h" #import "SQLiteQueryExecutor.h" +#import "ThreadOperations.h" #import "Tools.h" #import #import @@ -52,6 +54,7 @@ #import NSString *const backgroundNotificationTypeKey = @"backgroundNotifType"; +NSString *const setUnreadStatusKey = @"setUnreadStatus"; @interface AppDelegate () < RCTCxxBridgeDelegate, @@ -157,6 +160,14 @@ return YES; } else if ([notification[backgroundNotificationTypeKey] isEqualToString:@"CLEAR"]) { + if (notification[setUnreadStatusKey]) { + std::string threadID = + std::string([notification[@"threadID"] UTF8String]); + // this callback may be called from inactive state so we need + // to initialize the database + [self attemptDatabaseInitialization]; + comm::ThreadOperations::updateSQLiteUnreadStatus(threadID, false); + } [[UNUserNotificationCenter currentNotificationCenter] getDeliveredNotificationsWithCompletionHandler:^( NSArray *notifications) {