Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3393632
D4240.id13600.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
D4240.id13600.diff
View Options
diff --git a/native/android/app/src/main/java/app/comm/android/CommCoreJSIModulePackage.java b/native/android/app/src/main/java/app/comm/android/CommCoreJSIModulePackage.java
--- a/native/android/app/src/main/java/app/comm/android/CommCoreJSIModulePackage.java
+++ b/native/android/app/src/main/java/app/comm/android/CommCoreJSIModulePackage.java
@@ -13,6 +13,7 @@
import java.lang.reflect.Field;
import java.util.Collections;
import java.util.List;
+import java.util.function.Supplier;
public class CommCoreJSIModulePackage extends ReanimatedJSIModulePackage {
@@ -20,25 +21,9 @@
public List<JSIModuleSpec> getJSIModules(
ReactApplicationContext reactApplicationContext,
JavaScriptContextHolder jsContext) {
- ModuleRegistry moduleRegistry;
- try {
- Field moduleRegistryField =
- NativeModulesProxy.class.getDeclaredField("mModuleRegistry");
- moduleRegistryField.setAccessible(true);
- NativeModulesProxy proxy =
- (NativeModulesProxy)reactApplicationContext.getCatalystInstance()
- .getNativeModule("NativeUnimoduleProxy");
- moduleRegistry = (ModuleRegistry)moduleRegistryField.get(proxy);
- } catch (Exception e) {
- throw new RuntimeException(
- "Accessing expo modules registry resulted in an error: " +
- Log.getStackTraceString(e) +
- "This might be due to changes in expo's internal implementation.");
- }
- SecureStoreModule secureStoreModule =
- (SecureStoreModule)moduleRegistry.getExportedModuleOfClass(
- SecureStoreModule.class);
- CommSecureStore.getInstance().initialize(secureStoreModule);
+ Supplier<SecureStoreModule> secureStoreModuleSupplier =
+ () -> new SecureStoreModule(reactApplicationContext);
+ CommSecureStore.getInstance().initialize(secureStoreModuleSupplier);
CommHybrid.initHybrid(reactApplicationContext);
super.getJSIModules(reactApplicationContext, jsContext);
return Collections.emptyList();
diff --git a/native/android/app/src/main/java/app/comm/android/fbjni/CommSecureStore.java b/native/android/app/src/main/java/app/comm/android/fbjni/CommSecureStore.java
--- a/native/android/app/src/main/java/app/comm/android/fbjni/CommSecureStore.java
+++ b/native/android/app/src/main/java/app/comm/android/fbjni/CommSecureStore.java
@@ -4,6 +4,7 @@
import expo.modules.core.arguments.MapArguments;
import expo.modules.core.arguments.ReadableArguments;
import expo.modules.securestore.SecureStoreModule;
+import java.util.function.Supplier;
public class CommSecureStore {
@@ -19,8 +20,15 @@
return CommSecureStore.instance;
}
- public void initialize(SecureStoreModule secureStoreModule) {
- this.secureStoreModule = secureStoreModule;
+ public void
+ initialize(Supplier<SecureStoreModule> secureStoreModuleSupplier) {
+ if (this.secureStoreModule == null) {
+ synchronized (this) {
+ if (this.secureStoreModule == null) {
+ this.secureStoreModule = secureStoreModuleSupplier.get();
+ }
+ }
+ }
}
private void checkModule() {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 3:14 PM (21 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2605179
Default Alt Text
D4240.id13600.diff (3 KB)
Attached To
Mode
D4240: Make CommSecureStore initialization idempotent on Android
Attached
Detach File
Event Timeline
Log In to Comment