expo-modules-core 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,12 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.11.1 — 2022-07-11
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Fixed a crash when remote debugging is enabled on Android. ([#18165](https://github.com/expo/expo/pull/18165) by [@kudo](https://github.com/kudo))
18
+
13
19
  ## 0.11.0 — 2022-07-07
14
20
 
15
21
  ### 🎉 New features
@@ -6,7 +6,7 @@ apply plugin: 'maven-publish'
6
6
  apply plugin: "de.undercouch.download"
7
7
 
8
8
  group = 'host.exp.exponent'
9
- version = '0.11.0'
9
+ version = '0.11.1'
10
10
 
11
11
  buildscript {
12
12
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -144,7 +144,7 @@ android {
144
144
  targetSdkVersion safeExtGet("targetSdkVersion", 31)
145
145
  consumerProguardFiles 'proguard-rules.pro'
146
146
  versionCode 1
147
- versionName "0.11.0"
147
+ versionName "0.11.1"
148
148
 
149
149
  testInstrumentationRunner "expo.modules.TestRunner"
150
150
 
@@ -89,13 +89,15 @@ class AppContext(
89
89
  fun installJSIInterop() {
90
90
  jsiInterop = JSIInteropModuleRegistry(this)
91
91
  val reactContext = reactContextHolder.get() ?: return
92
- reactContext.javaScriptContextHolder?.get()?.let {
93
- jsiInterop.installJSI(
94
- it,
95
- reactContext.catalystInstance.jsCallInvokerHolder as CallInvokerHolderImpl,
96
- reactContext.catalystInstance.nativeCallInvokerHolder as CallInvokerHolderImpl
97
- )
98
- }
92
+ reactContext.javaScriptContextHolder?.get()
93
+ ?.takeIf { it != 0L }
94
+ ?.let {
95
+ jsiInterop.installJSI(
96
+ it,
97
+ reactContext.catalystInstance.jsCallInvokerHolder as CallInvokerHolderImpl,
98
+ reactContext.catalystInstance.nativeCallInvokerHolder as CallInvokerHolderImpl
99
+ )
100
+ }
99
101
  }
100
102
 
101
103
  /**
@@ -201,9 +201,10 @@ RCT_EXPORT_MODULE(NativeUnimoduleProxy)
201
201
 
202
202
  - (void)setBridge:(RCTBridge *)bridge
203
203
  {
204
- _appContext = [(ExpoBridgeModule *)[bridge moduleForClass:ExpoBridgeModule.class] appContext];
205
- [_appContext setLegacyModuleRegistry:_exModuleRegistry];
206
- [_appContext setLegacyModulesProxy:self];
204
+ ExpoBridgeModule* expoBridgeModule = [bridge moduleForClass:ExpoBridgeModule.class];
205
+ [expoBridgeModule legacyProxyDidSetBridgeWithLegacyModulesProxy:self
206
+ legacyModuleRegistry:_exModuleRegistry];
207
+ _appContext = [expoBridgeModule appContext];
207
208
 
208
209
  if (!_bridge) {
209
210
  // The `setBridge` can be called during module setup or after. Registering more modules
@@ -28,11 +28,9 @@ public final class AppContext: NSObject {
28
28
  /**
29
29
  The legacy module registry with modules written in the old-fashioned way.
30
30
  */
31
- @objc
32
- public weak var legacyModuleRegistry: EXModuleRegistry?
31
+ internal weak var legacyModuleRegistry: EXModuleRegistry?
33
32
 
34
- @objc
35
- public weak var legacyModulesProxy: LegacyNativeModulesProxy?
33
+ internal weak var legacyModulesProxy: LegacyNativeModulesProxy?
36
34
 
37
35
  /**
38
36
  React bridge of the context's app. Can be `nil` when the bridge
@@ -20,8 +20,7 @@ public final class ExpoBridgeModule: NSObject, RCTBridgeModule {
20
20
  architecture of Expo modules and the app itself.
21
21
  */
22
22
  override init() {
23
- appContext = AppContext().useModulesProvider("ExpoModulesProvider")
24
- appContext.moduleRegistry.register(moduleType: NativeModulesProxyModule.self)
23
+ appContext = AppContext()
25
24
  super.init()
26
25
 
27
26
  // Listen to React Native notifications posted just before the JS is executed.
@@ -50,6 +49,21 @@ public final class ExpoBridgeModule: NSObject, RCTBridgeModule {
50
49
  appContext.reactBridge = bridge
51
50
  }
52
51
  }
52
+
53
+ /**
54
+ This should be called inside EXNativeModulesProxy.setBridge()
55
+ */
56
+ @objc
57
+ public func legacyProxyDidSetBridge(legacyModulesProxy: LegacyNativeModulesProxy,
58
+ legacyModuleRegistry: EXModuleRegistry) {
59
+ appContext.legacyModuleRegistry = legacyModuleRegistry
60
+ appContext.legacyModulesProxy = legacyModulesProxy
61
+
62
+ // we need to register all the modules after the legacy module registry is set
63
+ // otherwise legacy modules (e.g. permissions) won't be available in OnCreate { }
64
+ appContext.useModulesProvider("ExpoModulesProvider")
65
+ appContext.moduleRegistry.register(moduleType: NativeModulesProxyModule.self)
66
+ }
53
67
 
54
68
  // MARK: - Notifications
55
69
 
@@ -188,6 +188,9 @@ fileprivate func reformatStackSymbol(_ symbol: String) -> String {
188
188
  }
189
189
 
190
190
  fileprivate func describe(value: Any) -> String {
191
+ if let value = value as? String {
192
+ return value
193
+ }
191
194
  if let value = value as? CustomDebugStringConvertible {
192
195
  return value.debugDescription
193
196
  }
@@ -22,7 +22,11 @@ public struct Promise: AnyArgument {
22
22
  }
23
23
 
24
24
  public func reject(_ error: Error) {
25
- rejecter(UnexpectedException(error))
25
+ if let exception = error as? Exception {
26
+ rejecter(exception)
27
+ } else {
28
+ rejecter(UnexpectedException(error))
29
+ }
26
30
  }
27
31
 
28
32
  public func reject(_ error: Exception) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-modules-core",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "The core of Expo Modules architecture",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -42,5 +42,5 @@
42
42
  "@testing-library/react-hooks": "^7.0.1",
43
43
  "expo-module-scripts": "^2.0.0"
44
44
  },
45
- "gitHead": "6e131f2da851a47c3a24eb3d6fc971a1a7822086"
45
+ "gitHead": "8151bf48e683a50e942ef213f7978b35c41f5e11"
46
46
  }