expo-modules-core 1.11.13 → 1.12.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 +77 -13
- package/ExpoModulesCore.podspec +7 -4
- package/android/ExpoModulesCorePlugin.gradle +40 -28
- package/android/build.gradle +12 -93
- package/android/proguard-rules.pro +0 -8
- package/android/src/main/cpp/Exceptions.cpp +1 -1
- package/android/src/main/cpp/Exceptions.h +1 -1
- package/android/src/main/cpp/ExpoModulesHostObject.cpp +7 -6
- package/android/src/main/cpp/ExpoModulesHostObject.h +3 -3
- package/android/src/main/cpp/JNIInjector.cpp +4 -2
- package/android/src/main/cpp/JSIContext.cpp +354 -0
- package/android/src/main/cpp/{JSIInteropModuleRegistry.h → JSIContext.h} +90 -9
- package/android/src/main/cpp/JavaCallback.cpp +210 -24
- package/android/src/main/cpp/JavaCallback.h +42 -7
- package/android/src/main/cpp/JavaScriptFunction.cpp +20 -6
- package/android/src/main/cpp/JavaScriptFunction.h +4 -1
- package/android/src/main/cpp/JavaScriptModuleObject.cpp +118 -82
- package/android/src/main/cpp/JavaScriptModuleObject.h +21 -18
- package/android/src/main/cpp/JavaScriptObject.cpp +7 -8
- package/android/src/main/cpp/JavaScriptObject.h +4 -2
- package/android/src/main/cpp/JavaScriptRuntime.cpp +18 -41
- package/android/src/main/cpp/JavaScriptRuntime.h +2 -8
- package/android/src/main/cpp/JavaScriptTypedArray.cpp +3 -3
- package/android/src/main/cpp/JavaScriptTypedArray.h +1 -1
- package/android/src/main/cpp/JavaScriptValue.cpp +7 -7
- package/android/src/main/cpp/JavaScriptValue.h +1 -1
- package/android/src/main/cpp/JavaScriptWeakObject.cpp +4 -4
- package/android/src/main/cpp/JavaScriptWeakObject.h +1 -1
- package/android/src/main/cpp/MethodMetadata.cpp +44 -120
- package/android/src/main/cpp/MethodMetadata.h +5 -11
- package/android/src/main/cpp/WeakRuntimeHolder.cpp +3 -3
- package/android/src/main/cpp/WeakRuntimeHolder.h +2 -2
- package/android/src/main/cpp/types/AnyType.cpp +1 -1
- package/android/src/main/cpp/types/AnyType.h +1 -1
- package/android/src/main/cpp/types/FrontendConverter.cpp +32 -43
- package/android/src/main/cpp/types/FrontendConverter.h +1 -23
- package/android/src/main/cpp/types/JNIToJSIConverter.cpp +5 -10
- package/android/src/main/cpp/types/JNIToJSIConverter.h +6 -2
- package/android/src/main/java/expo/modules/adapters/react/ModuleRegistryAdapter.java +3 -0
- package/android/src/main/java/expo/modules/adapters/react/NativeModulesProxy.java +14 -100
- package/android/src/main/java/expo/modules/adapters/react/ReactAdapterPackage.java +3 -5
- package/android/src/main/java/expo/modules/adapters/react/ReactModuleRegistryProvider.java +6 -22
- package/android/src/main/java/expo/modules/adapters/react/apploader/RNHeadlessAppLoader.kt +8 -4
- package/android/src/main/java/expo/modules/adapters/react/services/EventEmitterModule.java +0 -1
- package/android/src/main/java/expo/modules/adapters/react/services/UIManagerModuleWrapper.java +23 -8
- package/android/src/main/java/expo/modules/core/BasePackage.java +0 -10
- package/android/src/main/java/expo/modules/core/ModulePriorities.kt +1 -0
- package/android/src/main/java/expo/modules/core/ModuleRegistry.java +2 -32
- package/android/src/main/java/expo/modules/core/ModuleRegistryProvider.java +0 -18
- package/android/src/main/java/expo/modules/core/Promise.java +2 -0
- package/android/src/main/java/expo/modules/core/interfaces/Package.java +0 -17
- package/android/src/main/java/expo/modules/core/interfaces/ReactActivityHandler.java +0 -9
- package/android/src/main/java/expo/modules/core/interfaces/ReactNativeHostHandler.java +24 -31
- package/android/src/main/java/expo/modules/core/logging/LogHandler.kt +1 -7
- package/android/src/main/java/expo/modules/core/logging/LogHandlers.kt +11 -0
- package/android/src/main/java/expo/modules/core/logging/Logger.kt +18 -29
- package/android/src/main/java/expo/modules/core/logging/LoggerTimer.kt +11 -0
- package/android/src/main/java/expo/modules/core/logging/OSLogHandler.kt +2 -4
- package/android/src/main/java/expo/modules/core/logging/PersistentFileLogHandler.kt +1 -3
- package/android/src/main/java/expo/modules/interfaces/constants/ConstantsInterface.java +0 -2
- package/android/src/main/java/expo/modules/interfaces/permissions/PermissionsStatus.java +1 -1
- package/android/src/main/java/expo/modules/kotlin/AppContext.kt +44 -24
- package/android/src/main/java/expo/modules/kotlin/ArrayExtenstions.kt +15 -0
- package/android/src/main/java/expo/modules/kotlin/CoreLogger.kt +2 -2
- package/android/src/main/java/expo/modules/kotlin/DynamicExtenstions.kt +0 -3
- package/android/src/main/java/expo/modules/kotlin/ExpoBridgeModule.kt +41 -0
- package/android/src/main/java/expo/modules/kotlin/ExpoModulesHelper.kt +1 -2
- package/android/src/main/java/expo/modules/kotlin/KPromiseWrapper.kt +1 -2
- package/android/src/main/java/expo/modules/kotlin/KotlinInteropModuleRegistry.kt +1 -33
- package/android/src/main/java/expo/modules/kotlin/ModuleHolder.kt +7 -6
- package/android/src/main/java/expo/modules/kotlin/ModuleRegistry.kt +12 -12
- package/android/src/main/java/expo/modules/kotlin/Promise.kt +10 -0
- package/android/src/main/java/expo/modules/kotlin/ReactExtensions.kt +14 -0
- package/android/src/main/java/expo/modules/kotlin/Utils.kt +4 -1
- package/android/src/main/java/expo/modules/kotlin/activityaware/AppCompatActivityAwareHelper.kt +1 -1
- package/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultCaller.kt +1 -1
- package/android/src/main/java/expo/modules/kotlin/activityresult/AppContextActivityResultRegistry.kt +6 -6
- package/android/src/main/java/expo/modules/kotlin/classcomponent/ClassComponentBuilder.kt +44 -15
- package/android/src/main/java/expo/modules/kotlin/defaultmodules/CoreModule.kt +31 -1
- package/android/src/main/java/expo/modules/kotlin/defaultmodules/ErrorManagerModule.kt +2 -4
- package/android/src/main/java/expo/modules/kotlin/events/KModuleEventEmitterWrapper.kt +11 -4
- package/android/src/main/java/expo/modules/kotlin/exception/CodedException.kt +2 -3
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionBuilder.kt +136 -43
- package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionComponent.kt +71 -2
- package/android/src/main/java/expo/modules/kotlin/functions/FunctionBuilder.kt +39 -12
- package/android/src/main/java/expo/modules/kotlin/jni/ExpectedType.kt +2 -2
- package/android/src/main/java/expo/modules/kotlin/jni/JNIDeallocator.kt +1 -1
- package/android/src/main/java/expo/modules/kotlin/jni/{JSIInteropModuleRegistry.kt → JSIContext.kt} +90 -14
- package/android/src/main/java/expo/modules/kotlin/jni/JavaCallback.kt +51 -24
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptFunction.kt +3 -3
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptModuleObject.kt +4 -1
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptObject.kt +1 -0
- package/android/src/main/java/expo/modules/kotlin/jni/JavaScriptValue.kt +1 -0
- package/android/src/main/java/expo/modules/kotlin/jni/PromiseImpl.kt +20 -0
- package/android/src/main/java/expo/modules/kotlin/modules/Module.kt +0 -1
- package/android/src/main/java/expo/modules/kotlin/modules/ModuleDefinitionBuilder.kt +1 -1
- package/android/src/main/java/expo/modules/kotlin/objects/ObjectDefinitionBuilder.kt +164 -65
- package/android/src/main/java/expo/modules/kotlin/objects/PropertyComponentBuilder.kt +3 -4
- package/android/src/main/java/expo/modules/kotlin/sharedobjects/ClassRegistry.kt +21 -0
- package/android/src/main/java/expo/modules/kotlin/sharedobjects/SharedObject.kt +34 -1
- package/android/src/main/java/expo/modules/kotlin/sharedobjects/SharedObjectRegistry.kt +23 -8
- package/android/src/main/java/expo/modules/kotlin/sharedobjects/SharedRef.kt +7 -1
- package/android/src/main/java/expo/modules/kotlin/tracing/ExpoTrace.kt +4 -0
- package/android/src/main/java/expo/modules/kotlin/types/AnyType.kt +134 -2
- package/android/src/main/java/expo/modules/kotlin/types/EnforceType.kt +60 -0
- package/android/src/main/java/expo/modules/kotlin/types/EnumTypeConverter.kt +2 -2
- package/android/src/main/java/expo/modules/kotlin/types/TypeConverter.kt +0 -2
- package/android/src/main/java/expo/modules/kotlin/types/TypeConverterProvider.kt +3 -27
- package/android/src/main/java/expo/modules/kotlin/types/UnitTypeConverter.kt +3 -7
- package/android/src/main/java/expo/modules/kotlin/types/io/PathTypeConverter.kt +3 -0
- package/android/src/main/java/expo/modules/kotlin/viewevent/ViewEvent.kt +2 -5
- package/android/src/main/java/expo/modules/kotlin/views/ViewDefinitionBuilder.kt +137 -48
- package/android/src/main/java/expo/modules/kotlin/views/ViewManagerDefinition.kt +2 -5
- package/build/EventEmitter.d.ts +2 -2
- package/build/EventEmitter.d.ts.map +1 -1
- package/build/EventEmitter.js +8 -8
- package/build/EventEmitter.js.map +1 -1
- package/build/NativeModule.d.ts +4 -0
- package/build/NativeModule.d.ts.map +1 -0
- package/build/NativeModule.js +4 -0
- package/build/NativeModule.js.map +1 -0
- package/build/NativeModulesProxy.native.d.ts.map +1 -1
- package/build/NativeModulesProxy.native.js +4 -0
- package/build/NativeModulesProxy.native.js.map +1 -1
- package/build/NativeModulesProxy.types.d.ts +2 -2
- package/build/NativeModulesProxy.types.d.ts.map +1 -1
- package/build/NativeModulesProxy.types.js.map +1 -1
- package/build/NativeViewManagerAdapter.native.d.ts.map +1 -1
- package/build/NativeViewManagerAdapter.native.js +20 -1
- package/build/NativeViewManagerAdapter.native.js.map +1 -1
- package/build/PermissionsHook.d.ts.map +1 -1
- package/build/PermissionsHook.js +2 -0
- package/build/PermissionsHook.js.map +1 -1
- package/build/Refs.d.ts +8 -0
- package/build/Refs.d.ts.map +1 -0
- package/build/Refs.js +10 -0
- package/build/Refs.js.map +1 -0
- package/build/SharedObject.d.ts +4 -0
- package/build/SharedObject.d.ts.map +1 -0
- package/build/SharedObject.js +4 -0
- package/build/SharedObject.js.map +1 -0
- package/build/createWebModule.d.ts +2 -0
- package/build/createWebModule.d.ts.map +1 -0
- package/build/createWebModule.js +6 -0
- package/build/createWebModule.js.map +1 -0
- package/build/createWebModule.web.d.ts +2 -0
- package/build/createWebModule.web.d.ts.map +1 -0
- package/build/createWebModule.web.js +6 -0
- package/build/createWebModule.web.js.map +1 -0
- package/build/ensureNativeModulesAreInstalled.d.ts +6 -0
- package/build/ensureNativeModulesAreInstalled.d.ts.map +1 -0
- package/build/ensureNativeModulesAreInstalled.js +26 -0
- package/build/ensureNativeModulesAreInstalled.js.map +1 -0
- package/build/hooks/useReleasingSharedObject.d.ts +7 -0
- package/build/hooks/useReleasingSharedObject.d.ts.map +1 -0
- package/build/hooks/useReleasingSharedObject.js +40 -0
- package/build/hooks/useReleasingSharedObject.js.map +1 -0
- package/build/index.d.ts +8 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +8 -0
- package/build/index.js.map +1 -1
- package/build/requireNativeModule.d.ts +0 -17
- package/build/requireNativeModule.d.ts.map +1 -1
- package/build/requireNativeModule.js +2 -23
- package/build/requireNativeModule.js.map +1 -1
- package/build/ts-declarations/EventEmitter.d.ts +50 -0
- package/build/ts-declarations/EventEmitter.d.ts.map +1 -0
- package/build/ts-declarations/EventEmitter.js +2 -0
- package/build/ts-declarations/EventEmitter.js.map +1 -0
- package/build/ts-declarations/NativeModule.d.ts +14 -0
- package/build/ts-declarations/NativeModule.d.ts.map +1 -0
- package/build/ts-declarations/NativeModule.js +2 -0
- package/build/ts-declarations/NativeModule.js.map +1 -0
- package/build/ts-declarations/SharedObject.d.ts +14 -0
- package/build/ts-declarations/SharedObject.d.ts.map +1 -0
- package/build/ts-declarations/SharedObject.js +2 -0
- package/build/ts-declarations/SharedObject.js.map +1 -0
- package/build/ts-declarations/global.d.ts +49 -0
- package/build/ts-declarations/global.d.ts.map +1 -0
- package/build/ts-declarations/global.js +2 -0
- package/build/ts-declarations/global.js.map +1 -0
- package/build/web/CoreModule.d.ts +17 -0
- package/build/web/CoreModule.d.ts.map +1 -0
- package/build/web/CoreModule.js +51 -0
- package/build/web/CoreModule.js.map +1 -0
- package/build/web/index.d.ts +1 -0
- package/build/web/index.d.ts.map +1 -0
- package/build/web/index.js +1 -0
- package/build/web/index.js.map +1 -0
- package/build/web/index.web.d.ts +2 -0
- package/build/web/index.web.d.ts.map +1 -0
- package/build/web/index.web.js +2 -0
- package/build/web/index.web.js.map +1 -0
- package/common/cpp/BridgelessJSCallInvoker.h +41 -0
- package/common/cpp/EventEmitter.cpp +299 -0
- package/common/cpp/EventEmitter.h +111 -0
- package/common/cpp/JSIUtils.cpp +116 -11
- package/common/cpp/JSIUtils.h +54 -7
- package/common/cpp/LazyObject.cpp +15 -3
- package/common/cpp/LazyObject.h +13 -0
- package/common/cpp/NativeModule.cpp +16 -0
- package/common/cpp/NativeModule.h +34 -0
- package/common/cpp/ObjectDeallocator.cpp +3 -5
- package/common/cpp/ObjectDeallocator.h +2 -3
- package/common/cpp/SharedObject.cpp +69 -0
- package/common/cpp/SharedObject.h +59 -0
- package/common/cpp/TestingSyncJSCallInvoker.h +44 -0
- package/ios/Api/Builders/ClassComponentBuilder.swift +34 -0
- package/ios/{Objects → Api/Builders}/ObjectDefinitionBuilder.swift +3 -3
- package/ios/Api/Builders/ViewDefinitionBuilder.swift +53 -0
- package/ios/Api/Factories/AsyncFunctionFactories.swift +173 -0
- package/ios/{Classes/ClassComponentFactories.swift → Api/Factories/ClassFactories.swift} +19 -19
- package/ios/{Functions/ConcurrentFunctionDefinition.swift → Api/Factories/ConcurrentFunctionFactories.swift} +0 -113
- package/ios/{Modules/ModuleDefinitionComponents.swift → Api/Factories/EventListenersFactories.swift} +0 -20
- package/ios/Api/Factories/ModuleFactories.swift +6 -0
- package/ios/{Objects/ObjectDefinitionComponents.swift → Api/Factories/ObjectFactories.swift} +5 -5
- package/ios/Api/Factories/PropertyFactories.swift +50 -0
- package/ios/Api/Factories/SyncFunctionFactories.swift +173 -0
- package/ios/{Views/ViewManagerDefinitionComponents.swift → Api/Factories/ViewFactories.swift} +7 -6
- package/ios/AppDelegates/EXAppDelegateWrapper.h +0 -21
- package/ios/AppDelegates/EXAppDelegateWrapper.mm +37 -29
- package/ios/{AppContext.swift → Core/AppContext.swift} +34 -11
- package/ios/Core/Classes/AnyClassDefinitionElement.swift +37 -0
- package/ios/{Classes/ClassComponent.swift → Core/Classes/ClassDefinition.swift} +10 -10
- package/ios/{Conversions.swift → Core/Conversions.swift} +1 -1
- package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicSharedObjectType.swift +3 -3
- package/ios/Core/Events/EventObservingDefinition.swift +79 -0
- package/ios/Core/Events/LegacyEventEmitterCompat.swift +32 -0
- package/ios/Core/ExpoBridgeModule.h +18 -0
- package/ios/Core/ExpoBridgeModule.mm +88 -0
- package/ios/Core/ExpoRuntime.swift +6 -0
- package/ios/{Functions/AnyFunction.swift → Core/Functions/AnyFunctionDefinition.swift} +9 -2
- package/ios/Core/Functions/AsyncFunctionDefinition.swift +150 -0
- package/ios/Core/Functions/ConcurrentFunctionDefinition.swift +112 -0
- package/ios/Core/Functions/SyncFunctionDefinition.swift +108 -0
- package/ios/{JavaScriptUtils.swift → Core/JavaScriptUtils.swift} +4 -4
- package/ios/{Logging → Core/Logging}/LogHandlers.swift +12 -5
- package/ios/{Logging → Core/Logging}/Logger.swift +14 -92
- package/ios/Core/Logging/LoggerTimer.swift +22 -0
- package/ios/{ModuleHolder.swift → Core/ModuleHolder.swift} +2 -10
- package/ios/Core/Modules/CoreModule.swift +43 -0
- package/ios/{Modules → Core/Modules}/ModuleDefinition.swift +20 -12
- package/ios/{Modules → Core/Modules}/ModuleDefinitionBuilder.swift +1 -3
- package/ios/{Objects → Core/Objects}/ObjectDefinition.swift +9 -9
- package/ios/{Objects/PropertyComponent.swift → Core/Objects/PropertyDefinition.swift} +11 -64
- package/ios/Core/Protocols/AnyDefinition.swift +4 -0
- package/ios/Core/Protocols/AnyExpoView.swift +7 -0
- package/ios/Core/Protocols/AnyModule.swift +17 -0
- package/ios/Core/Protocols/AnyViewDefinition.swift +34 -0
- package/ios/Core/SharedObjects/SharedObject.swift +80 -0
- package/ios/{SharedObjects → Core/SharedObjects}/SharedObjectRegistry.swift +45 -19
- package/ios/{Views → Core/Views}/AnyViewProp.swift +1 -1
- package/ios/{Views → Core/Views}/ComponentData.swift +7 -7
- package/ios/{Views → Core/Views}/ExpoView.swift +1 -1
- package/ios/Core/Views/ViewDefinition.swift +97 -0
- package/ios/{Views → Core/Views}/ViewLifecycleMethod.swift +1 -1
- package/ios/{Views → Core/Views}/ViewModuleWrapper.swift +1 -1
- package/ios/Fabric/ExpoFabricView.swift +5 -6
- package/ios/FileSystemUtilities/FileSystemLegacyUtilities.swift +111 -0
- package/ios/JSI/EXJSIInstaller.h +28 -0
- package/ios/JSI/EXJSIInstaller.mm +54 -10
- package/ios/JSI/EXJSIUtils.h +15 -11
- package/ios/JSI/EXJSIUtils.mm +21 -49
- package/ios/JSI/EXJavaScriptObject.mm +2 -2
- package/ios/JSI/EXJavaScriptRuntime.h +15 -0
- package/ios/JSI/EXJavaScriptRuntime.mm +53 -26
- package/ios/JSI/EXSharedObjectUtils.h +15 -0
- package/ios/JSI/EXSharedObjectUtils.mm +18 -0
- package/ios/JSI/JavaScriptRuntime.swift +16 -0
- package/ios/Legacy/ModuleRegistry/EXModuleRegistry.m +1 -0
- package/ios/Legacy/ModuleRegistryProvider/EXModuleRegistryProvider.m +5 -0
- package/ios/Legacy/NativeModulesProxy/EXNativeModulesProxy.mm +5 -4
- package/ios/Legacy/Services/EXReactNativeAdapter.mm +34 -28
- package/ios/ReactDelegates/EXReactDelegateWrapper.h +4 -12
- package/ios/ReactDelegates/EXReactDelegateWrapper.mm +41 -0
- package/ios/ReactDelegates/EXReactRootViewFactory.h +38 -0
- package/ios/ReactDelegates/EXReactRootViewFactory.mm +54 -0
- package/ios/ReactDelegates/ExpoReactDelegate.swift +22 -15
- package/ios/ReactDelegates/ExpoReactDelegateHandler.swift +10 -21
- package/ios/ReactDelegates/RCTAppDelegate+Recreate.h +28 -0
- package/ios/ReactDelegates/RCTAppDelegate+Recreate.mm +47 -0
- package/ios/Tests/{ClassComponentSpec.swift → ClassDefinitionSpec.swift} +6 -6
- package/ios/Tests/ConvertiblesSpec.swift +6 -1
- package/ios/Tests/CoreModuleSpec.swift +0 -4
- package/ios/Tests/DynamicTypeSpec.swift +1 -1
- package/ios/Tests/EventEmitterSpec.swift +274 -0
- package/ios/Tests/ExceptionsSpec.swift +114 -54
- package/ios/Tests/ExpoModulesSpec.swift +4 -3
- package/ios/Tests/LoggerSpec.swift +80 -0
- package/ios/Tests/{PropertyComponentSpec.swift → PropertyDefinitionSpec.swift} +1 -1
- package/ios/Tests/SharedObjectRegistrySpec.swift +34 -28
- package/ios/Tests/SharedObjectSpec.swift +141 -0
- package/ios/Tests/ViewDefinitionSpec.swift +1 -1
- package/package.json +2 -2
- package/src/EventEmitter.ts +15 -18
- package/src/NativeModule.ts +6 -0
- package/src/NativeModulesProxy.native.ts +5 -0
- package/src/NativeModulesProxy.types.ts +2 -2
- package/src/NativeViewManagerAdapter.native.tsx +25 -1
- package/src/PermissionsHook.ts +4 -0
- package/src/Refs.ts +10 -0
- package/src/SharedObject.ts +6 -0
- package/src/createWebModule.ts +5 -0
- package/src/createWebModule.web.ts +6 -0
- package/src/ensureNativeModulesAreInstalled.ts +24 -0
- package/src/hooks/useReleasingSharedObject.ts +51 -0
- package/src/index.ts +13 -0
- package/src/requireNativeModule.ts +2 -51
- package/src/ts-declarations/EventEmitter.ts +65 -0
- package/src/ts-declarations/ExpoModules.d.ts +0 -5
- package/src/ts-declarations/NativeModule.ts +18 -0
- package/src/ts-declarations/SharedObject.ts +16 -0
- package/src/ts-declarations/global.ts +60 -0
- package/src/web/CoreModule.ts +83 -0
- package/src/web/index.ts +0 -0
- package/src/web/index.web.ts +1 -0
- package/android/src/main/cpp/JSIInteropModuleRegistry.cpp +0 -196
- package/android/src/main/java/expo/modules/adapters/react/ArgumentsHelper.java +0 -48
- package/android/src/main/java/expo/modules/adapters/react/PromiseWrapper.java +0 -38
- package/android/src/main/java/expo/modules/adapters/react/services/CookieManagerModule.java +0 -53
- package/android/src/main/java/expo/modules/core/ArgumentsHelper.java +0 -44
- package/android/src/main/java/expo/modules/core/ExportedModule.java +0 -173
- package/android/src/main/java/expo/modules/core/ModuleRegistryDelegate.kt +0 -12
- package/android/src/main/java/expo/modules/core/ViewManager.java +0 -9
- package/android/src/main/java/expo/modules/core/interfaces/ExpoMethod.java +0 -12
- package/android/src/main/java/expo/modules/core/interfaces/ExpoProp.java +0 -10
- package/android/src/main/java/expo/modules/core/logging/LoggerOptions.kt +0 -29
- package/android-annotation/build.gradle +0 -48
- package/android-annotation/src/main/java/expo/modules/annotation/Config.kt +0 -7
- package/android-annotation/src/main/java/expo/modules/annotation/ConverterBinder.kt +0 -7
- package/android-annotation-processor/build.gradle +0 -54
- package/android-annotation-processor/src/main/java/expo/modules/annotationprocessor/ExpoSymbolProcessor.kt +0 -175
- package/android-annotation-processor/src/main/java/expo/modules/annotationprocessor/ExpoSymbolProcessorProvider.kt +0 -10
- package/android-annotation-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider +0 -1
- package/ios/Classes/ClassComponentElement.swift +0 -37
- package/ios/Classes/ClassComponentElementsBuilder.swift +0 -34
- package/ios/ExpoBridgeModule.m +0 -7
- package/ios/ExpoBridgeModule.swift +0 -108
- package/ios/ExpoRuntime.swift +0 -28
- package/ios/Functions/AsyncFunctionComponent.swift +0 -327
- package/ios/Functions/SyncFunctionComponent.swift +0 -282
- package/ios/Interfaces/Font/EXFontManagerInterface.h +0 -9
- package/ios/Interfaces/Font/EXFontProcessorInterface.h +0 -15
- package/ios/Interfaces/Font/EXFontScalerInterface.h +0 -9
- package/ios/Interfaces/Font/EXFontScalersManagerInterface.h +0 -9
- package/ios/Legacy/Services/EXReactFontManager.h +0 -6
- package/ios/Legacy/Services/EXReactFontManager.m +0 -130
- package/ios/Modules/AnyModule.swift +0 -53
- package/ios/Modules/CoreModule.swift +0 -17
- package/ios/ReactDelegates/EXRCTBridgeDelegateInterceptor.h +0 -16
- package/ios/ReactDelegates/EXRCTBridgeDelegateInterceptor.m +0 -49
- package/ios/ReactDelegates/EXReactCompatibleHelpers.h +0 -15
- package/ios/ReactDelegates/EXReactCompatibleHelpers.m +0 -25
- package/ios/ReactDelegates/EXReactDelegateWrapper.m +0 -53
- package/ios/SharedObjects/SharedObject.swift +0 -31
- package/ios/Views/ViewDefinition.swift +0 -114
- package/ios/Views/ViewFactory.swift +0 -16
- package/ios/Views/ViewManagerDefinition.swift +0 -77
- package/ios/Views/ViewManagerDefinitionBuilder.swift +0 -11
- /package/ios/{AppContextConfig.swift → Core/AppContextConfig.swift} +0 -0
- /package/ios/{Arguments → Core/Arguments}/AnyArgument.swift +0 -0
- /package/ios/{Arguments → Core/Arguments}/Convertible.swift +0 -0
- /package/ios/{Arguments → Core/Arguments}/Convertibles.swift +0 -0
- /package/ios/{Arguments → Core/Arguments}/Enumerable.swift +0 -0
- /package/ios/{Classes → Core/Classes}/ClassRegistry.swift +0 -0
- /package/ios/{Convertibles → Core/Convertibles}/Convertibles+Color.swift +0 -0
- /package/ios/{Convertibles → Core/Convertibles}/Either.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/AnyDynamicType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicArrayType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicConvertibleType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicDataType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicDictionaryType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicEnumType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicJavaScriptType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicOptionalType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicRawType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicTypedArrayType.swift +0 -0
- /package/ios/{DynamicTypes → Core/DynamicTypes}/DynamicViewType.swift +0 -0
- /package/ios/{EventListener.swift → Core/EventListener.swift} +0 -0
- /package/ios/{Events → Core/Events}/Callback.swift +0 -0
- /package/ios/{Events → Core/Events}/EventDispatcher.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/ChainableException.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/CodedError.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/CommonExceptions.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/Exception.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/ExceptionOrigin.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/GenericException.swift +0 -0
- /package/ios/{Exceptions → Core/Exceptions}/UnexpectedException.swift +0 -0
- /package/ios/{JavaScriptFunction.swift → Core/JavaScriptFunction.swift} +0 -0
- /package/ios/{Logging → Core/Logging}/LogType.swift +0 -0
- /package/ios/{Logging → Core/Logging}/PersistentFileLog.swift +0 -0
- /package/ios/{ModuleRegistry.swift → Core/ModuleRegistry.swift} +0 -0
- /package/ios/{Modules → Core/Modules}/Module.swift +0 -0
- /package/ios/{ModulesProvider.swift → Core/ModulesProvider.swift} +0 -0
- /package/ios/{Objects → Core/Objects}/JavaScriptObjectBuilder.swift +0 -0
- /package/ios/{Promise.swift → Core/Promise.swift} +0 -0
- /package/ios/{Records → Core/Records}/AnyField.swift +0 -0
- /package/ios/{Records → Core/Records}/Field.swift +0 -0
- /package/ios/{Records → Core/Records}/FieldExtensions.swift +0 -0
- /package/ios/{Records → Core/Records}/FieldOption.swift +0 -0
- /package/ios/{Records → Core/Records}/Record.swift +0 -0
- /package/ios/{SharedObjects → Core/SharedObjects}/SharedRef.swift +0 -0
- /package/ios/{TypedArrays → Core/TypedArrays}/AnyTypedArray.swift +0 -0
- /package/ios/{TypedArrays → Core/TypedArrays}/ConcreteTypedArrays.swift +0 -0
- /package/ios/{TypedArrays → Core/TypedArrays}/GenericTypedArray.swift +0 -0
- /package/ios/{TypedArrays → Core/TypedArrays}/TypedArray.swift +0 -0
- /package/ios/{Views → Core/Views}/ConcreteViewProp.swift +0 -0
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
// Copyright 2022-present 650 Industries. All rights reserved.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
Type-erased protocol for synchronous functions.
|
|
5
|
-
*/
|
|
6
|
-
internal protocol AnySyncFunctionComponent: AnyFunction {
|
|
7
|
-
/**
|
|
8
|
-
Calls the function synchronously with given arguments.
|
|
9
|
-
- Parameters:
|
|
10
|
-
- owner: An object that calls this function. If the `takesOwner` property is true
|
|
11
|
-
and type of the first argument matches the owner type, it's being passed as the argument.
|
|
12
|
-
- args: An array of arguments to pass to the function. The arguments must be of the same type as in the underlying closure.
|
|
13
|
-
- appContext: An app context where the function is executed.
|
|
14
|
-
- Returns: A value returned by the called function when succeeded or an error when it failed.
|
|
15
|
-
*/
|
|
16
|
-
func call(by owner: AnyObject?, withArguments args: [Any], appContext: AppContext) throws -> Any
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
Represents a function that can only be called synchronously.
|
|
21
|
-
*/
|
|
22
|
-
public final class SyncFunctionComponent<Args, FirstArgType, ReturnType>: AnySyncFunctionComponent {
|
|
23
|
-
typealias ClosureType = (Args) throws -> ReturnType
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
The underlying closure to run when the function is called.
|
|
27
|
-
*/
|
|
28
|
-
let body: ClosureType
|
|
29
|
-
|
|
30
|
-
init(
|
|
31
|
-
_ name: String,
|
|
32
|
-
firstArgType: FirstArgType.Type,
|
|
33
|
-
dynamicArgumentTypes: [AnyDynamicType],
|
|
34
|
-
_ body: @escaping ClosureType
|
|
35
|
-
) {
|
|
36
|
-
self.name = name
|
|
37
|
-
self.dynamicArgumentTypes = dynamicArgumentTypes
|
|
38
|
-
self.body = body
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// MARK: - AnyFunction
|
|
42
|
-
|
|
43
|
-
let name: String
|
|
44
|
-
|
|
45
|
-
let dynamicArgumentTypes: [AnyDynamicType]
|
|
46
|
-
|
|
47
|
-
var argumentsCount: Int {
|
|
48
|
-
return dynamicArgumentTypes.count - (takesOwner ? 1 : 0)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
var takesOwner: Bool = false
|
|
52
|
-
|
|
53
|
-
func call(by owner: AnyObject?, withArguments args: [Any], appContext: AppContext, callback: @escaping (FunctionCallResult) -> ()) {
|
|
54
|
-
do {
|
|
55
|
-
let result = try call(by: owner, withArguments: args, appContext: appContext)
|
|
56
|
-
callback(.success(Conversions.convertFunctionResult(result)))
|
|
57
|
-
} catch let error as Exception {
|
|
58
|
-
callback(.failure(error))
|
|
59
|
-
} catch {
|
|
60
|
-
callback(.failure(UnexpectedException(error)))
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// MARK: - AnySyncFunctionComponent
|
|
65
|
-
|
|
66
|
-
func call(by owner: AnyObject?, withArguments args: [Any], appContext: AppContext) throws -> Any {
|
|
67
|
-
do {
|
|
68
|
-
try validateArgumentsNumber(function: self, received: args.count)
|
|
69
|
-
|
|
70
|
-
var arguments = concat(
|
|
71
|
-
arguments: args,
|
|
72
|
-
withOwner: owner,
|
|
73
|
-
withPromise: nil,
|
|
74
|
-
forFunction: self,
|
|
75
|
-
appContext: appContext
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
// Convert JS values to non-JS native types.
|
|
79
|
-
arguments = try cast(jsValues: arguments, forFunction: self, appContext: appContext)
|
|
80
|
-
|
|
81
|
-
// Convert arguments to the types desired by the function.
|
|
82
|
-
arguments = try cast(arguments: arguments, forFunction: self, appContext: appContext)
|
|
83
|
-
|
|
84
|
-
let argumentsTuple = try Conversions.toTuple(arguments) as! Args
|
|
85
|
-
return try body(argumentsTuple)
|
|
86
|
-
} catch let error as Exception {
|
|
87
|
-
throw FunctionCallException(name).causedBy(error)
|
|
88
|
-
} catch {
|
|
89
|
-
throw UnexpectedException(error)
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// MARK: - JavaScriptObjectBuilder
|
|
94
|
-
|
|
95
|
-
func build(appContext: AppContext) throws -> JavaScriptObject {
|
|
96
|
-
// We intentionally capture a strong reference to `self`, otherwise the "detached" objects would
|
|
97
|
-
// immediately lose the reference to the definition and thus the underlying native function.
|
|
98
|
-
// It may potentially cause memory leaks, but at the time of writing this comment,
|
|
99
|
-
// the native definition instance deallocates correctly when the JS VM triggers the garbage collector.
|
|
100
|
-
return try appContext.runtime.createSyncFunction(name, argsCount: argumentsCount) { [weak appContext, self] this, args in
|
|
101
|
-
guard let appContext else {
|
|
102
|
-
throw Exceptions.AppContextLost()
|
|
103
|
-
}
|
|
104
|
-
let result = try self.call(by: this, withArguments: args, appContext: appContext)
|
|
105
|
-
return Conversions.convertFunctionResult(result, appContext: appContext, dynamicType: ~ReturnType.self)
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
Synchronous function without arguments.
|
|
112
|
-
*/
|
|
113
|
-
public func Function<R>(
|
|
114
|
-
_ name: String,
|
|
115
|
-
@_implicitSelfCapture _ closure: @escaping () throws -> R
|
|
116
|
-
) -> SyncFunctionComponent<(), Void, R> {
|
|
117
|
-
return SyncFunctionComponent(
|
|
118
|
-
name,
|
|
119
|
-
firstArgType: Void.self,
|
|
120
|
-
dynamicArgumentTypes: [],
|
|
121
|
-
closure
|
|
122
|
-
)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
Synchronous function with one argument.
|
|
127
|
-
*/
|
|
128
|
-
public func Function<R, A0: AnyArgument>(
|
|
129
|
-
_ name: String,
|
|
130
|
-
@_implicitSelfCapture _ closure: @escaping (A0) throws -> R
|
|
131
|
-
) -> SyncFunctionComponent<(A0), A0, R> {
|
|
132
|
-
return SyncFunctionComponent(
|
|
133
|
-
name,
|
|
134
|
-
firstArgType: A0.self,
|
|
135
|
-
dynamicArgumentTypes: [~A0.self],
|
|
136
|
-
closure
|
|
137
|
-
)
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
Synchronous function with two arguments.
|
|
142
|
-
*/
|
|
143
|
-
public func Function<R, A0: AnyArgument, A1: AnyArgument>(
|
|
144
|
-
_ name: String,
|
|
145
|
-
@_implicitSelfCapture _ closure: @escaping (A0, A1) throws -> R
|
|
146
|
-
) -> SyncFunctionComponent<(A0, A1), A0, R> {
|
|
147
|
-
return SyncFunctionComponent(
|
|
148
|
-
name,
|
|
149
|
-
firstArgType: A0.self,
|
|
150
|
-
dynamicArgumentTypes: [~A0.self, ~A1.self],
|
|
151
|
-
closure
|
|
152
|
-
)
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
Synchronous function with three arguments.
|
|
157
|
-
*/
|
|
158
|
-
public func Function<R, A0: AnyArgument, A1: AnyArgument, A2: AnyArgument>(
|
|
159
|
-
_ name: String,
|
|
160
|
-
@_implicitSelfCapture _ closure: @escaping (A0, A1, A2) throws -> R
|
|
161
|
-
) -> SyncFunctionComponent<(A0, A1, A2), A0, R> {
|
|
162
|
-
return SyncFunctionComponent(
|
|
163
|
-
name,
|
|
164
|
-
firstArgType: A0.self,
|
|
165
|
-
dynamicArgumentTypes: [
|
|
166
|
-
~A0.self,
|
|
167
|
-
~A1.self,
|
|
168
|
-
~A2.self
|
|
169
|
-
],
|
|
170
|
-
closure
|
|
171
|
-
)
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
Synchronous function with four arguments.
|
|
176
|
-
*/
|
|
177
|
-
public func Function<R, A0: AnyArgument, A1: AnyArgument, A2: AnyArgument, A3: AnyArgument>(
|
|
178
|
-
_ name: String,
|
|
179
|
-
@_implicitSelfCapture _ closure: @escaping (A0, A1, A2, A3) throws -> R
|
|
180
|
-
) -> SyncFunctionComponent<(A0, A1, A2, A3), A0, R> {
|
|
181
|
-
return SyncFunctionComponent(
|
|
182
|
-
name,
|
|
183
|
-
firstArgType: A0.self,
|
|
184
|
-
dynamicArgumentTypes: [
|
|
185
|
-
~A0.self,
|
|
186
|
-
~A1.self,
|
|
187
|
-
~A2.self,
|
|
188
|
-
~A3.self
|
|
189
|
-
],
|
|
190
|
-
closure
|
|
191
|
-
)
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
Synchronous function with five arguments.
|
|
196
|
-
*/
|
|
197
|
-
public func Function<R, A0: AnyArgument, A1: AnyArgument, A2: AnyArgument, A3: AnyArgument, A4: AnyArgument>(
|
|
198
|
-
_ name: String,
|
|
199
|
-
@_implicitSelfCapture _ closure: @escaping (A0, A1, A2, A3, A4) throws -> R
|
|
200
|
-
) -> SyncFunctionComponent<(A0, A1, A2, A3, A4), A0, R> {
|
|
201
|
-
return SyncFunctionComponent(
|
|
202
|
-
name,
|
|
203
|
-
firstArgType: A0.self,
|
|
204
|
-
dynamicArgumentTypes: [
|
|
205
|
-
~A0.self,
|
|
206
|
-
~A1.self,
|
|
207
|
-
~A2.self,
|
|
208
|
-
~A3.self,
|
|
209
|
-
~A4.self
|
|
210
|
-
],
|
|
211
|
-
closure
|
|
212
|
-
)
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
Synchronous function with six arguments.
|
|
217
|
-
*/
|
|
218
|
-
public func Function<R, A0: AnyArgument, A1: AnyArgument, A2: AnyArgument, A3: AnyArgument, A4: AnyArgument, A5: AnyArgument>(
|
|
219
|
-
_ name: String,
|
|
220
|
-
@_implicitSelfCapture _ closure: @escaping (A0, A1, A2, A3, A4, A5) throws -> R
|
|
221
|
-
) -> SyncFunctionComponent<(A0, A1, A2, A3, A4, A5), A0, R> {
|
|
222
|
-
return SyncFunctionComponent(
|
|
223
|
-
name,
|
|
224
|
-
firstArgType: A0.self,
|
|
225
|
-
dynamicArgumentTypes: [
|
|
226
|
-
~A0.self,
|
|
227
|
-
~A1.self,
|
|
228
|
-
~A2.self,
|
|
229
|
-
~A3.self,
|
|
230
|
-
~A4.self,
|
|
231
|
-
~A5.self
|
|
232
|
-
],
|
|
233
|
-
closure
|
|
234
|
-
)
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
Synchronous function with seven arguments.
|
|
239
|
-
*/
|
|
240
|
-
public func Function<R, A0: AnyArgument, A1: AnyArgument, A2: AnyArgument, A3: AnyArgument, A4: AnyArgument, A5: AnyArgument, A6: AnyArgument>(
|
|
241
|
-
_ name: String,
|
|
242
|
-
@_implicitSelfCapture _ closure: @escaping (A0, A1, A2, A3, A4, A5, A6) throws -> R
|
|
243
|
-
) -> SyncFunctionComponent<(A0, A1, A2, A3, A4, A5, A6), A0, R> {
|
|
244
|
-
return SyncFunctionComponent(
|
|
245
|
-
name,
|
|
246
|
-
firstArgType: A0.self,
|
|
247
|
-
dynamicArgumentTypes: [
|
|
248
|
-
~A0.self,
|
|
249
|
-
~A1.self,
|
|
250
|
-
~A2.self,
|
|
251
|
-
~A3.self,
|
|
252
|
-
~A4.self,
|
|
253
|
-
~A5.self,
|
|
254
|
-
~A6.self
|
|
255
|
-
],
|
|
256
|
-
closure
|
|
257
|
-
)
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
Synchronous function with eight arguments.
|
|
262
|
-
*/
|
|
263
|
-
public func Function<R, A0: AnyArgument, A1: AnyArgument, A2: AnyArgument, A3: AnyArgument, A4: AnyArgument, A5: AnyArgument, A6: AnyArgument, A7: AnyArgument>(
|
|
264
|
-
_ name: String,
|
|
265
|
-
@_implicitSelfCapture _ closure: @escaping (A0, A1, A2, A3, A4, A5, A6, A7) throws -> R
|
|
266
|
-
) -> SyncFunctionComponent<(A0, A1, A2, A3, A4, A5, A6, A7), A0, R> {
|
|
267
|
-
return SyncFunctionComponent(
|
|
268
|
-
name,
|
|
269
|
-
firstArgType: A0.self,
|
|
270
|
-
dynamicArgumentTypes: [
|
|
271
|
-
~A0.self,
|
|
272
|
-
~A1.self,
|
|
273
|
-
~A2.self,
|
|
274
|
-
~A3.self,
|
|
275
|
-
~A4.self,
|
|
276
|
-
~A5.self,
|
|
277
|
-
~A6.self,
|
|
278
|
-
~A7.self
|
|
279
|
-
],
|
|
280
|
-
closure
|
|
281
|
-
)
|
|
282
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
-
|
|
3
|
-
#import <ExpoModulesCore/Platform.h>
|
|
4
|
-
|
|
5
|
-
@protocol EXFontProcessorInterface
|
|
6
|
-
|
|
7
|
-
- (UIFont *)updateFont:(UIFont *)uiFont
|
|
8
|
-
withFamily:(NSString *)family
|
|
9
|
-
size:(NSNumber *)size
|
|
10
|
-
weight:(NSString *)weight
|
|
11
|
-
style:(NSString *)style
|
|
12
|
-
variant:(NSArray<NSDictionary *> *)variant
|
|
13
|
-
scaleMultiplier:(CGFloat)scaleMultiplier;
|
|
14
|
-
|
|
15
|
-
@end
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
-
|
|
3
|
-
#import <objc/runtime.h>
|
|
4
|
-
#import <React/RCTFont.h>
|
|
5
|
-
|
|
6
|
-
#import <ExpoModulesCore/EXDefines.h>
|
|
7
|
-
#import <ExpoModulesCore/EXReactFontManager.h>
|
|
8
|
-
#import <ExpoModulesCore/EXFontProcessorInterface.h>
|
|
9
|
-
#import <ExpoModulesCore/EXFontManagerInterface.h>
|
|
10
|
-
#import <ExpoModulesCore/EXAppLifecycleService.h>
|
|
11
|
-
|
|
12
|
-
static dispatch_once_t initializeCurrentFontProcessorsOnce;
|
|
13
|
-
|
|
14
|
-
static NSPointerArray *currentFontProcessors;
|
|
15
|
-
|
|
16
|
-
@implementation UIFont (EXFontManager)
|
|
17
|
-
|
|
18
|
-
+ (nullable UIFont *)EXfontWithName:(NSString *)name size:(CGFloat)fontSize
|
|
19
|
-
{
|
|
20
|
-
for (id<EXFontProcessorInterface> fontProcessor in currentFontProcessors) {
|
|
21
|
-
NSNumber *size = [NSNumber numberWithFloat:fontSize];
|
|
22
|
-
UIFont *font = [fontProcessor updateFont:nil withFamily:name size:size weight:nil style:nil variant:nil scaleMultiplier:1];
|
|
23
|
-
if (font) {
|
|
24
|
-
return font;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return [self EXfontWithName:name size:fontSize];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@end
|
|
31
|
-
|
|
32
|
-
@implementation RCTFont (EXReactFontManager)
|
|
33
|
-
|
|
34
|
-
+ (UIFont *)EXUpdateFont:(UIFont *)uiFont
|
|
35
|
-
withFamily:(NSString *)family
|
|
36
|
-
size:(NSNumber *)size
|
|
37
|
-
weight:(NSString *)weight
|
|
38
|
-
style:(NSString *)style
|
|
39
|
-
variant:(NSArray<NSDictionary *> *)variant
|
|
40
|
-
scaleMultiplier:(CGFloat)scaleMultiplier
|
|
41
|
-
{
|
|
42
|
-
UIFont *font;
|
|
43
|
-
for (id<EXFontProcessorInterface> fontProcessor in currentFontProcessors) {
|
|
44
|
-
font = [fontProcessor updateFont:uiFont withFamily:family size:size weight:weight style:style variant:variant scaleMultiplier:scaleMultiplier];
|
|
45
|
-
if (font) {
|
|
46
|
-
return font;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return [self EXUpdateFont:uiFont withFamily:family size:size weight:weight style:style variant:variant scaleMultiplier:scaleMultiplier];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@end
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* This class is responsible for allowing other modules to register as font processors in React Native.
|
|
56
|
-
*
|
|
57
|
-
* A font processor is an object conforming to EXFontProcessorInterface and is capable of
|
|
58
|
-
* providing an instance of UIFont for given (family, size, weight, style, variant, scaleMultiplier).
|
|
59
|
-
*
|
|
60
|
-
* To be able to hook into React Native's way of processing fonts we:
|
|
61
|
-
* - add a new class method to RCTFont, `EXUpdateFont:withFamily:size:weight:style:variant:scaleMultiplier`
|
|
62
|
-
* with EXReactFontManager category.
|
|
63
|
-
* - add a new static variable `currentFontProcessors` holding an array of... font processors. This variable
|
|
64
|
-
* is shared between the RCTFont's category and EXReactFontManager class.
|
|
65
|
-
* - when EXReactFontManager is initialized, we exchange implementations of RCTFont.updateFont...
|
|
66
|
-
* and RCTFont.EXUpdateFont... After the class initialized, which happens only once, calling `RCTFont updateFont`
|
|
67
|
-
* calls in fact implementation we've defined up here and calling `RCTFont EXUpdateFont` falls back
|
|
68
|
-
* to the default implementation. (This is why we call `[self EXUpdateFont]` at the end of that function,
|
|
69
|
-
* though it seems like an endless loop, in fact we dispatch to another implementation.)
|
|
70
|
-
* - When some module adds a font processor using EXFontManagerInterface, EXReactFontManager adds a weak pointer to it
|
|
71
|
-
* to currentFontProcessors array.
|
|
72
|
-
* - Implementation logic of `RCTFont.EXUpdateFont` uses current value of currentFontProcessors when processing arguments.
|
|
73
|
-
*/
|
|
74
|
-
|
|
75
|
-
@interface EXReactFontManager ()
|
|
76
|
-
|
|
77
|
-
@property (nonatomic, strong) NSMutableSet *fontProcessors;
|
|
78
|
-
|
|
79
|
-
@end
|
|
80
|
-
|
|
81
|
-
@implementation EXReactFontManager
|
|
82
|
-
|
|
83
|
-
EX_REGISTER_MODULE();
|
|
84
|
-
|
|
85
|
-
- (instancetype)init
|
|
86
|
-
{
|
|
87
|
-
if (self = [super init]) {
|
|
88
|
-
_fontProcessors = [NSMutableSet set];
|
|
89
|
-
}
|
|
90
|
-
return self;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
+ (const NSArray<Protocol *> *)exportedInterfaces
|
|
94
|
-
{
|
|
95
|
-
return @[@protocol(EXFontManagerInterface)];
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
+ (void)initialize
|
|
99
|
-
{
|
|
100
|
-
dispatch_once(&initializeCurrentFontProcessorsOnce, ^{
|
|
101
|
-
currentFontProcessors = [NSPointerArray weakObjectsPointerArray];
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
#ifdef RN_FABRIC_ENABLED
|
|
105
|
-
Class uiFont = [UIFont class];
|
|
106
|
-
SEL uiUpdate = @selector(fontWithName:size:);
|
|
107
|
-
SEL exUpdate = @selector(EXfontWithName:size:);
|
|
108
|
-
|
|
109
|
-
method_exchangeImplementations(class_getClassMethod(uiFont, uiUpdate),
|
|
110
|
-
class_getClassMethod(uiFont, exUpdate));
|
|
111
|
-
#else
|
|
112
|
-
Class rtcClass = [RCTFont class];
|
|
113
|
-
SEL rtcUpdate = @selector(updateFont:withFamily:size:weight:style:variant:scaleMultiplier:);
|
|
114
|
-
SEL exUpdate = @selector(EXUpdateFont:withFamily:size:weight:style:variant:scaleMultiplier:);
|
|
115
|
-
|
|
116
|
-
method_exchangeImplementations(class_getClassMethod(rtcClass, rtcUpdate),
|
|
117
|
-
class_getClassMethod(rtcClass, exUpdate));
|
|
118
|
-
#endif
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
# pragma mark - EXFontManager
|
|
122
|
-
|
|
123
|
-
- (void)addFontProcessor:(id<EXFontProcessorInterface>)processor
|
|
124
|
-
{
|
|
125
|
-
[_fontProcessors addObject:processor];
|
|
126
|
-
[currentFontProcessors compact];
|
|
127
|
-
[currentFontProcessors addPointer:(__bridge void * _Nullable)(processor)];
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
@end
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
A protocol for any type-erased module that provides functions used by the core.
|
|
3
|
-
*/
|
|
4
|
-
public protocol AnyModule: AnyObject, AnyArgument {
|
|
5
|
-
/**
|
|
6
|
-
The default initializer. Must be public, but the module class does *not* need to
|
|
7
|
-
define it as it is implemented in protocol composition, see `BaseModule` class.
|
|
8
|
-
*/
|
|
9
|
-
init(appContext: AppContext)
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
A DSL-like function that returns a `ModuleDefinition` which can be built up from module's name, constants or functions.
|
|
13
|
-
The `@ModuleDefinitionBuilder` wrapper is *not* required in the implementation — it is implicitly taken from the protocol.
|
|
14
|
-
|
|
15
|
-
# Example
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
public func definition() -> ModuleDefinition {
|
|
19
|
-
Name("MyModule")
|
|
20
|
-
AsyncFunction("myFunction") { (a: String, b: String) in
|
|
21
|
-
"\(a) \(b)"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
This example exports the module to the JavaScript world, which can be used as in this snippet 👇
|
|
27
|
-
|
|
28
|
-
```javascript
|
|
29
|
-
import { NativeModulesProxy } from 'expo-modules-core';
|
|
30
|
-
|
|
31
|
-
await NativeModulesProxy.MyModule.myFunction('Hello', 'World!'); // -> 'Hello World!'
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
# Function's result obtained asynchronously
|
|
35
|
-
|
|
36
|
-
If you need to run some async code to get the proper value that you want to return to JavaScript,
|
|
37
|
-
just specify an argument of type `Promise` as the last one and use its `resolve` or `reject` functions.
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
AsyncFunction("myFunction") { (promise: Promise) in
|
|
41
|
-
DispatchQueue.main.async {
|
|
42
|
-
promise.resolve("return value obtained in async callback")
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
```
|
|
46
|
-
*/
|
|
47
|
-
#if swift(>=5.4)
|
|
48
|
-
@ModuleDefinitionBuilder
|
|
49
|
-
func definition() -> ModuleDefinition
|
|
50
|
-
#else
|
|
51
|
-
func definition() -> ModuleDefinition
|
|
52
|
-
#endif
|
|
53
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// The core module that describes the `global.expo` object.
|
|
2
|
-
internal final class CoreModule: Module {
|
|
3
|
-
internal func definition() -> ModuleDefinition {
|
|
4
|
-
// Expose some common classes and maybe even the `modules` host object in the future.
|
|
5
|
-
Function("uuidv4") { () -> String in
|
|
6
|
-
return UUID().uuidString.lowercased()
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
Function("uuidv5") { (name: String, namespace: String) -> String in
|
|
10
|
-
guard let namespaceUuid = UUID(uuidString: namespace) else {
|
|
11
|
-
throw InvalidNamespaceException(namespace)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return uuidv5(name: name, namespace: namespaceUuid).uuidString.lowercased()
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
-
|
|
3
|
-
#import <React/RCTBridgeDelegate.h>
|
|
4
|
-
|
|
5
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
6
|
-
|
|
7
|
-
@interface EXRCTBridgeDelegateInterceptor : NSObject<RCTBridgeDelegate>
|
|
8
|
-
|
|
9
|
-
@property (nonatomic, weak) id<RCTBridgeDelegate> bridgeDelegate;
|
|
10
|
-
@property (nonatomic, weak) id<RCTBridgeDelegate> interceptor;
|
|
11
|
-
|
|
12
|
-
- (instancetype)initWithBridgeDelegate:(id<RCTBridgeDelegate>)bridgeDelegate interceptor:(id<RCTBridgeDelegate>)interceptor;
|
|
13
|
-
|
|
14
|
-
@end
|
|
15
|
-
|
|
16
|
-
NS_ASSUME_NONNULL_END
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
-
|
|
3
|
-
#import <ExpoModulesCore/EXRCTBridgeDelegateInterceptor.h>
|
|
4
|
-
|
|
5
|
-
@implementation EXRCTBridgeDelegateInterceptor
|
|
6
|
-
|
|
7
|
-
- (instancetype)initWithBridgeDelegate:(id<RCTBridgeDelegate>)bridgeDelegate interceptor:(id<RCTBridgeDelegate>)interceptor
|
|
8
|
-
{
|
|
9
|
-
if (self = [super init]) {
|
|
10
|
-
self.bridgeDelegate = bridgeDelegate;
|
|
11
|
-
self.interceptor = interceptor;
|
|
12
|
-
}
|
|
13
|
-
return self;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
- (BOOL)conformsToProtocol:(Protocol *)protocol
|
|
17
|
-
{
|
|
18
|
-
return [self.bridgeDelegate conformsToProtocol:protocol];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
- (id)forwardingTargetForSelector:(SEL)selector
|
|
22
|
-
{
|
|
23
|
-
if ([self isInterceptedSelector:selector]) {
|
|
24
|
-
return self;
|
|
25
|
-
}
|
|
26
|
-
return self.bridgeDelegate;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
- (BOOL)respondsToSelector:(SEL)selector
|
|
30
|
-
{
|
|
31
|
-
if ([self isInterceptedSelector:selector]) {
|
|
32
|
-
return YES;
|
|
33
|
-
}
|
|
34
|
-
return [self.bridgeDelegate respondsToSelector:selector];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
- (BOOL)isInterceptedSelector:(SEL)selector
|
|
38
|
-
{
|
|
39
|
-
if ([self.interceptor respondsToSelector:selector]) {
|
|
40
|
-
return YES;
|
|
41
|
-
}
|
|
42
|
-
return NO;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
|
|
46
|
-
return [self.interceptor sourceURLForBridge:bridge];
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
-
|
|
3
|
-
#import <ExpoModulesCore/Platform.h>
|
|
4
|
-
#import <ExpoModulesCore/EXDefines.h>
|
|
5
|
-
#import <React/RCTBridge.h>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
EX_EXTERN_C_BEGIN
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Enhanced `RCTAppSetupDefaultRootView`.
|
|
12
|
-
*/
|
|
13
|
-
UIView *EXAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary *initialProperties, BOOL fabricEnabled);
|
|
14
|
-
|
|
15
|
-
EX_EXTERN_C_END
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
-
|
|
3
|
-
#import <ExpoModulesCore/EXReactCompatibleHelpers.h>
|
|
4
|
-
|
|
5
|
-
#import <React/RCTRootView.h>
|
|
6
|
-
|
|
7
|
-
#if __has_include(<React-RCTAppDelegate/RCTAppSetupUtils.h>)
|
|
8
|
-
#import <React-RCTAppDelegate/RCTAppSetupUtils.h>
|
|
9
|
-
#elif __has_include(<React_RCTAppDelegate/RCTAppSetupUtils.h>)
|
|
10
|
-
// for importing the header from framework, the dash will be transformed to underscore
|
|
11
|
-
#import <React_RCTAppDelegate/RCTAppSetupUtils.h>
|
|
12
|
-
#else
|
|
13
|
-
// react-native < 0.72
|
|
14
|
-
#import <React/RCTAppSetupUtils.h>
|
|
15
|
-
#endif
|
|
16
|
-
|
|
17
|
-
UIView *EXAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary *initialProperties, BOOL fabricEnabled)
|
|
18
|
-
{
|
|
19
|
-
// Originally the EXAppSetupDefaultRootView is for backward compatible,
|
|
20
|
-
// it is now exactly the same as RCTAppSetupDefaultRootView.
|
|
21
|
-
// Would like to keep this file longer and see if we still need this in the future.
|
|
22
|
-
// Remove this when we drop SDK 49
|
|
23
|
-
return RCTAppSetupDefaultRootView(bridge, moduleName, initialProperties, fabricEnabled);
|
|
24
|
-
}
|
|
25
|
-
|