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 @@ -15,6 +15,7 @@ #import #import "CommCoreModule.h" +#import "GlobalDBSingletonIOSProxy.h" #import "GlobalNetworkSingleton.h" #import "Logger.h" #import "MessageOperationsUtilities.h" @@ -168,7 +169,10 @@ // this callback may be called from inactive state so we need // to initialize the database [self attemptDatabaseInitialization]; - comm::ThreadOperations::updateSQLiteUnreadStatus(threadID, false); + [GlobalDBSingletonIOSProxy + scheduleOrRun:([threadID]() mutable { + comm::ThreadOperations::updateSQLiteUnreadStatus(threadID, false); + })]; } [[UNUserNotificationCenter currentNotificationCenter] getDeliveredNotificationsWithCompletionHandler:^( @@ -271,7 +275,10 @@ NSArray *messages = [temporaryStorage readAndClearMessages]; for (NSString *message in messages) { std::string messageInfos = std::string([message UTF8String]); - comm::MessageOperationsUtilities::storeMessageInfos(messageInfos); + [GlobalDBSingletonIOSProxy + scheduleOrRun:([messageInfos]() mutable { + comm::MessageOperationsUtilities::storeMessageInfos(messageInfos); + })]; } }