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
|
@@ -2,156 +2,249 @@
|
|
|
2
2
|
|
|
3
3
|
package expo.modules.kotlin.functions
|
|
4
4
|
|
|
5
|
+
import expo.modules.kotlin.component6
|
|
6
|
+
import expo.modules.kotlin.component7
|
|
7
|
+
import expo.modules.kotlin.component8
|
|
5
8
|
import expo.modules.kotlin.Promise
|
|
6
|
-
import expo.modules.kotlin.types.
|
|
7
|
-
import kotlin.
|
|
9
|
+
import expo.modules.kotlin.types.enforceType
|
|
10
|
+
import expo.modules.kotlin.types.toArgsArray
|
|
8
11
|
|
|
9
12
|
class AsyncFunctionBuilder(@PublishedApi internal val name: String) {
|
|
10
13
|
@PublishedApi
|
|
11
14
|
internal var asyncFunctionComponent: BaseAsyncFunctionComponent? = null
|
|
12
15
|
|
|
13
16
|
inline fun <reified R> SuspendBody(crossinline block: suspend () -> R): BaseAsyncFunctionComponent {
|
|
14
|
-
return SuspendFunctionComponent(name,
|
|
17
|
+
return SuspendFunctionComponent(name, emptyArray()) { block() }.also {
|
|
15
18
|
asyncFunctionComponent = it
|
|
16
19
|
}
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
inline fun <reified R, reified P0> SuspendBody(crossinline block: suspend (p0: P0) -> R): SuspendFunctionComponent {
|
|
20
|
-
return SuspendFunctionComponent(name,
|
|
23
|
+
return SuspendFunctionComponent(name, toArgsArray<P0>()) { (p0) ->
|
|
24
|
+
enforceType<P0>(p0)
|
|
25
|
+
block(p0)
|
|
26
|
+
}.also {
|
|
21
27
|
asyncFunctionComponent = it
|
|
22
28
|
}
|
|
23
29
|
}
|
|
24
30
|
|
|
25
31
|
inline fun <reified R, reified P0, reified P1> SuspendBody(crossinline block: suspend (p0: P0, p1: P1) -> R): SuspendFunctionComponent {
|
|
26
|
-
return SuspendFunctionComponent(name,
|
|
32
|
+
return SuspendFunctionComponent(name, toArgsArray<P0, P1>()) { (p0, p1) ->
|
|
33
|
+
enforceType<P0, P1>(p0, p1)
|
|
34
|
+
block(p0, p1)
|
|
35
|
+
}.also {
|
|
27
36
|
asyncFunctionComponent = it
|
|
28
37
|
}
|
|
29
38
|
}
|
|
30
39
|
|
|
31
40
|
inline fun <reified R, reified P0, reified P1, reified P2> SuspendBody(crossinline block: suspend (p0: P0, p1: P1, p2: P2) -> R): SuspendFunctionComponent {
|
|
32
|
-
return SuspendFunctionComponent(name,
|
|
41
|
+
return SuspendFunctionComponent(name, toArgsArray<P0, P1, P2>()) { (p0, p1, p2) ->
|
|
42
|
+
enforceType<P0, P1, P2>(p0, p1, p2)
|
|
43
|
+
block(p0, p1, p2)
|
|
44
|
+
}.also {
|
|
33
45
|
asyncFunctionComponent = it
|
|
34
46
|
}
|
|
35
47
|
}
|
|
36
48
|
|
|
37
49
|
inline fun <reified R, reified P0, reified P1, reified P2, reified P3> SuspendBody(crossinline block: suspend (p0: P0, p1: P1, p2: P2, p3: P3) -> R): SuspendFunctionComponent {
|
|
38
|
-
return SuspendFunctionComponent(name,
|
|
50
|
+
return SuspendFunctionComponent(name, toArgsArray<P0, P1, P2, P3>()) { (p0, p1, p2, p3) ->
|
|
51
|
+
enforceType<P0, P1, P2, P3>(p0, p1, p2, p3)
|
|
52
|
+
block(p0, p1, p2, p3)
|
|
53
|
+
}.also {
|
|
39
54
|
asyncFunctionComponent = it
|
|
40
55
|
}
|
|
41
56
|
}
|
|
42
57
|
|
|
43
58
|
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4> SuspendBody(crossinline block: suspend (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) -> R): SuspendFunctionComponent {
|
|
44
|
-
return SuspendFunctionComponent(name,
|
|
59
|
+
return SuspendFunctionComponent(name, toArgsArray<P0, P1, P2, P3, P4>()) { (p0, p1, p2, p3, p4) ->
|
|
60
|
+
enforceType<P0, P1, P2, P3, P4>(p0, p1, p2, p3, p4)
|
|
61
|
+
block(p0, p1, p2, p3, p4)
|
|
62
|
+
}.also {
|
|
45
63
|
asyncFunctionComponent = it
|
|
46
64
|
}
|
|
47
65
|
}
|
|
48
66
|
|
|
49
67
|
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5> SuspendBody(crossinline block: suspend (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) -> R): SuspendFunctionComponent {
|
|
50
|
-
return SuspendFunctionComponent(name,
|
|
68
|
+
return SuspendFunctionComponent(name, toArgsArray<P0, P1, P2, P3, P4, P5>()) { (p0, p1, p2, p3, p4, p5) ->
|
|
69
|
+
enforceType<P0, P1, P2, P3, P4, P5>(p0, p1, p2, p3, p4, p5)
|
|
70
|
+
block(p0, p1, p2, p3, p4, p5)
|
|
71
|
+
}.also {
|
|
51
72
|
asyncFunctionComponent = it
|
|
52
73
|
}
|
|
53
74
|
}
|
|
54
75
|
|
|
55
76
|
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6> SuspendBody(crossinline block: suspend (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6) -> R): SuspendFunctionComponent {
|
|
56
|
-
return SuspendFunctionComponent(name,
|
|
77
|
+
return SuspendFunctionComponent(name, toArgsArray<P0, P1, P2, P3, P4, P5, P6>()) { (p0, p1, p2, p3, p4, p5, p6) ->
|
|
78
|
+
enforceType<P0, P1, P2, P3, P4, P5, P6>(p0, p1, p2, p3, p4, p5, p6)
|
|
79
|
+
block(p0, p1, p2, p3, p4, p5, p6)
|
|
80
|
+
}.also {
|
|
57
81
|
asyncFunctionComponent = it
|
|
58
82
|
}
|
|
59
83
|
}
|
|
60
84
|
|
|
61
85
|
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6, reified P7> SuspendBody(crossinline block: suspend (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7) -> R): SuspendFunctionComponent {
|
|
62
|
-
return SuspendFunctionComponent(name,
|
|
86
|
+
return SuspendFunctionComponent(name, toArgsArray<P0, P1, P2, P3, P4, P5, P6, P7>()) { (p0, p1, p2, p3, p4, p5, p6, p7) ->
|
|
87
|
+
enforceType<P0, P1, P2, P3, P4, P5, P6, P7>(p0, p1, p2, p3, p4, p5, p6, p7)
|
|
88
|
+
block(p0, p1, p2, p3, p4, p5, p6, p7)
|
|
89
|
+
}.also {
|
|
63
90
|
asyncFunctionComponent = it
|
|
64
91
|
}
|
|
65
92
|
}
|
|
66
93
|
|
|
67
94
|
@JvmName("AsyncBodyWithoutArgs")
|
|
68
95
|
inline fun AsyncBody(crossinline body: () -> Any?): AsyncFunction {
|
|
69
|
-
return
|
|
96
|
+
return createAsyncFunctionComponent(name, emptyArray()) { body() }.also {
|
|
70
97
|
asyncFunctionComponent = it
|
|
71
98
|
}
|
|
72
99
|
}
|
|
73
100
|
|
|
74
101
|
inline fun <reified R> AsyncBody(crossinline body: () -> R): AsyncFunction {
|
|
75
|
-
return
|
|
102
|
+
return createAsyncFunctionComponent(name, emptyArray()) { body() }.also {
|
|
76
103
|
asyncFunctionComponent = it
|
|
77
104
|
}
|
|
78
105
|
}
|
|
79
106
|
|
|
80
107
|
inline fun <reified R, reified P0> AsyncBody(crossinline body: (p0: P0) -> R): AsyncFunction {
|
|
81
108
|
return if (P0::class == Promise::class) {
|
|
82
|
-
AsyncFunctionWithPromiseComponent(name,
|
|
109
|
+
AsyncFunctionWithPromiseComponent(name, emptyArray()) { _, promise -> body(promise as P0) }
|
|
83
110
|
} else {
|
|
84
|
-
|
|
111
|
+
createAsyncFunctionComponent(name, toArgsArray<P0>()) { (p0) ->
|
|
112
|
+
enforceType<P0>(p0)
|
|
113
|
+
body(p0)
|
|
114
|
+
}
|
|
85
115
|
}.also {
|
|
86
116
|
asyncFunctionComponent = it
|
|
87
117
|
}
|
|
88
118
|
}
|
|
89
119
|
|
|
90
120
|
inline fun <reified R, reified P0, reified P1> AsyncBody(crossinline body: (p0: P0, p1: P1) -> R): AsyncFunction {
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
121
|
+
return createAsyncFunctionComponent(name, toArgsArray<P0, P1>()) { (p0, p1) ->
|
|
122
|
+
enforceType<P0, P1>(p0, p1)
|
|
123
|
+
body(p0, p1)
|
|
124
|
+
}.also {
|
|
125
|
+
asyncFunctionComponent = it
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@JvmName("AsyncFunctionWithPromise")
|
|
130
|
+
inline fun <reified R, reified P0> AsyncBody(crossinline body: (p0: P0, p1: Promise) -> R): AsyncFunction {
|
|
131
|
+
return AsyncFunctionWithPromiseComponent(name, toArgsArray<P0>()) { (p0), promise ->
|
|
132
|
+
enforceType<P0>(p0)
|
|
133
|
+
body(p0, promise)
|
|
95
134
|
}.also {
|
|
96
135
|
asyncFunctionComponent = it
|
|
97
136
|
}
|
|
98
137
|
}
|
|
99
138
|
|
|
100
139
|
inline fun <reified R, reified P0, reified P1, reified P2> AsyncBody(crossinline body: (p0: P0, p1: P1, p2: P2) -> R): AsyncFunction {
|
|
101
|
-
return
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
140
|
+
return createAsyncFunctionComponent(name, toArgsArray<P0, P1, P2>()) { (p0, p1, p2) ->
|
|
141
|
+
enforceType<P0, P1, P2>(p0, p1, p2)
|
|
142
|
+
body(p0, p1, p2)
|
|
143
|
+
}.also {
|
|
144
|
+
asyncFunctionComponent = it
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@JvmName("AsyncFunctionWithPromise")
|
|
149
|
+
inline fun <reified R, reified P0, reified P1> AsyncBody(crossinline body: (p0: P0, p1: P1, p2: Promise) -> R): AsyncFunction {
|
|
150
|
+
return AsyncFunctionWithPromiseComponent(name, toArgsArray<P0, P1>()) { (p0, p1), promise ->
|
|
151
|
+
enforceType<P0, P1>(p0, p1)
|
|
152
|
+
body(p0, p1, promise)
|
|
105
153
|
}.also {
|
|
106
154
|
asyncFunctionComponent = it
|
|
107
155
|
}
|
|
108
156
|
}
|
|
109
157
|
|
|
110
158
|
inline fun <reified R, reified P0, reified P1, reified P2, reified P3> AsyncBody(crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3) -> R): AsyncFunction {
|
|
111
|
-
return
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
159
|
+
return createAsyncFunctionComponent(name, toArgsArray<P0, P1, P2, P3>()) { (p0, p1, p2, p3) ->
|
|
160
|
+
enforceType<P0, P1, P2, P3>(p0, p1, p2, p3)
|
|
161
|
+
body(p0, p1, p2, p3)
|
|
162
|
+
}.also {
|
|
163
|
+
asyncFunctionComponent = it
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@JvmName("AsyncFunctionWithPromise")
|
|
168
|
+
inline fun <reified R, reified P0, reified P1, reified P2> AsyncBody(crossinline body: (p0: P0, p1: P1, p2: P2, p3: Promise) -> R): AsyncFunction {
|
|
169
|
+
return AsyncFunctionWithPromiseComponent(name, toArgsArray<P0, P1, P2>()) { (p0, p1, p2), promise ->
|
|
170
|
+
enforceType<P0, P1, P2>(p0, p1, p2)
|
|
171
|
+
body(p0, p1, p2, promise)
|
|
115
172
|
}.also {
|
|
116
173
|
asyncFunctionComponent = it
|
|
117
174
|
}
|
|
118
175
|
}
|
|
119
176
|
|
|
120
177
|
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4> AsyncBody(crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) -> R): AsyncFunction {
|
|
121
|
-
return
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
178
|
+
return createAsyncFunctionComponent(name, toArgsArray<P0, P1, P2, P3, P4>()) { (p0, p1, p2, p3, p4) ->
|
|
179
|
+
enforceType<P0, P1, P2, P3, P4>(p0, p1, p2, p3, p4)
|
|
180
|
+
body(p0, p1, p2, p3, p4)
|
|
181
|
+
}.also {
|
|
182
|
+
asyncFunctionComponent = it
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@JvmName("AsyncFunctionWithPromise")
|
|
187
|
+
inline fun <reified R, reified P0, reified P1, reified P2, reified P3> AsyncBody(crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: Promise) -> R): AsyncFunction {
|
|
188
|
+
return AsyncFunctionWithPromiseComponent(name, toArgsArray<P0, P1, P2, P3>()) { (p0, p1, p2, p3), promise ->
|
|
189
|
+
enforceType<P0, P1, P2, P3>(p0, p1, p2, p3)
|
|
190
|
+
body(p0, p1, p2, p3, promise)
|
|
125
191
|
}.also {
|
|
126
192
|
asyncFunctionComponent = it
|
|
127
193
|
}
|
|
128
194
|
}
|
|
129
195
|
|
|
130
196
|
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5> AsyncBody(crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) -> R): AsyncFunction {
|
|
131
|
-
return
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
197
|
+
return createAsyncFunctionComponent(name, toArgsArray<P0, P1, P2, P3, P4, P5>()) { (p0, p1, p2, p3, p4, p5) ->
|
|
198
|
+
enforceType<P0, P1, P2, P3, P4, P5>(p0, p1, p2, p3, p4, p5)
|
|
199
|
+
body(p0, p1, p2, p3, p4, p5)
|
|
200
|
+
}.also {
|
|
201
|
+
asyncFunctionComponent = it
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@JvmName("AsyncFunctionWithPromise")
|
|
206
|
+
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4> AsyncBody(crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: Promise) -> R): AsyncFunction {
|
|
207
|
+
return AsyncFunctionWithPromiseComponent(name, toArgsArray<P0, P1, P2, P3, P4>()) { (p0, p1, p2, p3, p4), promise ->
|
|
208
|
+
enforceType<P0, P1, P2, P3, P4>(p0, p1, p2, p3, p4)
|
|
209
|
+
body(p0, p1, p2, p3, p4, promise)
|
|
135
210
|
}.also {
|
|
136
211
|
asyncFunctionComponent = it
|
|
137
212
|
}
|
|
138
213
|
}
|
|
139
214
|
|
|
140
215
|
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6> AsyncBody(crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6) -> R): AsyncFunction {
|
|
141
|
-
return
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
216
|
+
return createAsyncFunctionComponent(name, toArgsArray<P0, P1, P2, P3, P4, P5, P6>()) { (p0, p1, p2, p3, p4, p5, p6) ->
|
|
217
|
+
enforceType<P0, P1, P2, P3, P4, P5, P6>(p0, p1, p2, p3, p4, p5, p6)
|
|
218
|
+
body(p0, p1, p2, p3, p4, p5, p6)
|
|
219
|
+
}.also {
|
|
220
|
+
asyncFunctionComponent = it
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@JvmName("AsyncFunctionWithPromise")
|
|
225
|
+
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5> AsyncBody(crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: Promise) -> R): AsyncFunction {
|
|
226
|
+
return AsyncFunctionWithPromiseComponent(name, toArgsArray<P0, P1, P2, P3, P4, P5>()) { (p0, p1, p2, p3, p4, p5), promise ->
|
|
227
|
+
enforceType<P0, P1, P2, P3, P4, P5>(p0, p1, p2, p3, p4, p5)
|
|
228
|
+
body(p0, p1, p2, p3, p4, p5, promise)
|
|
145
229
|
}.also {
|
|
146
230
|
asyncFunctionComponent = it
|
|
147
231
|
}
|
|
148
232
|
}
|
|
149
233
|
|
|
150
234
|
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6, reified P7> AsyncBody(crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7) -> R): AsyncFunction {
|
|
151
|
-
return
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
235
|
+
return createAsyncFunctionComponent(name, toArgsArray<P0, P1, P2, P3, P4, P5, P6, P7>()) { (p0, p1, p2, p3, p4, p5, p6, p7) ->
|
|
236
|
+
enforceType<P0, P1, P2, P3, P4, P5, P6, P7>(p0, p1, p2, p3, p4, p5, p6, p7)
|
|
237
|
+
body(p0, p1, p2, p3, p4, p5, p6, p7)
|
|
238
|
+
}.also {
|
|
239
|
+
asyncFunctionComponent = it
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
@JvmName("AsyncFunctionWithPromise")
|
|
244
|
+
inline fun <reified R, reified P0, reified P1, reified P2, reified P3, reified P4, reified P5, reified P6> AsyncBody(crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: Promise) -> R): AsyncFunction {
|
|
245
|
+
return AsyncFunctionWithPromiseComponent(name, toArgsArray<P0, P1, P2, P3, P4, P5, P6>()) { (p0, p1, p2, p3, p4, p5, p6), promise ->
|
|
246
|
+
enforceType<P0, P1, P2, P3, P4, P5, P6>(p0, p1, p2, p3, p4, p5, p6)
|
|
247
|
+
body(p0, p1, p2, p3, p4, p5, p6, promise)
|
|
155
248
|
}.also {
|
|
156
249
|
asyncFunctionComponent = it
|
|
157
250
|
}
|
|
@@ -5,11 +5,80 @@ import expo.modules.kotlin.AppContext
|
|
|
5
5
|
import expo.modules.kotlin.Promise
|
|
6
6
|
import expo.modules.kotlin.exception.CodedException
|
|
7
7
|
import expo.modules.kotlin.types.AnyType
|
|
8
|
+
import expo.modules.kotlin.types.enforceType
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
inline fun <reified T> createAsyncFunctionComponent(
|
|
10
11
|
name: String,
|
|
11
12
|
desiredArgsTypes: Array<AnyType>,
|
|
12
|
-
|
|
13
|
+
noinline body: (args: Array<out Any?>) -> T
|
|
14
|
+
): AsyncFunction {
|
|
15
|
+
if (null is T) {
|
|
16
|
+
return AsyncFunctionComponent<Any?>(name, desiredArgsTypes, body)
|
|
17
|
+
}
|
|
18
|
+
return when (T::class.java) {
|
|
19
|
+
Int::class.java -> {
|
|
20
|
+
enforceType<(Array<out Any?>) -> Int>(body)
|
|
21
|
+
IntAsyncFunctionComponent(name, desiredArgsTypes, body)
|
|
22
|
+
}
|
|
23
|
+
Boolean::class.java -> {
|
|
24
|
+
enforceType<(Array<out Any?>) -> Boolean>(body)
|
|
25
|
+
BoolAsyncFunctionComponent(name, desiredArgsTypes, body)
|
|
26
|
+
}
|
|
27
|
+
Double::class.java -> {
|
|
28
|
+
enforceType<(Array<out Any?>) -> Double>(body)
|
|
29
|
+
DoubleAsyncFunctionComponent(name, desiredArgsTypes, body)
|
|
30
|
+
}
|
|
31
|
+
Float::class.java -> {
|
|
32
|
+
enforceType<(Array<out Any?>) -> Float>(body)
|
|
33
|
+
FloatAsyncFunctionComponent(name, desiredArgsTypes, body)
|
|
34
|
+
}
|
|
35
|
+
String::class.java -> {
|
|
36
|
+
enforceType<(Array<out Any?>) -> String>(body)
|
|
37
|
+
StringAsyncFunctionComponent(name, desiredArgsTypes, body)
|
|
38
|
+
}
|
|
39
|
+
else -> AsyncFunctionComponent<Any?>(name, desiredArgsTypes, body)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
class IntAsyncFunctionComponent(name: String, desiredArgsTypes: Array<AnyType>, body: (args: Array<out Any?>) -> Int) :
|
|
44
|
+
AsyncFunctionComponent<Int>(name, desiredArgsTypes, body) {
|
|
45
|
+
override fun callUserImplementation(args: Array<Any?>, promise: Promise, appContext: AppContext) {
|
|
46
|
+
promise.resolve(body(convertArgs(args, appContext)))
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
class BoolAsyncFunctionComponent(name: String, desiredArgsTypes: Array<AnyType>, body: (args: Array<out Any?>) -> Boolean) :
|
|
51
|
+
AsyncFunctionComponent<Boolean>(name, desiredArgsTypes, body) {
|
|
52
|
+
override fun callUserImplementation(args: Array<Any?>, promise: Promise, appContext: AppContext) {
|
|
53
|
+
promise.resolve(body(convertArgs(args, appContext)))
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
class DoubleAsyncFunctionComponent(name: String, desiredArgsTypes: Array<AnyType>, body: (args: Array<out Any?>) -> Double) :
|
|
58
|
+
AsyncFunctionComponent<Double>(name, desiredArgsTypes, body) {
|
|
59
|
+
override fun callUserImplementation(args: Array<Any?>, promise: Promise, appContext: AppContext) {
|
|
60
|
+
promise.resolve(body(convertArgs(args, appContext)))
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
class FloatAsyncFunctionComponent(name: String, desiredArgsTypes: Array<AnyType>, body: (args: Array<out Any?>) -> Float) :
|
|
65
|
+
AsyncFunctionComponent<Float>(name, desiredArgsTypes, body) {
|
|
66
|
+
override fun callUserImplementation(args: Array<Any?>, promise: Promise, appContext: AppContext) {
|
|
67
|
+
promise.resolve(body(convertArgs(args, appContext)))
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
class StringAsyncFunctionComponent(name: String, desiredArgsTypes: Array<AnyType>, body: (args: Array<out Any?>) -> String) :
|
|
72
|
+
AsyncFunctionComponent<String>(name, desiredArgsTypes, body) {
|
|
73
|
+
override fun callUserImplementation(args: Array<Any?>, promise: Promise, appContext: AppContext) {
|
|
74
|
+
promise.resolve(body(convertArgs(args, appContext)))
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
open class AsyncFunctionComponent<ReturnType>(
|
|
79
|
+
name: String,
|
|
80
|
+
desiredArgsTypes: Array<AnyType>,
|
|
81
|
+
protected val body: (args: Array<out Any?>) -> ReturnType
|
|
13
82
|
) : AsyncFunction(name, desiredArgsTypes) {
|
|
14
83
|
@Throws(CodedException::class)
|
|
15
84
|
override fun callUserImplementation(args: ReadableArray, promise: Promise) {
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
package expo.modules.kotlin.functions
|
|
4
4
|
|
|
5
|
-
import expo.modules.kotlin.
|
|
6
|
-
import kotlin.
|
|
5
|
+
import expo.modules.kotlin.component6
|
|
6
|
+
import expo.modules.kotlin.component7
|
|
7
|
+
import expo.modules.kotlin.component8
|
|
8
|
+
import expo.modules.kotlin.types.enforceType
|
|
9
|
+
import expo.modules.kotlin.types.toArgsArray
|
|
7
10
|
|
|
8
11
|
class FunctionBuilder(@PublishedApi internal val name: String) {
|
|
9
12
|
@PublishedApi
|
|
@@ -13,7 +16,7 @@ class FunctionBuilder(@PublishedApi internal val name: String) {
|
|
|
13
16
|
inline fun Body(
|
|
14
17
|
crossinline body: () -> Any?
|
|
15
18
|
): SyncFunctionComponent {
|
|
16
|
-
return SyncFunctionComponent(name,
|
|
19
|
+
return SyncFunctionComponent(name, emptyArray()) { body() }.also {
|
|
17
20
|
functionComponent = it
|
|
18
21
|
}
|
|
19
22
|
}
|
|
@@ -22,7 +25,7 @@ class FunctionBuilder(@PublishedApi internal val name: String) {
|
|
|
22
25
|
name: String,
|
|
23
26
|
crossinline body: () -> R
|
|
24
27
|
): SyncFunctionComponent {
|
|
25
|
-
return SyncFunctionComponent(name,
|
|
28
|
+
return SyncFunctionComponent(name, emptyArray()) { body() }.also {
|
|
26
29
|
functionComponent = it
|
|
27
30
|
}
|
|
28
31
|
}
|
|
@@ -31,7 +34,10 @@ class FunctionBuilder(@PublishedApi internal val name: String) {
|
|
|
31
34
|
name: String,
|
|
32
35
|
crossinline body: (p0: P0) -> R
|
|
33
36
|
): SyncFunctionComponent {
|
|
34
|
-
return SyncFunctionComponent(name,
|
|
37
|
+
return SyncFunctionComponent(name, toArgsArray<P0>()) { (p0) ->
|
|
38
|
+
enforceType<P0>(p0)
|
|
39
|
+
body(p0)
|
|
40
|
+
}.also {
|
|
35
41
|
functionComponent = it
|
|
36
42
|
}
|
|
37
43
|
}
|
|
@@ -40,7 +46,10 @@ class FunctionBuilder(@PublishedApi internal val name: String) {
|
|
|
40
46
|
name: String,
|
|
41
47
|
crossinline body: (p0: P0, p1: P1) -> R
|
|
42
48
|
): SyncFunctionComponent {
|
|
43
|
-
return SyncFunctionComponent(name,
|
|
49
|
+
return SyncFunctionComponent(name, toArgsArray<P0, P1>()) { (p0, p1) ->
|
|
50
|
+
enforceType<P0, P1>(p0, p1)
|
|
51
|
+
body(p0, p1)
|
|
52
|
+
}.also {
|
|
44
53
|
functionComponent = it
|
|
45
54
|
}
|
|
46
55
|
}
|
|
@@ -49,7 +58,10 @@ class FunctionBuilder(@PublishedApi internal val name: String) {
|
|
|
49
58
|
name: String,
|
|
50
59
|
crossinline body: (p0: P0, p1: P1, p2: P2) -> R
|
|
51
60
|
): SyncFunctionComponent {
|
|
52
|
-
return SyncFunctionComponent(name,
|
|
61
|
+
return SyncFunctionComponent(name, toArgsArray<P0, P1, P2>()) { (p0, p1, p2) ->
|
|
62
|
+
enforceType<P0, P1, P2>(p0, p1, p2)
|
|
63
|
+
body(p0, p1, p2)
|
|
64
|
+
}.also {
|
|
53
65
|
functionComponent = it
|
|
54
66
|
}
|
|
55
67
|
}
|
|
@@ -58,7 +70,10 @@ class FunctionBuilder(@PublishedApi internal val name: String) {
|
|
|
58
70
|
name: String,
|
|
59
71
|
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3) -> R
|
|
60
72
|
): SyncFunctionComponent {
|
|
61
|
-
return SyncFunctionComponent(name,
|
|
73
|
+
return SyncFunctionComponent(name, toArgsArray<P0, P1, P2, P3>()) { (p0, p1, p2, p3) ->
|
|
74
|
+
enforceType<P0, P1, P2, P3>(p0, p1, p2, p3)
|
|
75
|
+
body(p0, p1, p2, p3)
|
|
76
|
+
}.also {
|
|
62
77
|
functionComponent = it
|
|
63
78
|
}
|
|
64
79
|
}
|
|
@@ -67,7 +82,10 @@ class FunctionBuilder(@PublishedApi internal val name: String) {
|
|
|
67
82
|
name: String,
|
|
68
83
|
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) -> R
|
|
69
84
|
): SyncFunctionComponent {
|
|
70
|
-
return SyncFunctionComponent(name,
|
|
85
|
+
return SyncFunctionComponent(name, toArgsArray<P0, P1, P2, P3, P4>()) { (p0, p1, p2, p3, p4) ->
|
|
86
|
+
enforceType<P0, P1, P2, P3, P4>(p0, p1, p2, p3, p4)
|
|
87
|
+
body(p0, p1, p2, p3, p4)
|
|
88
|
+
}.also {
|
|
71
89
|
functionComponent = it
|
|
72
90
|
}
|
|
73
91
|
}
|
|
@@ -76,7 +94,10 @@ class FunctionBuilder(@PublishedApi internal val name: String) {
|
|
|
76
94
|
name: String,
|
|
77
95
|
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) -> R
|
|
78
96
|
): SyncFunctionComponent {
|
|
79
|
-
return SyncFunctionComponent(name,
|
|
97
|
+
return SyncFunctionComponent(name, toArgsArray<P0, P1, P2, P3, P4, P5>()) { (p0, p1, p2, p3, p4, p5) ->
|
|
98
|
+
enforceType<P0, P1, P2, P3, P4, P5>(p0, p1, p2, p3, p4, p5)
|
|
99
|
+
body(p0, p1, p2, p3, p4, p5)
|
|
100
|
+
}.also {
|
|
80
101
|
functionComponent = it
|
|
81
102
|
}
|
|
82
103
|
}
|
|
@@ -85,7 +106,10 @@ class FunctionBuilder(@PublishedApi internal val name: String) {
|
|
|
85
106
|
name: String,
|
|
86
107
|
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6) -> R
|
|
87
108
|
): SyncFunctionComponent {
|
|
88
|
-
return SyncFunctionComponent(name,
|
|
109
|
+
return SyncFunctionComponent(name, toArgsArray<P0, P1, P2, P3, P4, P5, P6>()) { (p0, p1, p2, p3, p4, p5, p6) ->
|
|
110
|
+
enforceType<P0, P1, P2, P3, P4, P5, P6>(p0, p1, p2, p3, p4, p5, p6)
|
|
111
|
+
body(p0, p1, p2, p3, p4, p5, p6)
|
|
112
|
+
}.also {
|
|
89
113
|
functionComponent = it
|
|
90
114
|
}
|
|
91
115
|
}
|
|
@@ -94,7 +118,10 @@ class FunctionBuilder(@PublishedApi internal val name: String) {
|
|
|
94
118
|
name: String,
|
|
95
119
|
crossinline body: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7) -> R
|
|
96
120
|
): SyncFunctionComponent {
|
|
97
|
-
return SyncFunctionComponent(name,
|
|
121
|
+
return SyncFunctionComponent(name, toArgsArray<P0, P1, P2, P3, P4, P5, P6, P7>()) { (p0, p1, p2, p3, p4, p5, p6, p7) ->
|
|
122
|
+
enforceType<P0, P1, P2, P3, P4, P5, P6, P7>(p0, p1, p2, p3, p4, p5, p6, p7)
|
|
123
|
+
body(p0, p1, p2, p3, p4, p5, p6, p7)
|
|
124
|
+
}.also {
|
|
98
125
|
functionComponent = it
|
|
99
126
|
}
|
|
100
127
|
}
|
|
@@ -11,7 +11,7 @@ class SingleType(
|
|
|
11
11
|
/**
|
|
12
12
|
* Types of generic parameters.
|
|
13
13
|
*/
|
|
14
|
-
val parameterTypes: Array<ExpectedType>? = null
|
|
14
|
+
private val parameterTypes: Array<ExpectedType>? = null
|
|
15
15
|
) {
|
|
16
16
|
/**
|
|
17
17
|
* The representation of the type.
|
|
@@ -46,7 +46,7 @@ class ExpectedType(
|
|
|
46
46
|
/**
|
|
47
47
|
* A convenient property to return combined int value of expected types.
|
|
48
48
|
*/
|
|
49
|
-
val innerCombinedTypes: Int = innerPossibleTypes.fold(0) { acc, current -> acc or current.getCppType() }
|
|
49
|
+
private val innerCombinedTypes: Int = innerPossibleTypes.fold(0) { acc, current -> acc or current.getCppType() }
|
|
50
50
|
|
|
51
51
|
// Needed by JNI
|
|
52
52
|
@DoNotStrip
|
|
@@ -11,7 +11,7 @@ interface Destructible {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
@DoNotStrip
|
|
14
|
-
class JNIDeallocator(
|
|
14
|
+
class JNIDeallocator(shouldCreateDestructorThread: Boolean = true) {
|
|
15
15
|
/**
|
|
16
16
|
* A [PhantomReference] queue managed by JVM
|
|
17
17
|
*/
|