expo-modules-core 1.7.0 → 1.8.0

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.
Files changed (77) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/ExpoModulesCore.podspec +1 -1
  3. package/android/build.gradle +2 -2
  4. package/android/src/main/cpp/types/JNIToJSIConverter.cpp +14 -0
  5. package/android/src/main/java/expo/modules/core/logging/PersistentFileLog.kt +2 -0
  6. package/android/src/main/java/expo/modules/kotlin/defaultmodules/CoreModule.kt +5 -2
  7. package/android/src/main/java/expo/modules/kotlin/jni/JavaCallback.kt +25 -13
  8. package/android/src/main/java/expo/modules/kotlin/sharedobjects/SharedRef.kt +7 -0
  9. package/build/index.d.ts +3 -5
  10. package/build/index.d.ts.map +1 -1
  11. package/build/index.js +3 -5
  12. package/build/index.js.map +1 -1
  13. package/build/requireNativeModule.d.ts +9 -0
  14. package/build/requireNativeModule.d.ts.map +1 -1
  15. package/build/requireNativeModule.js +14 -3
  16. package/build/requireNativeModule.js.map +1 -1
  17. package/build/sweet/setUpErrorManager.fx.web.d.ts +1 -0
  18. package/build/sweet/setUpErrorManager.fx.web.d.ts.map +1 -0
  19. package/build/sweet/setUpErrorManager.fx.web.js +1 -0
  20. package/build/sweet/setUpErrorManager.fx.web.js.map +1 -0
  21. package/build/uuid/index.d.ts +1 -2
  22. package/build/uuid/index.d.ts.map +1 -1
  23. package/build/uuid/index.js +1 -2
  24. package/build/uuid/index.js.map +1 -1
  25. package/build/uuid/uuid.d.ts +4 -0
  26. package/build/uuid/uuid.d.ts.map +1 -0
  27. package/build/uuid/uuid.js +15 -0
  28. package/build/uuid/uuid.js.map +1 -0
  29. package/build/uuid/uuid.types.d.ts +14 -0
  30. package/build/uuid/uuid.types.d.ts.map +1 -0
  31. package/build/uuid/uuid.types.js.map +1 -0
  32. package/build/uuid/uuid.web.d.ts +4 -0
  33. package/build/uuid/uuid.web.d.ts.map +1 -0
  34. package/build/uuid/uuid.web.js +18 -0
  35. package/build/uuid/uuid.web.js.map +1 -0
  36. package/ios/AppDelegates/ExpoAppDelegate.swift +17 -8
  37. package/ios/Interfaces/BarcodeScanner/EXBarcodeScannerInterface.h +2 -0
  38. package/ios/Interfaces/Camera/EXCameraInterface.h +2 -0
  39. package/ios/Interfaces/FaceDetector/EXFaceDetectorManagerInterface.h +2 -2
  40. package/ios/Swift/AppContext.swift +9 -2
  41. package/ios/Swift/AppContextConfig.swift +13 -0
  42. package/ios/Swift/DynamicTypes/DynamicSharedObjectType.swift +14 -0
  43. package/ios/Swift/Modules/CoreModule.swift +4 -2
  44. package/ios/Swift/SharedObjects/SharedRef.swift +1 -1
  45. package/package.json +2 -3
  46. package/src/index.ts +2 -6
  47. package/src/requireNativeModule.ts +20 -4
  48. package/src/sweet/setUpErrorManager.fx.web.ts +0 -0
  49. package/src/uuid/index.ts +1 -2
  50. package/src/uuid/uuid.ts +21 -0
  51. package/src/uuid/uuid.types.ts +18 -0
  52. package/src/uuid/uuid.web.ts +22 -0
  53. package/build/SyntheticPlatformEmitter.d.ts +0 -6
  54. package/build/SyntheticPlatformEmitter.d.ts.map +0 -1
  55. package/build/SyntheticPlatformEmitter.js +0 -6
  56. package/build/SyntheticPlatformEmitter.js.map +0 -1
  57. package/build/deprecate.d.ts +0 -9
  58. package/build/deprecate.d.ts.map +0 -1
  59. package/build/deprecate.js +0 -47
  60. package/build/deprecate.js.map +0 -1
  61. package/build/uuid/lib/rng.d.ts +0 -3
  62. package/build/uuid/lib/rng.d.ts.map +0 -1
  63. package/build/uuid/lib/rng.js +0 -35
  64. package/build/uuid/lib/rng.js.map +0 -1
  65. package/build/uuid/types/uuid.types.d.ts +0 -11
  66. package/build/uuid/types/uuid.types.d.ts.map +0 -1
  67. package/build/uuid/types/uuid.types.js.map +0 -1
  68. package/build/uuid/v4.d.ts +0 -6
  69. package/build/uuid/v4.d.ts.map +0 -1
  70. package/build/uuid/v4.js +0 -24
  71. package/build/uuid/v4.js.map +0 -1
  72. package/src/SyntheticPlatformEmitter.ts +0 -5
  73. package/src/deprecate.ts +0 -64
  74. package/src/uuid/lib/rng.ts +0 -42
  75. package/src/uuid/types/uuid.types.ts +0 -12
  76. package/src/uuid/v4.ts +0 -40
  77. /package/build/uuid/{types/uuid.types.js → uuid.types.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -10,6 +10,22 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 1.8.0 — 2023-09-15
14
+
15
+ ### 🎉 New features
16
+
17
+ - Added support for Apple tvOS. ([#24329](https://github.com/expo/expo/pull/24329) by [@douglowder](https://github.com/douglowder))
18
+
19
+ ### 💡 Others
20
+
21
+ - Remove deprecated `RCTDeviceEventEmitter`. ([#24298](https://github.com/expo/expo/pull/24298) by [@EvanBacon](https://github.com/EvanBacon))
22
+ - Remove `deprecate` utility function. ([#24298](https://github.com/expo/expo/pull/24298) by [@EvanBacon](https://github.com/EvanBacon))
23
+ - Deprecate `SyntheticPlatformEmitter` in favor of `DeviceEventEmitter`. ([#24298](https://github.com/expo/expo/pull/24298) by [@EvanBacon](https://github.com/EvanBacon))
24
+ - Introduced an AppContext config to provide things like documents and caches directories for the modules. ([#24292](https://github.com/expo/expo/pull/24292) by [@tsapeta](https://github.com/tsapeta))
25
+ - Fixed random `NullPointerExceptions` when calling `Updates.reloadAsync` on Android. ([#24442](https://github.com/expo/expo/pull/24442) by [@lukmccall](https://github.com/lukmccall))
26
+ - Converting shared object id passed as a prop to the associated native object. ([#24431](https://github.com/expo/expo/pull/24431) by [@tsapeta](https://github.com/tsapeta))
27
+ - Added a convenient method to get the app delegate subscriber of the given type. ([#23943](https://github.com/expo/expo/pull/23943) by [@tsapeta](https://github.com/tsapeta))
28
+
13
29
  ## 1.7.0 — 2023-09-04
14
30
 
15
31
  ### 🎉 New features
@@ -19,6 +35,8 @@
19
35
  - [Android] Promises can now be resolved without arguments. ([#23907](https://github.com/expo/expo/pull/23907) by [@lukmccall](https://github.com/lukmccall))
20
36
  - Added support for React Native 0.73. ([#24018](https://github.com/expo/expo/pull/24018), [#24019](https://github.com/expo/expo/pull/24019) by [@kudo](https://github.com/kudo))
21
37
  - [Android] `Property` component can now take the native shared object instance as the first argument. ([#24206](https://github.com/expo/expo/pull/24206) by [@lukmccall](https://github.com/lukmccall))
38
+ - Introduced `requireOptionalNativeModule` that returns `null` when the module cannot be found instead of throwing an error. ([#24262](https://github.com/expo/expo/pull/24262) by [@tsapeta](https://github.com/tsapeta))
39
+ - [Android] Introduced shared refs – a way to pass native objects among different independent modules. ([#24446](https://github.com/expo/expo/pull/24446) by [@lukmccall](https://github.com/lukmccall))
22
40
 
23
41
  ### 🐛 Bug fixes
24
42
 
@@ -27,9 +45,11 @@
27
45
  - Fixed Fabric setup error on iOS. ([#24004](https://github.com/expo/expo/pull/24004) by [@kudo](https://github.com/kudo))
28
46
  - Fixed uuid v4 generation. ([#24123](https://github.com/expo/expo/pull/24123) by [@tsapeta](https://github.com/tsapeta))
29
47
  - [Android] Fixed owner type of view functions. ([#24135](https://github.com/expo/expo/pull/24135) by [@lukmccall](https://github.com/lukmccall))
48
+ - [Android] Fixed IOException `No space left on device` when saving persistent log. ([#24247](https://github.com/expo/expo/pull/24247) by [@RodolfoGS](https://github.com/RodolfoGS))
30
49
 
31
50
  ### 💡 Others
32
51
 
52
+ - Use native UUIDv4 generation on `Android` and `iOS`. ([#24199](https://github.com/expo/expo/pull/24199) by [@behenate](https://github.com/behenate))
33
53
  - [Android] Add type converter for the `ReadableArguments` class to allow backward compatibility with older modules. ([#24137](https://github.com/expo/expo/pull/24137) by [@lukmccall](https://github.com/lukmccall))
34
54
  - [Android] `SharedObjectTypeConverter` now can work with the `Dynamic` class. ([#24207](https://github.com/expo/expo/pull/24207) by [@lukmccall](https://github.com/lukmccall))
35
55
  - [Android] Expose a conversion between id and shared objects. ([#24220](https://github.com/expo/expo/pull/24220) by [@lukmccall](https://github.com/lukmccall))
@@ -27,7 +27,7 @@ Pod::Spec.new do |s|
27
27
  s.license = package['license']
28
28
  s.author = package['author']
29
29
  s.homepage = package['homepage']
30
- s.platform = :ios, '13.0'
30
+ s.platforms = { :ios => '13.0', :tvos => '13.0'}
31
31
  s.swift_version = '5.4'
32
32
  s.source = { git: 'https://github.com/expo/expo.git' }
33
33
  s.static_framework = true
@@ -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 = '1.7.0'
9
+ version = '1.8.0'
10
10
 
11
11
  buildscript {
12
12
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -132,7 +132,7 @@ android {
132
132
  targetSdkVersion safeExtGet("targetSdkVersion", 33)
133
133
  consumerProguardFiles 'proguard-rules.pro'
134
134
  versionCode 1
135
- versionName "1.7.0"
135
+ versionName "1.8.0"
136
136
  buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled.toString()
137
137
 
138
138
  testInstrumentationRunner "expo.modules.TestRunner"
@@ -81,6 +81,20 @@ jsi::Value convert(
81
81
 
82
82
  return jsi::Value(rt, *jsiObject);
83
83
  }
84
+ if (env->IsInstanceOf(
85
+ unpackedValue,
86
+ JavaReferencesCache::instance()->getJClass(
87
+ "expo/modules/kotlin/sharedobjects/SharedObject").clazz
88
+ )) {
89
+ auto jsObject = std::make_shared<jsi::Object>(jsi::Object(rt));
90
+ auto jsObjectRef = JavaScriptObject::newInstance(
91
+ moduleRegistry,
92
+ moduleRegistry->runtimeHolder,
93
+ jsObject
94
+ );
95
+ moduleRegistry->registerSharedObject(jni::make_local(unpackedValue), jsObjectRef);
96
+ return jsi::Value(rt, *jsObject);
97
+ }
84
98
 
85
99
  return jsi::Value::undefined();
86
100
  }
@@ -55,6 +55,8 @@ class PersistentFileLog(
55
55
  completionHandler.invoke(null)
56
56
  } catch (e: Error) {
57
57
  completionHandler.invoke(e)
58
+ } catch (e: IOException) {
59
+ completionHandler.invoke(Error(e))
58
60
  }
59
61
  }
60
62
  }
@@ -2,10 +2,13 @@ package expo.modules.kotlin.defaultmodules
2
2
 
3
3
  import expo.modules.kotlin.modules.Module
4
4
  import expo.modules.kotlin.modules.ModuleDefinition
5
+ import java.util.UUID
5
6
 
6
7
  class CoreModule : Module() {
7
8
  override fun definition() = ModuleDefinition {
8
- // Nothing so far, but eventually we will expose some common classes
9
- // and maybe even the `modules` host object.
9
+ // Expose some common classes and maybe even the `modules` host object in the future.
10
+ Function("uuidv4") {
11
+ return@Function UUID.randomUUID().toString()
12
+ }
10
13
  }
11
14
  }
@@ -5,24 +5,36 @@ import com.facebook.react.bridge.WritableNativeArray
5
5
  import com.facebook.react.bridge.WritableNativeMap
6
6
  import expo.modules.core.interfaces.DoNotStrip
7
7
  import expo.modules.kotlin.exception.UnexpectedException
8
+ import expo.modules.kotlin.logger
8
9
 
9
10
  @Suppress("KotlinJniMissingFunction")
10
11
  @DoNotStrip
11
12
  class JavaCallback @DoNotStrip internal constructor(@DoNotStrip private val mHybridData: HybridData) : Destructible {
12
13
  operator fun invoke(result: Any?) {
13
- if (result == null) {
14
- invoke()
15
- return
16
- }
17
- when (result) {
18
- is Int -> invoke(result)
19
- is Boolean -> invoke(result)
20
- is Double -> invoke(result)
21
- is Float -> invoke(result)
22
- is String -> invoke(result)
23
- is WritableNativeArray -> invoke(result)
24
- is WritableNativeMap -> invoke(result)
25
- else -> throw UnexpectedException("Unknown type: ${result.javaClass}")
14
+ try {
15
+
16
+ if (result == null) {
17
+ invoke()
18
+ return
19
+ }
20
+ when (result) {
21
+ is Int -> invoke(result)
22
+ is Boolean -> invoke(result)
23
+ is Double -> invoke(result)
24
+ is Float -> invoke(result)
25
+ is String -> invoke(result)
26
+ is WritableNativeArray -> invoke(result)
27
+ is WritableNativeMap -> invoke(result)
28
+ else -> throw UnexpectedException("Unknown type: ${result.javaClass}")
29
+ }
30
+ } catch (e: Throwable) {
31
+ if (!mHybridData.isValid) {
32
+ // We know that this particular JavaCallback was invalidated, so it shouldn't be invoked.
33
+ // To prevent crashes, we decided to suppress the error here.
34
+ logger.error("Invalidated JavaCallback was invoked", e)
35
+ return
36
+ }
37
+ throw e
26
38
  }
27
39
  }
28
40
 
@@ -0,0 +1,7 @@
1
+ package expo.modules.kotlin.sharedobjects
2
+
3
+ /**
4
+ * Shared object (ref) that holds a strong reference to any native object. Allows passing references
5
+ * to native instances among different independent libraries.
6
+ */
7
+ open class SharedRef<RefType>(val ref: RefType) : SharedObject()
package/build/index.d.ts CHANGED
@@ -4,19 +4,17 @@ import NativeModulesProxy from './NativeModulesProxy';
4
4
  import { ProxyNativeModule } from './NativeModulesProxy.types';
5
5
  import { requireNativeViewManager } from './NativeViewManagerAdapter';
6
6
  import Platform from './Platform';
7
- import SyntheticPlatformEmitter from './SyntheticPlatformEmitter';
8
7
  import { CodedError } from './errors/CodedError';
9
8
  import { UnavailabilityError } from './errors/UnavailabilityError';
10
9
  import './sweet/setUpErrorManager.fx';
11
- export { default as deprecate } from './deprecate';
12
- export { uuidv4, uuidv5 } from './uuid';
13
- export { DeviceEventEmitter, EventEmitter, NativeModulesProxy, ProxyNativeModule, Platform, Subscription, SyntheticPlatformEmitter, requireNativeViewManager, CodedError, UnavailabilityError, };
10
+ export { default as uuid } from './uuid';
11
+ export { DeviceEventEmitter, EventEmitter, NativeModulesProxy, ProxyNativeModule, Platform, Subscription, requireNativeViewManager, CodedError, UnavailabilityError, };
14
12
  export * from './requireNativeModule';
15
13
  export * from './TypedArrays.types';
16
14
  /**
17
15
  * @deprecated renamed to `DeviceEventEmitter`
18
16
  */
19
- export declare const RCTDeviceEventEmitter: import("react-native").DeviceEventEmitterStatic;
17
+ export declare const SyntheticPlatformEmitter: import("react-native").DeviceEventEmitterStatic;
20
18
  export * from './PermissionsInterface';
21
19
  export * from './PermissionsHook';
22
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,YAAY,EACZ,wBAAwB,EACxB,wBAAwB,EAExB,UAAU,EACV,mBAAmB,GACpB,CAAC;AAEF,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,qBAAqB,iDAAqB,CAAC;AAExD,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,YAAY,EACZ,wBAAwB,EAExB,UAAU,EACV,mBAAmB,GACpB,CAAC;AAEF,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,wBAAwB,iDAAqB,CAAC;AAE3D,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC"}
package/build/index.js CHANGED
@@ -3,13 +3,11 @@ import { EventEmitter } from './EventEmitter';
3
3
  import NativeModulesProxy from './NativeModulesProxy';
4
4
  import { requireNativeViewManager } from './NativeViewManagerAdapter';
5
5
  import Platform from './Platform';
6
- import SyntheticPlatformEmitter from './SyntheticPlatformEmitter';
7
6
  import { CodedError } from './errors/CodedError';
8
7
  import { UnavailabilityError } from './errors/UnavailabilityError';
9
8
  import './sweet/setUpErrorManager.fx';
10
- export { default as deprecate } from './deprecate';
11
- export { uuidv4, uuidv5 } from './uuid';
12
- export { DeviceEventEmitter, EventEmitter, NativeModulesProxy, Platform, SyntheticPlatformEmitter, requireNativeViewManager,
9
+ export { default as uuid } from './uuid';
10
+ export { DeviceEventEmitter, EventEmitter, NativeModulesProxy, Platform, requireNativeViewManager,
13
11
  // Errors
14
12
  CodedError, UnavailabilityError, };
15
13
  export * from './requireNativeModule';
@@ -17,7 +15,7 @@ export * from './TypedArrays.types';
17
15
  /**
18
16
  * @deprecated renamed to `DeviceEventEmitter`
19
17
  */
20
- export const RCTDeviceEventEmitter = DeviceEventEmitter;
18
+ export const SyntheticPlatformEmitter = DeviceEventEmitter;
21
19
  export * from './PermissionsInterface';
22
20
  export * from './PermissionsHook';
23
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAC5D,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAElB,QAAQ,EAER,wBAAwB,EACxB,wBAAwB;AACxB,SAAS;AACT,UAAU,EACV,mBAAmB,GACpB,CAAC;AAEF,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAExD,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC","sourcesContent":["import { DeviceEventEmitter } from 'react-native';\n\nimport { EventEmitter, Subscription } from './EventEmitter';\nimport NativeModulesProxy from './NativeModulesProxy';\nimport { ProxyNativeModule } from './NativeModulesProxy.types';\nimport { requireNativeViewManager } from './NativeViewManagerAdapter';\nimport Platform from './Platform';\nimport SyntheticPlatformEmitter from './SyntheticPlatformEmitter';\nimport { CodedError } from './errors/CodedError';\nimport { UnavailabilityError } from './errors/UnavailabilityError';\n\nimport './sweet/setUpErrorManager.fx';\n\nexport { default as deprecate } from './deprecate';\n\nexport { uuidv4, uuidv5 } from './uuid';\n\nexport {\n DeviceEventEmitter,\n EventEmitter,\n NativeModulesProxy,\n ProxyNativeModule,\n Platform,\n Subscription,\n SyntheticPlatformEmitter,\n requireNativeViewManager,\n // Errors\n CodedError,\n UnavailabilityError,\n};\n\nexport * from './requireNativeModule';\nexport * from './TypedArrays.types';\n\n/**\n * @deprecated renamed to `DeviceEventEmitter`\n */\nexport const RCTDeviceEventEmitter = DeviceEventEmitter;\n\nexport * from './PermissionsInterface';\nexport * from './PermissionsHook';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAC5D,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAElB,QAAQ,EAER,wBAAwB;AACxB,SAAS;AACT,UAAU,EACV,mBAAmB,GACpB,CAAC;AAEF,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAE3D,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC","sourcesContent":["import { DeviceEventEmitter } from 'react-native';\n\nimport { EventEmitter, Subscription } from './EventEmitter';\nimport NativeModulesProxy from './NativeModulesProxy';\nimport { ProxyNativeModule } from './NativeModulesProxy.types';\nimport { requireNativeViewManager } from './NativeViewManagerAdapter';\nimport Platform from './Platform';\nimport { CodedError } from './errors/CodedError';\nimport { UnavailabilityError } from './errors/UnavailabilityError';\n\nimport './sweet/setUpErrorManager.fx';\n\nexport { default as uuid } from './uuid';\n\nexport {\n DeviceEventEmitter,\n EventEmitter,\n NativeModulesProxy,\n ProxyNativeModule,\n Platform,\n Subscription,\n requireNativeViewManager,\n // Errors\n CodedError,\n UnavailabilityError,\n};\n\nexport * from './requireNativeModule';\nexport * from './TypedArrays.types';\n\n/**\n * @deprecated renamed to `DeviceEventEmitter`\n */\nexport const SyntheticPlatformEmitter = DeviceEventEmitter;\n\nexport * from './PermissionsInterface';\nexport * from './PermissionsHook';\n"]}
@@ -2,6 +2,7 @@ type ExpoObject = {
2
2
  modules: undefined | {
3
3
  [key: string]: any;
4
4
  };
5
+ uuidv4: () => string;
5
6
  };
6
7
  declare global {
7
8
  var expo: ExpoObject | undefined;
@@ -22,5 +23,13 @@ declare global {
22
23
  * @throws Error when there is no native module with given name.
23
24
  */
24
25
  export declare function requireNativeModule<ModuleType = any>(moduleName: string): ModuleType;
26
+ /**
27
+ * Imports the native module registered with the given name. The same as `requireNativeModule`,
28
+ * but returns `null` when the module cannot be found instead of throwing an error.
29
+ *
30
+ * @param moduleName Name of the requested native module.
31
+ * @returns Object representing the native module or `null` when it cannot be found.
32
+ */
33
+ export declare function requireOptionalNativeModule<ModuleType = any>(moduleName: string): ModuleType | null;
25
34
  export {};
26
35
  //# sourceMappingURL=requireNativeModule.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"requireNativeModule.d.ts","sourceRoot":"","sources":["../src/requireNativeModule.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG;IAChB,OAAO,EACH,SAAS,GACT;QACE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACP,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;IAEjC;;OAEG;IAEH,IAAI,WAAW,EACX,SAAS,GACT;QACE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACP;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,GAAG,GAAG,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,CAUpF"}
1
+ {"version":3,"file":"requireNativeModule.d.ts","sourceRoot":"","sources":["../src/requireNativeModule.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG;IAChB,OAAO,EACH,SAAS,GACT;QACE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;IACN,MAAM,EAAE,MAAM,MAAM,CAAC;CACtB,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;IAEjC;;OAEG;IAEH,IAAI,WAAW,EACX,SAAS,GACT;QACE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACP;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,GAAG,GAAG,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,CAOpF;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,GAAG,GAAG,EAC1D,UAAU,EAAE,MAAM,GACjB,UAAU,GAAG,IAAI,CAOnB"}
@@ -9,12 +9,23 @@ import NativeModulesProxy from './NativeModulesProxy';
9
9
  * @throws Error when there is no native module with given name.
10
10
  */
11
11
  export function requireNativeModule(moduleName) {
12
- const nativeModule = globalThis.expo?.modules?.[moduleName] ??
13
- globalThis.ExpoModules?.[moduleName] ??
14
- NativeModulesProxy[moduleName];
12
+ const nativeModule = requireOptionalNativeModule(moduleName);
15
13
  if (!nativeModule) {
16
14
  throw new Error(`Cannot find native module '${moduleName}'`);
17
15
  }
18
16
  return nativeModule;
19
17
  }
18
+ /**
19
+ * Imports the native module registered with the given name. The same as `requireNativeModule`,
20
+ * but returns `null` when the module cannot be found instead of throwing an error.
21
+ *
22
+ * @param moduleName Name of the requested native module.
23
+ * @returns Object representing the native module or `null` when it cannot be found.
24
+ */
25
+ export function requireOptionalNativeModule(moduleName) {
26
+ return (globalThis.expo?.modules?.[moduleName] ??
27
+ globalThis.ExpoModules?.[moduleName] ??
28
+ NativeModulesProxy[moduleName] ??
29
+ null);
30
+ }
20
31
  //# sourceMappingURL=requireNativeModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"requireNativeModule.js","sourceRoot":"","sources":["../src/requireNativeModule.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAyBtD;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAmB,UAAkB;IACtE,MAAM,YAAY,GAChB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,UAAU,CAAC;QACtC,UAAU,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC;QACpC,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAEjC,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,8BAA8B,UAAU,GAAG,CAAC,CAAC;KAC9D;IACD,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import NativeModulesProxy from './NativeModulesProxy';\n\ntype ExpoObject = {\n modules:\n | undefined\n | {\n [key: string]: any;\n };\n};\n\ndeclare global {\n // eslint-disable-next-line no-var\n var expo: ExpoObject | undefined;\n\n /**\n * @deprecated `global.ExpoModules` is deprecated, use `global.expo.modules` instead.\n */\n // eslint-disable-next-line no-var\n var ExpoModules:\n | undefined\n | {\n [key: string]: any;\n };\n}\n\n/**\n * Imports the native module registered with given name. In the first place it tries to load\n * the module installed through the JSI host object and then falls back to the bridge proxy module.\n * Notice that the modules loaded from the proxy may not support some features like synchronous functions.\n *\n * @param moduleName Name of the requested native module.\n * @returns Object representing the native module.\n * @throws Error when there is no native module with given name.\n */\nexport function requireNativeModule<ModuleType = any>(moduleName: string): ModuleType {\n const nativeModule: ModuleType =\n globalThis.expo?.modules?.[moduleName] ??\n globalThis.ExpoModules?.[moduleName] ??\n NativeModulesProxy[moduleName];\n\n if (!nativeModule) {\n throw new Error(`Cannot find native module '${moduleName}'`);\n }\n return nativeModule;\n}\n"]}
1
+ {"version":3,"file":"requireNativeModule.js","sourceRoot":"","sources":["../src/requireNativeModule.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AA0BtD;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAmB,UAAkB;IACtE,MAAM,YAAY,GAAG,2BAA2B,CAAa,UAAU,CAAC,CAAC;IAEzE,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,8BAA8B,UAAU,GAAG,CAAC,CAAC;KAC9D;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CACzC,UAAkB;IAElB,OAAO,CACL,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,UAAU,CAAC;QACtC,UAAU,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC;QACpC,kBAAkB,CAAC,UAAU,CAAC;QAC9B,IAAI,CACL,CAAC;AACJ,CAAC","sourcesContent":["import NativeModulesProxy from './NativeModulesProxy';\n\ntype ExpoObject = {\n modules:\n | undefined\n | {\n [key: string]: any;\n };\n uuidv4: () => string;\n};\n\ndeclare global {\n // eslint-disable-next-line no-var\n var expo: ExpoObject | undefined;\n\n /**\n * @deprecated `global.ExpoModules` is deprecated, use `global.expo.modules` instead.\n */\n // eslint-disable-next-line no-var\n var ExpoModules:\n | undefined\n | {\n [key: string]: any;\n };\n}\n\n/**\n * Imports the native module registered with given name. In the first place it tries to load\n * the module installed through the JSI host object and then falls back to the bridge proxy module.\n * Notice that the modules loaded from the proxy may not support some features like synchronous functions.\n *\n * @param moduleName Name of the requested native module.\n * @returns Object representing the native module.\n * @throws Error when there is no native module with given name.\n */\nexport function requireNativeModule<ModuleType = any>(moduleName: string): ModuleType {\n const nativeModule = requireOptionalNativeModule<ModuleType>(moduleName);\n\n if (!nativeModule) {\n throw new Error(`Cannot find native module '${moduleName}'`);\n }\n return nativeModule;\n}\n\n/**\n * Imports the native module registered with the given name. The same as `requireNativeModule`,\n * but returns `null` when the module cannot be found instead of throwing an error.\n *\n * @param moduleName Name of the requested native module.\n * @returns Object representing the native module or `null` when it cannot be found.\n */\nexport function requireOptionalNativeModule<ModuleType = any>(\n moduleName: string\n): ModuleType | null {\n return (\n globalThis.expo?.modules?.[moduleName] ??\n globalThis.ExpoModules?.[moduleName] ??\n NativeModulesProxy[moduleName] ??\n null\n );\n}\n"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=setUpErrorManager.fx.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setUpErrorManager.fx.web.d.ts","sourceRoot":"","sources":["../../src/sweet/setUpErrorManager.fx.web.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=setUpErrorManager.fx.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setUpErrorManager.fx.web.js","sourceRoot":"","sources":["../../src/sweet/setUpErrorManager.fx.web.ts"],"names":[],"mappings":"","sourcesContent":[""]}
@@ -1,3 +1,2 @@
1
- export * from './v4';
2
- export { default as uuidv5 } from './v5';
1
+ export { default } from './uuid';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/uuid/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/uuid/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC"}
@@ -1,3 +1,2 @@
1
- export * from './v4';
2
- export { default as uuidv5 } from './v5';
1
+ export { default } from './uuid';
3
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/uuid/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC","sourcesContent":["export * from './v4';\nexport { default as uuidv5 } from './v5';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/uuid/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC","sourcesContent":["export { default } from './uuid';\n"]}
@@ -0,0 +1,4 @@
1
+ import { UUID } from './uuid.types';
2
+ declare const uuid: UUID;
3
+ export default uuid;
4
+ //# sourceMappingURL=uuid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../src/uuid/uuid.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAcpC,QAAA,MAAM,IAAI,EAAE,IAGX,CAAC;AACF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,15 @@
1
+ import sha1 from './lib/sha1';
2
+ import v35 from './lib/v35';
3
+ const nativeUuidv4 = globalThis?.expo?.uuidv4;
4
+ function uuidv4() {
5
+ if (!nativeUuidv4) {
6
+ throw Error("Native UUID version 4 generator implementation wasn't found in `expo-modules-core`");
7
+ }
8
+ return nativeUuidv4();
9
+ }
10
+ const uuid = {
11
+ v4: uuidv4,
12
+ v5: v35('v5', 0x50, sha1),
13
+ };
14
+ export default uuid;
15
+ //# sourceMappingURL=uuid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../src/uuid/uuid.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,GAAG,MAAM,WAAW,CAAC;AAG5B,MAAM,YAAY,GAAG,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC;AAE9C,SAAS,MAAM;IACb,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,KAAK,CACT,oFAAoF,CACrF,CAAC;KACH;IAED,OAAO,YAAY,EAAE,CAAC;AACxB,CAAC;AAED,MAAM,IAAI,GAAS;IACjB,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;CAC1B,CAAC;AACF,eAAe,IAAI,CAAC","sourcesContent":["import sha1 from './lib/sha1';\nimport v35 from './lib/v35';\nimport { UUID } from './uuid.types';\n\nconst nativeUuidv4 = globalThis?.expo?.uuidv4;\n\nfunction uuidv4(): string {\n if (!nativeUuidv4) {\n throw Error(\n \"Native UUID version 4 generator implementation wasn't found in `expo-modules-core`\"\n );\n }\n\n return nativeUuidv4();\n}\n\nconst uuid: UUID = {\n v4: uuidv4,\n v5: v35('v5', 0x50, sha1),\n};\nexport default uuid;\n"]}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Collection of utilities used for generating Universally Unique Identifiers.
3
+ */
4
+ export type UUID = {
5
+ /**
6
+ * A UUID generated randomly.
7
+ */
8
+ v4: () => string;
9
+ /**
10
+ * A UUID generated based on the `value` and `namespace` parameters, which always produces the same result for the same inputs.
11
+ */
12
+ v5: (value: number[] | string, namespace: number[] | string, buf?: number[], offset?: number) => string;
13
+ };
14
+ //# sourceMappingURL=uuid.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid.types.d.ts","sourceRoot":"","sources":["../../src/uuid/uuid.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG;IACjB;;OAEG;IACH,EAAE,EAAE,MAAM,MAAM,CAAC;IACjB;;OAEG;IACH,EAAE,EAAE,CACF,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EACxB,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,EAC5B,GAAG,CAAC,EAAE,MAAM,EAAE,EACd,MAAM,CAAC,EAAE,MAAM,KACZ,MAAM,CAAC;CACb,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid.types.js","sourceRoot":"","sources":["../../src/uuid/uuid.types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Collection of utilities used for generating Universally Unique Identifiers.\n */\nexport type UUID = {\n /**\n * A UUID generated randomly.\n */\n v4: () => string;\n /**\n * A UUID generated based on the `value` and `namespace` parameters, which always produces the same result for the same inputs.\n */\n v5: (\n value: number[] | string,\n namespace: number[] | string,\n buf?: number[],\n offset?: number\n ) => string;\n};\n"]}
@@ -0,0 +1,4 @@
1
+ import { UUID } from './uuid.types';
2
+ declare const uuid: UUID;
3
+ export default uuid;
4
+ //# sourceMappingURL=uuid.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid.web.d.ts","sourceRoot":"","sources":["../../src/uuid/uuid.web.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAepC,QAAA,MAAM,IAAI,EAAE,IAGX,CAAC;AACF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,18 @@
1
+ import sha1 from './lib/sha1';
2
+ import v35 from './lib/v35';
3
+ function uuidv4() {
4
+ // Crypto needs to be required when run in Node.js environment.
5
+ const cryptoObject = typeof crypto === 'undefined' || typeof crypto.randomUUID === 'undefined'
6
+ ? require('crypto')
7
+ : crypto;
8
+ if (!cryptoObject?.randomUUID) {
9
+ throw Error("The browser doesn't support `crypto.randomUUID` function");
10
+ }
11
+ return cryptoObject.randomUUID();
12
+ }
13
+ const uuid = {
14
+ v4: uuidv4,
15
+ v5: v35('v5', 0x50, sha1),
16
+ };
17
+ export default uuid;
18
+ //# sourceMappingURL=uuid.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid.web.js","sourceRoot":"","sources":["../../src/uuid/uuid.web.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,GAAG,MAAM,WAAW,CAAC;AAG5B,SAAS,MAAM;IACb,+DAA+D;IAC/D,MAAM,YAAY,GAChB,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,WAAW;QACvE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;QACnB,CAAC,CAAC,MAAM,CAAC;IAEb,IAAI,CAAC,YAAY,EAAE,UAAU,EAAE;QAC7B,MAAM,KAAK,CAAC,0DAA0D,CAAC,CAAC;KACzE;IACD,OAAO,YAAY,CAAC,UAAU,EAAE,CAAC;AACnC,CAAC;AAED,MAAM,IAAI,GAAS;IACjB,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;CAC1B,CAAC;AACF,eAAe,IAAI,CAAC","sourcesContent":["import sha1 from './lib/sha1';\nimport v35 from './lib/v35';\nimport { UUID } from './uuid.types';\n\nfunction uuidv4(): string {\n // Crypto needs to be required when run in Node.js environment.\n const cryptoObject =\n typeof crypto === 'undefined' || typeof crypto.randomUUID === 'undefined'\n ? require('crypto')\n : crypto;\n\n if (!cryptoObject?.randomUUID) {\n throw Error(\"The browser doesn't support `crypto.randomUUID` function\");\n }\n return cryptoObject.randomUUID();\n}\n\nconst uuid: UUID = {\n v4: uuidv4,\n v5: v35('v5', 0x50, sha1),\n};\nexport default uuid;\n"]}
@@ -33,7 +33,7 @@ open class ExpoAppDelegate: UIResponder, UIApplicationDelegate {
33
33
  }
34
34
 
35
35
  return parsedSubscribers.reduce(false) { result, subscriber in
36
- return subscriber.application!(application, willFinishLaunchingWithOptions: launchOptions) || result
36
+ return subscriber.application?(application, willFinishLaunchingWithOptions: launchOptions) ?? false || result
37
37
  }
38
38
  }
39
39
 
@@ -202,6 +202,7 @@ open class ExpoAppDelegate: UIResponder, UIApplicationDelegate {
202
202
  }
203
203
  }
204
204
 
205
+ #if !os(tvOS)
205
206
  open func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
206
207
  let selector = #selector(application(_:performActionFor:completionHandler:))
207
208
  let subs = subscribers.filter { $0.responds(to: selector) }
@@ -228,6 +229,7 @@ open class ExpoAppDelegate: UIResponder, UIApplicationDelegate {
228
229
  }
229
230
  }
230
231
  }
232
+ #endif
231
233
 
232
234
  // MARK: - Background Fetch
233
235
 
@@ -251,12 +253,12 @@ open class ExpoAppDelegate: UIResponder, UIApplicationDelegate {
251
253
 
252
254
  if subscribersLeft == 0 {
253
255
  if newDataCount > 0 {
254
- completionHandler(.newData)
255
- } else if failedCount > 0 {
256
- completionHandler(.failed)
257
- } else {
258
- completionHandler(.noData)
259
- }
256
+ completionHandler(.newData)
257
+ } else if failedCount > 0 {
258
+ completionHandler(.failed)
259
+ } else {
260
+ completionHandler(.noData)
261
+ }
260
262
  }
261
263
  }
262
264
  }
@@ -294,6 +296,7 @@ open class ExpoAppDelegate: UIResponder, UIApplicationDelegate {
294
296
  * Sets allowed orientations for the application. It will use the values from `Info.plist`as the orientation mask unless a subscriber requested
295
297
  * a different orientation.
296
298
  */
299
+ #if !os(tvOS)
297
300
  public func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
298
301
  let deviceOrientationMask = allowedOrientations(for: UIDevice.current.userInterfaceIdiom)
299
302
  let universalOrientationMask = allowedOrientations(for: .unspecified)
@@ -312,6 +315,7 @@ open class ExpoAppDelegate: UIResponder, UIApplicationDelegate {
312
315
  }
313
316
  return parsedSubscribers.isEmpty ? infoPlistOrientations : subscribersMask
314
317
  }
318
+ #endif
315
319
 
316
320
  // MARK: - Statics
317
321
 
@@ -335,6 +339,10 @@ open class ExpoAppDelegate: UIResponder, UIApplicationDelegate {
335
339
  return subscribers.first { String(describing: $0) == name }
336
340
  }
337
341
 
342
+ public static func getSubscriberOfType<Subscriber>(_ type: Subscriber.Type) -> Subscriber? {
343
+ return subscribers.first { $0 is Subscriber } as? Subscriber
344
+ }
345
+
338
346
  @objc
339
347
  public static func registerReactDelegateHandlersFrom(modulesProvider: ModulesProvider) {
340
348
  modulesProvider.getReactDelegateHandlers()
@@ -346,7 +354,7 @@ open class ExpoAppDelegate: UIResponder, UIApplicationDelegate {
346
354
  }
347
355
  }
348
356
  }
349
-
357
+ #if !os(tvOS)
350
358
  private func allowedOrientations(for userInterfaceIdiom: UIUserInterfaceIdiom) -> UIInterfaceOrientationMask {
351
359
  // For now only iPad-specific orientations are supported
352
360
  let deviceString = userInterfaceIdiom == .pad ? "~pad" : ""
@@ -371,3 +379,4 @@ private func allowedOrientations(for userInterfaceIdiom: UIUserInterfaceIdiom) -
371
379
  }
372
380
  return mask
373
381
  }
382
+ #endif
@@ -6,6 +6,7 @@
6
6
 
7
7
  @protocol EXBarCodeScannerInterface
8
8
 
9
+ #if !TARGET_OS_TV
9
10
  - (void)setSession:(AVCaptureSession *)session;
10
11
  - (void)setSessionQueue:(dispatch_queue_t)sessionQueue;
11
12
  - (void)setOnBarCodeScanned:(void (^)(NSDictionary *))onBarCodeScanned;
@@ -17,5 +18,6 @@
17
18
 
18
19
  - (void)maybeStartBarCodeScanning;
19
20
  - (void)stopBarCodeScanning;
21
+ #endif
20
22
 
21
23
  @end
@@ -4,7 +4,9 @@
4
4
 
5
5
  @protocol EXCameraInterface
6
6
 
7
+ #if !TARGET_OS_TV
7
8
  @property (nonatomic, strong) dispatch_queue_t sessionQueue;
8
9
  @property (nonatomic, strong) AVCaptureSession *session;
10
+ #endif
9
11
 
10
12
  @end
@@ -5,7 +5,7 @@
5
5
  #import <UIKit/UIKit.h>
6
6
 
7
7
  @protocol EXFaceDetectorManagerInterface
8
-
8
+ #if !TARGET_OS_TV
9
9
  - (void)setSessionQueue:(dispatch_queue_t)sessionQueue;
10
10
  - (void)setIsEnabled:(BOOL)enabled;
11
11
  - (void)setOnFacesDetected:(void (^)(NSArray<NSDictionary *> *))onFacesDetected;
@@ -16,5 +16,5 @@
16
16
  - (void)maybeStartFaceDetectionOnSession:(AVCaptureSession *)session withPreviewLayer:(AVCaptureVideoPreviewLayer *)previewLayer;
17
17
  - (void)maybeStartFaceDetectionOnSession:(AVCaptureSession *)session withPreviewLayer:(AVCaptureVideoPreviewLayer *)previewLayer mirrored:(BOOL) mirrored;
18
18
  - (void)stopFaceDetection;
19
-
19
+ #endif
20
20
  @end
@@ -12,6 +12,11 @@ public final class AppContext: NSObject {
12
12
  return appContext
13
13
  }
14
14
 
15
+ /**
16
+ The app context configuration.
17
+ */
18
+ public let config: AppContextConfig
19
+
15
20
  /**
16
21
  The module registry for the app context.
17
22
  */
@@ -78,12 +83,14 @@ public final class AppContext: NSObject {
78
83
  /**
79
84
  Designated initializer without modules provider.
80
85
  */
81
- public override init() {
86
+ public init(config: AppContextConfig = .default) {
87
+ self.config = config
88
+
82
89
  super.init()
83
90
  listenToClientAppNotifications()
84
91
  }
85
92
 
86
- public convenience init(legacyModulesProxy: Any, legacyModuleRegistry: Any) {
93
+ public convenience init(legacyModulesProxy: Any, legacyModuleRegistry: Any, config: AppContextConfig = .default) {
87
94
  self.init()
88
95
  self.legacyModulesProxy = legacyModulesProxy as? LegacyNativeModulesProxy
89
96
  self.legacyModuleRegistry = legacyModuleRegistry as? EXModuleRegistry
@@ -0,0 +1,13 @@
1
+ // Copyright 2023-present 650 Industries. All rights reserved.
2
+
3
+ public struct AppContextConfig {
4
+ public static var `default` = AppContextConfig()
5
+
6
+ public let documentDirectory: URL?
7
+ public let cacheDirectory: URL?
8
+
9
+ public init(documentDirectory: URL? = nil, cacheDirectory: URL? = nil) {
10
+ self.documentDirectory = documentDirectory ?? FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first
11
+ self.cacheDirectory = cacheDirectory ?? FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first
12
+ }
13
+ }