Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3279659
D3297.id12841.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D3297.id12841.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
@@ -7,7 +7,6 @@
#import <React/RCTConvert.h>
#import <React/RCTRootView.h>
-#import <ExpoModulesCore/EXModuleRegistryProvider.h>
#import <React/RCTBridge+Private.h>
#import <React/RCTCxxBridgeDelegate.h>
#import <React/RCTJSIExecutorRuntimeInstaller.h>
@@ -15,11 +14,7 @@
#import <jsireact/JSIExecutor.h>
#import <reacthermes/HermesExecutorFactory.h>
-#import <EXSecureStore/EXSecureStore.h>
-
#import "CommCoreModule.h"
-#import "CommSecureStore.h"
-#import "CommSecureStoreIOSWrapper.h"
#import "GlobalNetworkSingleton.h"
#import "NetworkModule.h"
#import "SQLiteQueryExecutor.h"
@@ -62,12 +57,14 @@
}
@end
-@interface CommSecureStoreIOSWrapper ()
-- (void)init:(EXSecureStore *)secureStore;
-@end
-
@implementation AppDelegate
+- (BOOL)application:(UIApplication *)application
+ willFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ [self attemptDatabaseInitialization];
+ return YES;
+}
+
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
#ifdef FB_SONARKIT_ENABLED
@@ -103,17 +100,6 @@
rootView.loadingViewFadeDelay = 0;
rootView.loadingViewFadeDuration = 0.001;
- EXModuleRegistryProvider *moduleRegistryProvider =
- [[EXModuleRegistryProvider alloc] init];
- EXSecureStore *secureStore =
- (EXSecureStore *)[[moduleRegistryProvider moduleRegistry]
- getExportedModuleOfClass:EXSecureStore.class];
- [[CommSecureStoreIOSWrapper sharedInstance] init:secureStore];
-
- // initialize SQLiteQueryExecutor
- std::string sqliteFilePath =
- std::string([[Tools getSQLiteFilePath] UTF8String]);
- comm::SQLiteQueryExecutor::initialize(sqliteFilePath);
return YES;
}
@@ -243,6 +229,12 @@
makeRuntimeConfig(3072));
}
+- (void)attemptDatabaseInitialization {
+ std::string sqliteFilePath =
+ std::string([[Tools getSQLiteFilePath] UTF8String]);
+ comm::SQLiteQueryExecutor::initialize(sqliteFilePath);
+}
+
// Copied from
// ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/OnLoad.cpp
static ::hermes::vm::RuntimeConfig
diff --git a/native/ios/Comm/CommSecureStoreIOSWrapper.mm b/native/ios/Comm/CommSecureStoreIOSWrapper.mm
--- a/native/ios/Comm/CommSecureStoreIOSWrapper.mm
+++ b/native/ios/Comm/CommSecureStoreIOSWrapper.mm
@@ -1,9 +1,10 @@
#import "CommSecureStoreIOSWrapper.h"
#import "CommSecureStoreIOSWrapper.h"
+#import <ExpoModulesCore/EXModuleRegistryProvider.h>
@interface CommSecureStoreIOSWrapper ()
-@property(nonatomic, assign) EXSecureStore *secureStore;
+@property(nonatomic, strong) EXSecureStore *secureStore;
@property(nonatomic, strong) NSDictionary *options;
@end
@@ -26,14 +27,16 @@
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
shared = [[self alloc] init];
+ EXModuleRegistryProvider *moduleRegistryProvider =
+ [[EXModuleRegistryProvider alloc] init];
+ EXSecureStore *secureStore =
+ (EXSecureStore *)[[moduleRegistryProvider moduleRegistry]
+ getExportedModuleOfClass:EXSecureStore.class];
+ shared.secureStore = secureStore;
});
return shared;
}
-- (void)init:(EXSecureStore *)secureStore {
- _secureStore = secureStore;
-}
-
- (void)set:(NSString *)key value:(NSString *)value {
if ([self secureStore] == nil) {
[NSException raise:@"secure store error"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 8:50 AM (21 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2496918
Default Alt Text
D3297.id12841.diff (3 KB)
Attached To
Mode
D3297: Enable database initialization without starting JS on iOS
Attached
Detach File
Event Timeline
Log In to Comment