one 2.0.0-beta.114.1 → 2.0.0-beta.117.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/One.podspec +3 -3
- package/android/src/main/java/com/margelo/nitro/one/HybridOneFetch.kt +86 -15
- package/android/src/main/java/com/margelo/nitro/one/HybridOneSecureStore.kt +35 -22
- package/android/src/main/java/com/margelo/nitro/one/OneLaunchScreen.kt +41 -0
- package/android/src/main/java/dev/onejs/onenative/OneNativeComposeNodeEvents.kt +3 -3
- package/android/src/main/java/dev/onejs/onenative/OneNativeComposeNodeManager.kt +50 -2
- package/android/src/main/java/dev/onejs/onenative/OneNativeComposeNodeView.kt +351 -32
- package/android/src/main/java/dev/onejs/onenative/OneNativeReservedRegionsProviderManager.kt +9 -3
- package/android/src/main/java/dev/onejs/onenative/OneNativeReservedRegionsProviderView.kt +9 -4
- package/dist/cjs/cli/generateRoutes.cjs +2 -0
- package/dist/cjs/cli/generateRoutes.native.cjs +2 -0
- package/dist/cjs/cli/generateRoutes.native.js +2 -0
- package/dist/cjs/cli/generateRoutes.native.js.map +1 -1
- package/dist/cjs/index.cjs +14 -0
- package/dist/cjs/index.native.cjs +14 -0
- package/dist/cjs/index.native.js +14 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/one.cjs +5 -12
- package/dist/cjs/one.native.cjs +5 -12
- package/dist/cjs/one.native.js +5 -12
- package/dist/cjs/one.native.js.map +1 -1
- package/dist/cjs/platform/adaptive/ReservedRegions.cjs +21 -12
- package/dist/cjs/platform/adaptive/ReservedRegions.native.cjs +10 -9
- package/dist/cjs/platform/adaptive/ReservedRegions.native.js +10 -9
- package/dist/cjs/platform/adaptive/ReservedRegions.native.js.map +1 -1
- package/dist/cjs/platform/adaptive/index.cjs +6 -1
- package/dist/cjs/platform/adaptive/index.native.cjs +14 -3
- package/dist/cjs/platform/adaptive/index.native.js +14 -3
- package/dist/cjs/platform/adaptive/index.native.js.map +1 -1
- package/dist/cjs/platform/adaptive/reservedRegionsContext.cjs +65 -4
- package/dist/cjs/platform/adaptive/reservedRegionsContext.native.cjs +85 -4
- package/dist/cjs/platform/adaptive/reservedRegionsContext.native.js +85 -4
- package/dist/cjs/platform/adaptive/reservedRegionsContext.native.js.map +1 -1
- package/dist/cjs/platform/compose.android.cjs +171 -2
- package/dist/cjs/platform/compose.android.js +171 -2
- package/dist/cjs/platform/compose.android.js.map +1 -1
- package/dist/cjs/platform/compose.cjs +37 -0
- package/dist/cjs/platform/compose.native.cjs +43 -0
- package/dist/cjs/platform/compose.native.js +43 -0
- package/dist/cjs/platform/compose.native.js.map +1 -1
- package/dist/cjs/platform/composeValidation.cjs +89 -3
- package/dist/cjs/platform/composeValidation.native.cjs +130 -5
- package/dist/cjs/platform/composeValidation.native.js +130 -5
- package/dist/cjs/platform/composeValidation.native.js.map +1 -1
- package/dist/cjs/platform/file-system/index.cjs +36 -0
- package/dist/cjs/platform/file-system/index.native.cjs +74 -0
- package/dist/cjs/platform/file-system/index.native.js +76 -0
- package/dist/cjs/platform/file-system/index.native.js.map +1 -0
- package/dist/cjs/platform/index.cjs +11 -1
- package/dist/cjs/platform/index.native.cjs +11 -1
- package/dist/cjs/platform/index.native.js +11 -1
- package/dist/cjs/platform/index.native.js.map +1 -1
- package/dist/cjs/platform/local-authentication/index.cjs +30 -0
- package/dist/cjs/platform/local-authentication/index.native.cjs +50 -0
- package/dist/cjs/platform/local-authentication/index.native.js +52 -0
- package/dist/cjs/platform/local-authentication/index.native.js.map +1 -0
- package/dist/cjs/platform/location/index.cjs +34 -0
- package/dist/cjs/platform/location/index.native.cjs +66 -0
- package/dist/cjs/platform/location/index.native.js +68 -0
- package/dist/cjs/platform/location/index.native.js.map +1 -0
- package/dist/cjs/platform/secure-store/index.cjs +17 -1
- package/dist/cjs/platform/secure-store/index.native.cjs +30 -1
- package/dist/cjs/platform/secure-store/index.native.js +30 -1
- package/dist/cjs/platform/secure-store/index.native.js.map +1 -1
- package/dist/cjs/platform/specs/OneFileSystem.nitro.cjs +16 -0
- package/dist/cjs/platform/specs/OneFileSystem.nitro.native.cjs +18 -0
- package/dist/cjs/platform/specs/OneFileSystem.nitro.native.js +20 -0
- package/dist/cjs/platform/specs/OneFileSystem.nitro.native.js.map +1 -0
- package/dist/cjs/platform/specs/OneLocalAuthentication.nitro.cjs +16 -0
- package/dist/cjs/platform/specs/OneLocalAuthentication.nitro.native.cjs +18 -0
- package/dist/cjs/platform/specs/OneLocalAuthentication.nitro.native.js +20 -0
- package/dist/cjs/platform/specs/OneLocalAuthentication.nitro.native.js.map +1 -0
- package/dist/cjs/platform/specs/OneLocation.nitro.cjs +16 -0
- package/dist/cjs/platform/specs/OneLocation.nitro.native.cjs +18 -0
- package/dist/cjs/platform/specs/OneLocation.nitro.native.js +20 -0
- package/dist/cjs/platform/specs/OneLocation.nitro.native.js.map +1 -0
- package/dist/cjs/platform/specs/OneNativeComposeNodeNativeComponent.cjs +15 -3
- package/dist/cjs/platform/specs/OneNativeComposeNodeNativeComponent.native.cjs +15 -3
- package/dist/cjs/platform/specs/OneNativeComposeNodeNativeComponent.native.js +15 -3
- package/dist/cjs/platform/specs/OneNativeComposeNodeNativeComponent.native.js.map +2 -2
- package/dist/cjs/platform/specs/OneNativeReservedRegionsProviderNativeComponent.native.js.map +2 -2
- package/dist/esm/cli/generateRoutes.mjs +2 -0
- package/dist/esm/cli/generateRoutes.mjs.map +1 -1
- package/dist/esm/cli/generateRoutes.native.js +2 -0
- package/dist/esm/cli/generateRoutes.native.js.map +1 -1
- package/dist/esm/index.js +3 -2
- package/dist/esm/index.mjs +3 -2
- package/dist/esm/index.native.js +3 -2
- package/dist/esm/one.mjs +7 -14
- package/dist/esm/one.mjs.map +1 -1
- package/dist/esm/one.native.js +7 -14
- package/dist/esm/one.native.js.map +1 -1
- package/dist/esm/platform/adaptive/ReservedRegions.mjs +22 -8
- package/dist/esm/platform/adaptive/ReservedRegions.mjs.map +1 -1
- package/dist/esm/platform/adaptive/ReservedRegions.native.js +11 -5
- package/dist/esm/platform/adaptive/ReservedRegions.native.js.map +1 -1
- package/dist/esm/platform/adaptive/index.mjs +2 -1
- package/dist/esm/platform/adaptive/index.mjs.map +1 -1
- package/dist/esm/platform/adaptive/index.native.js +10 -3
- package/dist/esm/platform/adaptive/index.native.js.map +1 -1
- package/dist/esm/platform/adaptive/reservedRegionsContext.mjs +62 -4
- package/dist/esm/platform/adaptive/reservedRegionsContext.mjs.map +1 -1
- package/dist/esm/platform/adaptive/reservedRegionsContext.native.js +82 -4
- package/dist/esm/platform/adaptive/reservedRegionsContext.native.js.map +1 -1
- package/dist/esm/platform/compose.android.js +172 -3
- package/dist/esm/platform/compose.android.js.map +1 -1
- package/dist/esm/platform/compose.mjs +37 -0
- package/dist/esm/platform/compose.mjs.map +1 -1
- package/dist/esm/platform/compose.native.js +43 -0
- package/dist/esm/platform/compose.native.js.map +1 -1
- package/dist/esm/platform/composeValidation.mjs +85 -4
- package/dist/esm/platform/composeValidation.mjs.map +1 -1
- package/dist/esm/platform/composeValidation.native.js +126 -6
- package/dist/esm/platform/composeValidation.native.js.map +1 -1
- package/dist/esm/platform/file-system/index.mjs +16 -0
- package/dist/esm/platform/file-system/index.mjs.map +1 -0
- package/dist/esm/platform/file-system/index.native.js +53 -0
- package/dist/esm/platform/file-system/index.native.js.map +1 -0
- package/dist/esm/platform/index.mjs +5 -2
- package/dist/esm/platform/index.mjs.map +1 -1
- package/dist/esm/platform/index.native.js +5 -2
- package/dist/esm/platform/index.native.js.map +1 -1
- package/dist/esm/platform/local-authentication/index.mjs +10 -0
- package/dist/esm/platform/local-authentication/index.mjs.map +1 -0
- package/dist/esm/platform/local-authentication/index.native.js +29 -0
- package/dist/esm/platform/local-authentication/index.native.js.map +1 -0
- package/dist/esm/platform/location/index.mjs +14 -0
- package/dist/esm/platform/location/index.mjs.map +1 -0
- package/dist/esm/platform/location/index.native.js +45 -0
- package/dist/esm/platform/location/index.native.js.map +1 -0
- package/dist/esm/platform/secure-store/index.mjs +17 -1
- package/dist/esm/platform/secure-store/index.mjs.map +1 -1
- package/dist/esm/platform/secure-store/index.native.js +30 -1
- package/dist/esm/platform/secure-store/index.native.js.map +1 -1
- package/dist/esm/platform/specs/OneFileSystem.nitro.mjs +0 -0
- package/dist/esm/platform/specs/OneFileSystem.nitro.native.js +0 -0
- package/dist/esm/platform/specs/OneLocalAuthentication.nitro.mjs +0 -0
- package/dist/esm/platform/specs/OneLocalAuthentication.nitro.native.js +0 -0
- package/dist/esm/platform/specs/OneLocation.nitro.mjs +0 -0
- package/dist/esm/platform/specs/OneLocation.nitro.native.js +0 -0
- package/dist/esm/platform/specs/OneNativeComposeNodeNativeComponent.mjs +15 -3
- package/dist/esm/platform/specs/OneNativeComposeNodeNativeComponent.mjs.map +2 -2
- package/dist/esm/platform/specs/OneNativeComposeNodeNativeComponent.native.js +15 -3
- package/dist/esm/platform/specs/OneNativeComposeNodeNativeComponent.native.js.map +2 -2
- package/dist/esm/platform/specs/OneNativeReservedRegionsProviderNativeComponent.mjs.map +2 -2
- package/dist/esm/platform/specs/OneNativeReservedRegionsProviderNativeComponent.native.js.map +2 -2
- package/ios/Nitro/HybridOneAdaptive.swift +139 -47
- package/ios/Nitro/HybridOneFetch.swift +85 -15
- package/ios/Nitro/HybridOneFileSystem.swift +180 -0
- package/ios/Nitro/HybridOneLocalAuthentication.swift +71 -0
- package/ios/Nitro/HybridOneLocation.swift +317 -0
- package/ios/Nitro/HybridOneSecureStore.swift +12 -0
- package/ios/Nitro/OneLaunchScreen.h +11 -0
- package/ios/Nitro/OneLaunchScreen.m +29 -0
- package/ios/OneFetchBlobStoreModule.mm +46 -4
- package/ios/OneNativeReservedRegionsProviderComponentView.mm +9 -4
- package/nitrogen/generated/android/One+autolinking.cmake +3 -0
- package/nitrogen/generated/android/c++/JHybridOneSecureStoreSpec.cpp +13 -0
- package/nitrogen/generated/android/c++/JHybridOneSecureStoreSpec.hpp +3 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/HybridOneSecureStoreSpec.kt +12 -0
- package/nitrogen/generated/ios/One-Swift-Cxx-Bridge.cpp +144 -45
- package/nitrogen/generated/ios/One-Swift-Cxx-Bridge.hpp +525 -167
- package/nitrogen/generated/ios/One-Swift-Cxx-Umbrella.hpp +42 -0
- package/nitrogen/generated/ios/OneAutolinking.mm +24 -0
- package/nitrogen/generated/ios/OneAutolinking.swift +67 -31
- package/nitrogen/generated/ios/c++/HybridOneFileSystemSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridOneFileSystemSpecSwift.hpp +152 -0
- package/nitrogen/generated/ios/c++/HybridOneLocalAuthenticationSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridOneLocalAuthenticationSpecSwift.hpp +97 -0
- package/nitrogen/generated/ios/c++/HybridOneLocationSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridOneLocationSpecSwift.hpp +134 -0
- package/nitrogen/generated/ios/c++/HybridOneSecureStoreSpecSwift.hpp +20 -0
- package/nitrogen/generated/ios/swift/FileDirectories.swift +44 -0
- package/nitrogen/generated/ios/swift/FileEncoding.swift +40 -0
- package/nitrogen/generated/ios/swift/FileEntry.swift +39 -0
- package/nitrogen/generated/ios/swift/FileInfo.swift +75 -0
- package/nitrogen/generated/ios/swift/Func_void_FileInfo.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_LocationPermissionStatus.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_LocationPosition.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_FileEntry_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_LocationPlace_.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridOneFileSystemSpec.swift +62 -0
- package/nitrogen/generated/ios/swift/HybridOneFileSystemSpec_cxx.swift +277 -0
- package/nitrogen/generated/ios/swift/HybridOneLocalAuthenticationSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridOneLocalAuthenticationSpec_cxx.swift +157 -0
- package/nitrogen/generated/ios/swift/HybridOneLocationSpec.swift +60 -0
- package/nitrogen/generated/ios/swift/HybridOneLocationSpec_cxx.swift +251 -0
- package/nitrogen/generated/ios/swift/HybridOneSecureStoreSpec.swift +3 -0
- package/nitrogen/generated/ios/swift/HybridOneSecureStoreSpec_cxx.swift +40 -0
- package/nitrogen/generated/ios/swift/LocalAuthenticationStatus.swift +52 -0
- package/nitrogen/generated/ios/swift/LocalBiometryType.swift +48 -0
- package/nitrogen/generated/ios/swift/LocationPermissionStatus.swift +52 -0
- package/nitrogen/generated/ios/swift/LocationPlace.swift +178 -0
- package/nitrogen/generated/ios/swift/LocationPosition.swift +64 -0
- package/nitrogen/generated/shared/c++/FileDirectories.hpp +95 -0
- package/nitrogen/generated/shared/c++/FileEncoding.hpp +76 -0
- package/nitrogen/generated/shared/c++/FileEntry.hpp +91 -0
- package/nitrogen/generated/shared/c++/FileInfo.hpp +100 -0
- package/nitrogen/generated/shared/c++/HybridOneFileSystemSpec.cpp +28 -0
- package/nitrogen/generated/shared/c++/HybridOneFileSystemSpec.hpp +82 -0
- package/nitrogen/generated/shared/c++/HybridOneLocalAuthenticationSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridOneLocalAuthenticationSpec.hpp +66 -0
- package/nitrogen/generated/shared/c++/HybridOneLocationSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridOneLocationSpec.hpp +78 -0
- package/nitrogen/generated/shared/c++/HybridOneSecureStoreSpec.cpp +3 -0
- package/nitrogen/generated/shared/c++/HybridOneSecureStoreSpec.hpp +3 -0
- package/nitrogen/generated/shared/c++/LocalAuthenticationStatus.hpp +93 -0
- package/nitrogen/generated/shared/c++/LocalBiometryType.hpp +84 -0
- package/nitrogen/generated/shared/c++/LocationPermissionStatus.hpp +88 -0
- package/nitrogen/generated/shared/c++/LocationPlace.hpp +120 -0
- package/nitrogen/generated/shared/c++/LocationPosition.hpp +111 -0
- package/package.json +10 -10
- package/schema.json +6 -0
- package/src/cli/generateRoutes.ts +2 -0
- package/src/index.ts +32 -1
- package/src/nativeCoverage.test.ts +41 -13
- package/src/one.test.ts +34 -2
- package/src/one.ts +9 -33
- package/src/platform/README.md +13 -1
- package/src/platform/adaptive/ReservedRegions.native.tsx +4 -5
- package/src/platform/adaptive/ReservedRegions.tsx +15 -8
- package/src/platform/adaptive/index.native.ts +21 -3
- package/src/platform/adaptive/index.ts +6 -0
- package/src/platform/adaptive/reservedRegionsContext.ts +56 -4
- package/src/platform/adaptive/types.ts +9 -1
- package/src/platform/compose.android.tsx +190 -3
- package/src/platform/compose.tsx +54 -0
- package/src/platform/composeTypes.ts +75 -0
- package/src/platform/composeValidation.ts +126 -15
- package/src/platform/file-system/index.native.ts +71 -0
- package/src/platform/file-system/index.ts +24 -0
- package/src/platform/index.native.ts +11 -0
- package/src/platform/index.ts +11 -0
- package/src/platform/local-authentication/index.native.ts +33 -0
- package/src/platform/local-authentication/index.ts +12 -0
- package/src/platform/location/index.native.ts +63 -0
- package/src/platform/location/index.ts +25 -0
- package/src/platform/secure-store/index.native.ts +38 -1
- package/src/platform/secure-store/index.ts +24 -1
- package/src/platform/specs/OneAdaptive.nitro.ts +1 -1
- package/src/platform/specs/OneFileSystem.nitro.ts +35 -0
- package/src/platform/specs/OneLocalAuthentication.nitro.ts +16 -0
- package/src/platform/specs/OneLocation.nitro.ts +44 -0
- package/src/platform/specs/OneNativeComposeNodeNativeComponent.ts +44 -1
- package/src/platform/specs/OneNativeReservedRegionsProviderNativeComponent.ts +2 -0
- package/src/platform/specs/OneSecureStore.nitro.ts +5 -1
- package/types/cli/generateRoutes.d.ts.map +1 -1
- package/types/index.d.ts +3 -1
- package/types/index.d.ts.map +1 -1
- package/types/one.d.ts +5 -12
- package/types/one.d.ts.map +1 -1
- package/types/platform/adaptive/ReservedRegions.d.ts +1 -2
- package/types/platform/adaptive/ReservedRegions.d.ts.map +1 -1
- package/types/platform/adaptive/ReservedRegions.native.d.ts +0 -1
- package/types/platform/adaptive/ReservedRegions.native.d.ts.map +1 -1
- package/types/platform/adaptive/index.d.ts +1 -0
- package/types/platform/adaptive/index.d.ts.map +1 -1
- package/types/platform/adaptive/index.native.d.ts +4 -1
- package/types/platform/adaptive/index.native.d.ts.map +1 -1
- package/types/platform/adaptive/reservedRegionsContext.d.ts +18 -1
- package/types/platform/adaptive/reservedRegionsContext.d.ts.map +1 -1
- package/types/platform/adaptive/types.d.ts +8 -1
- package/types/platform/adaptive/types.d.ts.map +1 -1
- package/types/platform/compose.android.d.ts +28 -1
- package/types/platform/compose.android.d.ts.map +1 -1
- package/types/platform/compose.d.ts +28 -1
- package/types/platform/compose.d.ts.map +1 -1
- package/types/platform/composeTypes.d.ts +63 -1
- package/types/platform/composeTypes.d.ts.map +1 -1
- package/types/platform/composeValidation.d.ts +6 -1
- package/types/platform/composeValidation.d.ts.map +1 -1
- package/types/platform/file-system/index.d.ts +13 -0
- package/types/platform/file-system/index.d.ts.map +1 -0
- package/types/platform/file-system/index.native.d.ts +21 -0
- package/types/platform/file-system/index.native.d.ts.map +1 -0
- package/types/platform/index.d.ts +8 -2
- package/types/platform/index.d.ts.map +1 -1
- package/types/platform/index.native.d.ts +8 -2
- package/types/platform/index.native.d.ts.map +1 -1
- package/types/platform/local-authentication/index.d.ts +7 -0
- package/types/platform/local-authentication/index.d.ts.map +1 -0
- package/types/platform/local-authentication/index.native.d.ts +9 -0
- package/types/platform/local-authentication/index.native.d.ts.map +1 -0
- package/types/platform/location/index.d.ts +14 -0
- package/types/platform/location/index.d.ts.map +1 -0
- package/types/platform/location/index.native.d.ts +20 -0
- package/types/platform/location/index.native.d.ts.map +1 -0
- package/types/platform/secure-store/index.d.ts +6 -0
- package/types/platform/secure-store/index.d.ts.map +1 -1
- package/types/platform/secure-store/index.native.d.ts +6 -0
- package/types/platform/secure-store/index.native.d.ts.map +1 -1
- package/types/platform/specs/OneFileSystem.nitro.d.ts +33 -0
- package/types/platform/specs/OneFileSystem.nitro.d.ts.map +1 -0
- package/types/platform/specs/OneLocalAuthentication.nitro.d.ts +14 -0
- package/types/platform/specs/OneLocalAuthentication.nitro.d.ts.map +1 -0
- package/types/platform/specs/OneLocation.nitro.d.ts +35 -0
- package/types/platform/specs/OneLocation.nitro.d.ts.map +1 -0
- package/types/platform/specs/OneNativeComposeNodeNativeComponent.d.ts +44 -1
- package/types/platform/specs/OneNativeComposeNodeNativeComponent.d.ts.map +1 -1
- package/types/platform/specs/OneNativeReservedRegionsProviderNativeComponent.d.ts +2 -0
- package/types/platform/specs/OneNativeReservedRegionsProviderNativeComponent.d.ts.map +1 -1
- package/types/platform/specs/OneSecureStore.nitro.d.ts +3 -0
- package/types/platform/specs/OneSecureStore.nitro.d.ts.map +1 -1
package/One.podspec
CHANGED
|
@@ -33,9 +33,9 @@ Pod::Spec.new do |s|
|
|
|
33
33
|
|
|
34
34
|
s.exclude_files = 'ios/Tests/**/*'
|
|
35
35
|
s.source_files = 'ios/**/*.{h,m,swift,mm,cpp}', 'cpp/**/*.{h,cpp}'
|
|
36
|
-
# the updates launcher
|
|
37
|
-
# appends its own public headers after
|
|
38
|
-
s.public_header_files = 'ios/Nitro/OneUpdatesLauncherBridge.h'
|
|
36
|
+
# the updates launcher and launch screen entries the app's bridging header
|
|
37
|
+
# imports. nitrogen appends its own public headers after these.
|
|
38
|
+
s.public_header_files = 'ios/Nitro/OneUpdatesLauncherBridge.h', 'ios/Nitro/OneLaunchScreen.h'
|
|
39
39
|
|
|
40
40
|
# nitro hybrid objects: nitrogen generates the specs and bridges from
|
|
41
41
|
# src/specs/*.nitro.ts into nitrogen/generated (see README).
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package com.margelo.nitro.one
|
|
2
2
|
|
|
3
3
|
import android.net.Uri
|
|
4
|
+
import android.util.Base64
|
|
4
5
|
import android.webkit.MimeTypeMap
|
|
5
6
|
import com.facebook.react.modules.blob.BlobModule
|
|
6
7
|
import com.facebook.react.modules.network.CookieJarContainer
|
|
@@ -8,8 +9,14 @@ import com.facebook.react.modules.network.ForwardingCookieHandler
|
|
|
8
9
|
import com.facebook.react.modules.network.OkHttpClientProvider
|
|
9
10
|
import com.margelo.nitro.NitroModules
|
|
10
11
|
import com.margelo.nitro.core.ArrayBuffer
|
|
12
|
+
import java.io.ByteArrayInputStream
|
|
13
|
+
import java.io.File
|
|
14
|
+
import java.io.FileInputStream
|
|
15
|
+
import java.io.FileOutputStream
|
|
11
16
|
import java.io.IOException
|
|
12
17
|
import java.io.InputStream
|
|
18
|
+
import java.net.URL
|
|
19
|
+
import java.nio.channels.Channels
|
|
13
20
|
import java.util.concurrent.ConcurrentHashMap
|
|
14
21
|
import java.util.concurrent.Executors
|
|
15
22
|
import okhttp3.Call
|
|
@@ -27,6 +34,7 @@ import okhttp3.RequestBody.Companion.toRequestBody
|
|
|
27
34
|
import okhttp3.Response
|
|
28
35
|
import okhttp3.internal.http.HttpMethod
|
|
29
36
|
import okio.BufferedSink
|
|
37
|
+
import okio.source
|
|
30
38
|
|
|
31
39
|
// the global fetch on native, over an OkHttp client built the way react
|
|
32
40
|
// native's NetworkingModule builds its own: from OkHttpClientProvider, so an
|
|
@@ -67,6 +75,26 @@ class HybridOneFetch : HybridOneFetchSpec() {
|
|
|
67
75
|
readLocal(id, request.url, onResponse, onChunk, onComplete, onError)
|
|
68
76
|
return
|
|
69
77
|
}
|
|
78
|
+
if (request.form?.any { it.uri != null } == true) {
|
|
79
|
+
// react native opens every { uri } part before it sends, downloading
|
|
80
|
+
// an http one, so that runs off the js thread; a cancel meanwhile
|
|
81
|
+
// leaves no entry for send to replace
|
|
82
|
+
active[id] = {}
|
|
83
|
+
local.execute { send(id, request, true, onResponse, onChunk, onComplete, onError) }
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
send(id, request, false, onResponse, onChunk, onComplete, onError)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private fun send(
|
|
90
|
+
id: Double,
|
|
91
|
+
request: FetchNativeRequest,
|
|
92
|
+
pending: Boolean,
|
|
93
|
+
onResponse: (response: FetchNativeResponse) -> Unit,
|
|
94
|
+
onChunk: (chunk: ArrayBuffer) -> Unit,
|
|
95
|
+
onComplete: () -> Unit,
|
|
96
|
+
onError: (message: String) -> Unit
|
|
97
|
+
) {
|
|
70
98
|
val built = try {
|
|
71
99
|
val builder = Request.Builder().url(request.url)
|
|
72
100
|
for (header in request.headers) builder.addHeader(header.name, header.value)
|
|
@@ -75,12 +103,17 @@ class HybridOneFetch : HybridOneFetchSpec() {
|
|
|
75
103
|
?.value?.toMediaTypeOrNull()
|
|
76
104
|
builder.method(request.method, body(request, type))
|
|
77
105
|
builder.build()
|
|
78
|
-
} catch (error:
|
|
79
|
-
onError(error.message ?: "invalid request")
|
|
106
|
+
} catch (error: Exception) {
|
|
107
|
+
if (!pending || active.remove(id) != null) onError(error.message ?: "invalid request")
|
|
80
108
|
return
|
|
81
109
|
}
|
|
82
110
|
val call = (if (request.omitCredentials) clientWithoutCookies else client).newCall(built)
|
|
83
|
-
|
|
111
|
+
val cancel = { call.cancel() }
|
|
112
|
+
if (pending) {
|
|
113
|
+
if (active.replace(id, cancel) == null) return
|
|
114
|
+
} else {
|
|
115
|
+
active[id] = cancel
|
|
116
|
+
}
|
|
84
117
|
call.enqueue(object : Callback {
|
|
85
118
|
override fun onFailure(call: Call, e: IOException) {
|
|
86
119
|
if (active.remove(id) != null) onError(e.message ?: e.javaClass.simpleName)
|
|
@@ -115,10 +148,11 @@ class HybridOneFetch : HybridOneFetchSpec() {
|
|
|
115
148
|
context.getNativeModule(BlobModule::class.java)
|
|
116
149
|
?: throw IllegalStateException("fetch: react native's BlobModule is not loaded")
|
|
117
150
|
|
|
118
|
-
// the request body. js-owned bytes are copied now, during the call;
|
|
119
|
-
//
|
|
120
|
-
// length is known up front where react
|
|
121
|
-
// content-length rather than going out
|
|
151
|
+
// the request body. js-owned bytes are copied now, during the call; blobs
|
|
152
|
+
// are read on the network thread, and { uri } parts open before sending,
|
|
153
|
+
// as react native opens them. every length is known up front where react
|
|
154
|
+
// native's was, so uploads carry a content-length rather than going out
|
|
155
|
+
// chunked.
|
|
122
156
|
private fun body(request: FetchNativeRequest, type: MediaType?): RequestBody? {
|
|
123
157
|
request.body?.let { return it.toByteArray().toRequestBody(type) }
|
|
124
158
|
request.blob?.let { return blobBody(it, type) }
|
|
@@ -137,13 +171,43 @@ class HybridOneFetch : HybridOneFetchSpec() {
|
|
|
137
171
|
}
|
|
138
172
|
}
|
|
139
173
|
|
|
140
|
-
|
|
174
|
+
// react native's RequestBodyUtil.getFileInputStream, which is internal to
|
|
175
|
+
// react native: an http(s) uri downloads to a cache file first, a data: uri
|
|
176
|
+
// decodes its base64, anything else opens through the content resolver
|
|
177
|
+
private fun partStream(uri: String): InputStream {
|
|
178
|
+
val parsed = Uri.parse(uri)
|
|
179
|
+
if (parsed.scheme?.startsWith("http") == true) {
|
|
180
|
+
val file = File.createTempFile("RequestBodyUtil", "temp", context.applicationContext.cacheDir)
|
|
181
|
+
file.deleteOnExit()
|
|
182
|
+
FileOutputStream(file).use { output ->
|
|
183
|
+
URL(uri).openStream().use { input ->
|
|
184
|
+
Channels.newChannel(input).use { channel ->
|
|
185
|
+
output.channel.transferFrom(channel, 0, Long.MAX_VALUE)
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return FileInputStream(file)
|
|
190
|
+
}
|
|
191
|
+
if (uri.startsWith("data:")) {
|
|
192
|
+
return ByteArrayInputStream(Base64.decode(uri.split(",")[1], Base64.DEFAULT))
|
|
193
|
+
}
|
|
194
|
+
return context.contentResolver.openInputStream(parsed)
|
|
195
|
+
?: throw IOException("Could not retrieve file for uri $uri")
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// react native's RequestBodyUtil.create: the stream's available bytes are
|
|
199
|
+
// the part's length
|
|
200
|
+
private fun streamBody(type: MediaType, input: InputStream) = object : RequestBody() {
|
|
141
201
|
override fun contentType() = type
|
|
142
202
|
override fun contentLength() =
|
|
143
|
-
|
|
144
|
-
|
|
203
|
+
try {
|
|
204
|
+
input.available().toLong()
|
|
205
|
+
} catch (e: IOException) {
|
|
206
|
+
0L
|
|
207
|
+
}
|
|
208
|
+
override fun isOneShot() = true
|
|
145
209
|
override fun writeTo(sink: BufferedSink) {
|
|
146
|
-
|
|
210
|
+
input.use { sink.writeAll(it.source()) }
|
|
147
211
|
}
|
|
148
212
|
}
|
|
149
213
|
|
|
@@ -167,14 +231,21 @@ class HybridOneFetch : HybridOneFetchSpec() {
|
|
|
167
231
|
builder.addPart(Headers.headersOf("Content-Disposition", disposition), value.toRequestBody())
|
|
168
232
|
continue
|
|
169
233
|
}
|
|
170
|
-
val filename = part.filename
|
|
234
|
+
val filename = part.filename
|
|
171
235
|
if (filename != null) disposition += "; filename=\"${escape(filename)}\""
|
|
172
|
-
val type = (part.type ?: "application/octet-stream").toMediaTypeOrNull()
|
|
173
236
|
val uri = part.uri
|
|
174
237
|
val blob = part.blob
|
|
175
238
|
val body = when {
|
|
176
|
-
uri != null ->
|
|
177
|
-
|
|
239
|
+
uri != null -> streamBody(
|
|
240
|
+
part.type?.toMediaTypeOrNull()
|
|
241
|
+
?: throw IOException("Binary FormData part needs a content-type header."),
|
|
242
|
+
try {
|
|
243
|
+
partStream(uri)
|
|
244
|
+
} catch (error: Exception) {
|
|
245
|
+
throw IOException("Could not retrieve file for uri $uri", error)
|
|
246
|
+
}
|
|
247
|
+
)
|
|
248
|
+
blob != null -> blobBody(blob, (part.type ?: "application/octet-stream").toMediaTypeOrNull())
|
|
178
249
|
else -> throw IOException("fetch: FormData part ${part.name} has no value")
|
|
179
250
|
}
|
|
180
251
|
builder.addPart(Headers.headersOf("Content-Disposition", disposition), body)
|
|
@@ -120,35 +120,48 @@ class HybridOneSecureStore : HybridOneSecureStoreSpec() {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
// any platform failure rejects with the stable code for its verb.
|
|
124
|
-
private fun <T> guarded(code: String, verb: String, body: () -> T):
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
throw OneNativeError(code, "SecureStore.$verb: ${e.message}")
|
|
130
|
-
}
|
|
123
|
+
// any platform failure throws or rejects with the stable code for its verb.
|
|
124
|
+
private fun <T> guarded(code: String, verb: String, body: () -> T): T =
|
|
125
|
+
try {
|
|
126
|
+
body()
|
|
127
|
+
} catch (e: Exception) {
|
|
128
|
+
throw OneNativeError(code, "SecureStore.$verb: ${e.message}")
|
|
131
129
|
}
|
|
132
130
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
131
|
+
private fun read(key: String): String? {
|
|
132
|
+
val blob = prefs().getString(key, null) ?: return null
|
|
133
|
+
return decrypt(blob)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private fun write(key: String, value: String) {
|
|
137
|
+
if (!prefs().edit().putString(key, encrypt(value)).commit()) {
|
|
138
|
+
throw SecureStoreException("the write could not be committed to disk")
|
|
137
139
|
}
|
|
140
|
+
}
|
|
138
141
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
throw SecureStoreException("the write could not be committed to disk")
|
|
143
|
-
}
|
|
142
|
+
private fun remove(key: String) {
|
|
143
|
+
if (!prefs().edit().remove(key).commit()) {
|
|
144
|
+
throw SecureStoreException("the delete could not be committed to disk")
|
|
144
145
|
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
override fun getItem(key: String): Promise<String?> =
|
|
149
|
+
Promise.async { guarded("E_SECURE_STORE_GET", "getItem") { read(key) } }
|
|
150
|
+
|
|
151
|
+
override fun setItem(key: String, value: String): Promise<Unit> =
|
|
152
|
+
Promise.async { guarded("E_SECURE_STORE_SET", "setItem") { write(key, value) } }
|
|
145
153
|
|
|
146
154
|
override fun deleteItem(key: String): Promise<Unit> =
|
|
147
|
-
guarded("E_SECURE_STORE_DELETE", "deleteItem") {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
155
|
+
Promise.async { guarded("E_SECURE_STORE_DELETE", "deleteItem") { remove(key) } }
|
|
156
|
+
|
|
157
|
+
override fun getItemSync(key: String): String? =
|
|
158
|
+
guarded("E_SECURE_STORE_GET", "getItemSync") { read(key) }
|
|
159
|
+
|
|
160
|
+
override fun setItemSync(key: String, value: String) =
|
|
161
|
+
guarded("E_SECURE_STORE_SET", "setItemSync") { write(key, value) }
|
|
162
|
+
|
|
163
|
+
override fun deleteItemSync(key: String) =
|
|
164
|
+
guarded("E_SECURE_STORE_DELETE", "deleteItemSync") { remove(key) }
|
|
152
165
|
|
|
153
166
|
private class SecureStoreException(message: String) : Exception(message)
|
|
154
167
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
package com.margelo.nitro.one
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.view.View
|
|
5
|
+
import android.view.ViewTreeObserver
|
|
6
|
+
import com.facebook.react.bridge.ReactMarker
|
|
7
|
+
import com.facebook.react.bridge.ReactMarkerConstants
|
|
8
|
+
|
|
9
|
+
// the prebuilt MainActivity calls this right after super.onCreate. the
|
|
10
|
+
// activity's content skips drawing until react native's root view logs its
|
|
11
|
+
// first content, which is android's documented way to keep the splash on
|
|
12
|
+
// screen: the android 12+ system splash, or the launch theme's window
|
|
13
|
+
// background below that, never gives way to an empty root.
|
|
14
|
+
object OneLaunchScreen {
|
|
15
|
+
@JvmStatic
|
|
16
|
+
fun hold(activity: Activity) {
|
|
17
|
+
val content = activity.findViewById<View>(android.R.id.content)
|
|
18
|
+
var appeared = false
|
|
19
|
+
lateinit var marker: ReactMarker.MarkerListener
|
|
20
|
+
marker = ReactMarker.MarkerListener { name, _, _ ->
|
|
21
|
+
if (name != ReactMarkerConstants.CONTENT_APPEARED) return@MarkerListener
|
|
22
|
+
// markers can log off the main thread; the flag and the redraw
|
|
23
|
+
// both land on it.
|
|
24
|
+
content.post {
|
|
25
|
+
ReactMarker.removeListener(marker)
|
|
26
|
+
appeared = true
|
|
27
|
+
content.invalidate()
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
ReactMarker.addListener(marker)
|
|
31
|
+
content.viewTreeObserver.addOnPreDrawListener(
|
|
32
|
+
object : ViewTreeObserver.OnPreDrawListener {
|
|
33
|
+
override fun onPreDraw(): Boolean {
|
|
34
|
+
if (!appeared) return false
|
|
35
|
+
content.viewTreeObserver.removeOnPreDrawListener(this)
|
|
36
|
+
return true
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -121,14 +121,14 @@ internal class OneNativeComposeNodeDialogDismissEvent(
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
internal class
|
|
124
|
+
internal class OneNativeComposeNodeBooleanValueChangeEvent(
|
|
125
125
|
surfaceId: Int,
|
|
126
126
|
viewTag: Int,
|
|
127
127
|
private val value: Boolean,
|
|
128
128
|
private val eventCount: Int,
|
|
129
129
|
private val revision: Int,
|
|
130
|
-
) : Event<
|
|
131
|
-
override fun getEventName(): String = "
|
|
130
|
+
) : Event<OneNativeComposeNodeBooleanValueChangeEvent>(surfaceId, viewTag) {
|
|
131
|
+
override fun getEventName(): String = "topNativeComposeNodeBooleanValueChange"
|
|
132
132
|
|
|
133
133
|
override fun canCoalesce(): Boolean = false
|
|
134
134
|
|
|
@@ -81,8 +81,8 @@ class OneNativeComposeNodeManager :
|
|
|
81
81
|
super.getExportedCustomDirectEventTypeConstants()?.toMutableMap() ?: mutableMapOf()
|
|
82
82
|
events["topNativeComposeNodeButtonPress"] =
|
|
83
83
|
mapOf("registrationName" to "onNativeComposeNodeButtonPress")
|
|
84
|
-
events["
|
|
85
|
-
mapOf("registrationName" to "
|
|
84
|
+
events["topNativeComposeNodeBooleanValueChange"] =
|
|
85
|
+
mapOf("registrationName" to "onNativeComposeNodeBooleanValueChange")
|
|
86
86
|
events["topNativeComposeNodeTextValueChange"] =
|
|
87
87
|
mapOf("registrationName" to "onNativeComposeNodeTextValueChange")
|
|
88
88
|
events["topNativeComposeNodeTextFieldFocusChange"] =
|
|
@@ -154,6 +154,54 @@ class OneNativeComposeNodeManager :
|
|
|
154
154
|
view.stageValue(value)
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
override fun setNativeClickable(view: OneNativeComposeNodeView, value: Boolean) {
|
|
158
|
+
view.stageNativeClickable(value)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
override fun setCheckboxColors(view: OneNativeComposeNodeView, value: ReadableMap?) {
|
|
162
|
+
view.stageCheckboxColors(value)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
override fun setSelected(view: OneNativeComposeNodeView, value: Boolean) {
|
|
166
|
+
view.stageSelected(value)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
override fun setRadioColors(view: OneNativeComposeNodeView, value: ReadableMap?) {
|
|
170
|
+
view.stageRadioColors(value)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
override fun setCardColors(view: OneNativeComposeNodeView, value: ReadableMap?) {
|
|
174
|
+
view.stageCardColors(value)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
override fun setCardElevation(view: OneNativeComposeNodeView, value: Double) {
|
|
178
|
+
view.stageCardElevation(value)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
override fun setCardBorder(view: OneNativeComposeNodeView, value: ReadableMap?) {
|
|
182
|
+
view.stageCardBorder(value)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
override fun setDividerStyle(view: OneNativeComposeNodeView, value: ReadableMap?) {
|
|
186
|
+
view.stageDividerStyle(value)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
override fun setSlotName(view: OneNativeComposeNodeView, value: String?) {
|
|
190
|
+
view.stageSlotName(value)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
override fun setChipColors(view: OneNativeComposeNodeView, value: ReadableMap?) {
|
|
194
|
+
view.stageChipColors(value)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
override fun setChipElevation(view: OneNativeComposeNodeView, value: Double) {
|
|
198
|
+
view.stageChipElevation(value)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
override fun setChipBorder(view: OneNativeComposeNodeView, value: ReadableMap?) {
|
|
202
|
+
view.stageChipBorder(value)
|
|
203
|
+
}
|
|
204
|
+
|
|
157
205
|
override fun setAcknowledgedEvent(view: OneNativeComposeNodeView, value: Int) {
|
|
158
206
|
view.stageAcknowledgedEvent(value)
|
|
159
207
|
}
|