Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3278715
D3297.id10023.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.id10023.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,8 +14,6 @@
#import <jsireact/JSIExecutor.h>
#import <reacthermes/HermesExecutorFactory.h>
-#import <EXSecureStore/EXSecureStore.h>
-
#import "CommCoreModule.h"
#import "CommSecureStore.h"
#import "CommSecureStoreIOSWrapper.h"
@@ -62,12 +59,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 +102,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 +231,13 @@
makeRuntimeConfig(3072));
}
+- (void)attemptDatabaseInitialization {
+ [[CommSecureStoreIOSWrapper sharedInstance] initialize];
+ 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.h b/native/ios/Comm/CommSecureStoreIOSWrapper.h
--- a/native/ios/Comm/CommSecureStoreIOSWrapper.h
+++ b/native/ios/Comm/CommSecureStoreIOSWrapper.h
@@ -1,12 +1,13 @@
#pragma once
-
#import <EXSecureStore/EXSecureStore.h>
+#import <ExpoModulesCore/EXModuleRegistryProvider.h>
#import <Foundation/Foundation.h>
@interface CommSecureStoreIOSWrapper : NSObject
+ (id)sharedInstance;
+- (void)initialize;
- (void)set:(NSString *)key value:(NSString *)value;
- (NSString *)get:(NSString *)key;
@end
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
@@ -3,7 +3,7 @@
#import "CommSecureStoreIOSWrapper.h"
@interface CommSecureStoreIOSWrapper ()
-@property(nonatomic, assign) EXSecureStore *secureStore;
+@property(nonatomic, strong) EXSecureStore *secureStore;
@property(nonatomic, strong) NSDictionary *options;
@end
@@ -30,8 +30,17 @@
return shared;
}
-- (void)init:(EXSecureStore *)secureStore {
- _secureStore = secureStore;
+- (void)initialize {
+ if ([self secureStore] != nil) {
+ return;
+ }
+
+ EXModuleRegistryProvider *moduleRegistryProvider =
+ [[EXModuleRegistryProvider alloc] init];
+ EXSecureStore *secureStore =
+ (EXSecureStore *)[[moduleRegistryProvider moduleRegistry]
+ getExportedModuleOfClass:EXSecureStore.class];
+ self.secureStore = secureStore;
}
- (void)set:(NSString *)key value:(NSString *)value {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 8:29 AM (20 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2520058
Default Alt Text
D3297.id10023.diff (3 KB)
Attached To
Mode
D3297: Enable database initialization without starting JS on iOS
Attached
Detach File
Event Timeline
Log In to Comment