one 2.6.18 → 2.6.20
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 +2 -0
- package/android/src/main/java/com/margelo/nitro/one/HybridOneDevice.kt +124 -0
- package/android/src/main/java/com/margelo/nitro/one/HybridOneHaptics.kt +31 -0
- package/android/src/main/java/com/margelo/nitro/one/HybridOneImageManipulator.kt +25 -5
- package/android/src/main/java/com/margelo/nitro/one/HybridOneKeepAwake.kt +34 -9
- package/android/src/main/java/com/margelo/nitro/one/HybridOneSecureStore.kt +269 -78
- package/dist/cjs/index.cjs +3 -0
- package/dist/cjs/index.native.cjs +3 -0
- package/dist/cjs/index.native.js +3 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/one.cjs +1 -0
- package/dist/cjs/one.native.cjs +1 -0
- package/dist/cjs/one.native.js +1 -0
- package/dist/cjs/one.native.js.map +1 -1
- package/dist/cjs/platform/extras.cjs +4 -0
- package/dist/cjs/platform/extras.native.cjs +4 -0
- package/dist/cjs/platform/extras.native.js +4 -0
- package/dist/cjs/platform/extras.native.js.map +1 -1
- package/dist/cjs/platform/haptics/index.cjs +3 -0
- package/dist/cjs/platform/haptics/index.native.cjs +4 -0
- package/dist/cjs/platform/haptics/index.native.js +4 -0
- package/dist/cjs/platform/haptics/index.native.js.map +1 -1
- package/dist/cjs/platform/haptics/validation.cjs +28 -0
- package/dist/cjs/platform/haptics/validation.native.cjs +28 -0
- package/dist/cjs/platform/haptics/validation.native.js +28 -0
- package/dist/cjs/platform/haptics/validation.native.js.map +1 -1
- package/dist/cjs/platform/image-manipulator/index.cjs +10 -3
- package/dist/cjs/platform/image-manipulator/index.native.cjs +1 -0
- package/dist/cjs/platform/image-manipulator/index.native.js +1 -0
- package/dist/cjs/platform/image-manipulator/index.native.js.map +1 -1
- package/dist/cjs/platform/index.cjs +1 -0
- package/dist/cjs/platform/index.native.cjs +1 -0
- package/dist/cjs/platform/index.native.js +1 -0
- package/dist/cjs/platform/index.native.js.map +1 -1
- package/dist/cjs/platform/keep-awake/index.cjs +53 -14
- package/dist/cjs/platform/keep-awake/index.native.cjs +29 -2
- package/dist/cjs/platform/keep-awake/index.native.js +29 -2
- package/dist/cjs/platform/keep-awake/index.native.js.map +1 -1
- package/dist/cjs/platform/keep-awake/unavailable.cjs +11 -1
- package/dist/cjs/platform/keep-awake/unavailable.native.cjs +11 -1
- package/dist/cjs/platform/keep-awake/unavailable.native.js +11 -1
- package/dist/cjs/platform/keep-awake/unavailable.native.js.map +1 -1
- package/dist/cjs/platform/keep-awake/validate.cjs +15 -1
- package/dist/cjs/platform/keep-awake/validate.native.cjs +15 -1
- package/dist/cjs/platform/keep-awake/validate.native.js +15 -1
- package/dist/cjs/platform/keep-awake/validate.native.js.map +1 -1
- package/dist/cjs/platform/localization/index.cjs +100 -0
- package/dist/cjs/platform/localization/index.native.cjs +71 -0
- package/dist/cjs/platform/localization/index.native.js +73 -0
- package/dist/cjs/platform/localization/index.native.js.map +1 -0
- package/dist/cjs/platform/localization/map.cjs +86 -0
- package/dist/cjs/platform/localization/map.native.cjs +90 -0
- package/dist/cjs/platform/localization/map.native.js +92 -0
- package/dist/cjs/platform/localization/map.native.js.map +1 -0
- package/dist/cjs/platform/localization/types.cjs +16 -0
- package/dist/cjs/platform/localization/types.native.cjs +18 -0
- package/dist/cjs/platform/localization/types.native.js +20 -0
- package/dist/cjs/platform/localization/types.native.js.map +1 -0
- package/dist/cjs/platform/secure-store/index.cjs +12 -6
- package/dist/cjs/platform/secure-store/index.native.cjs +18 -12
- package/dist/cjs/platform/secure-store/index.native.js +18 -12
- package/dist/cjs/platform/secure-store/index.native.js.map +1 -1
- package/dist/cjs/platform/secure-store/types.cjs +16 -0
- package/dist/cjs/platform/secure-store/types.native.cjs +18 -0
- package/dist/cjs/platform/secure-store/types.native.js +20 -0
- package/dist/cjs/platform/secure-store/types.native.js.map +1 -0
- package/dist/cjs/platform/secure-store/validate.cjs +34 -0
- package/dist/cjs/platform/secure-store/validate.native.cjs +34 -0
- package/dist/cjs/platform/secure-store/validate.native.js +34 -0
- package/dist/cjs/platform/secure-store/validate.native.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/index.native.js +2 -2
- package/dist/esm/one.mjs +2 -1
- package/dist/esm/one.mjs.map +1 -1
- package/dist/esm/one.native.js +2 -1
- package/dist/esm/one.native.js.map +1 -1
- package/dist/esm/platform/extras.mjs +2 -1
- package/dist/esm/platform/extras.native.js +2 -1
- package/dist/esm/platform/haptics/index.mjs +4 -1
- package/dist/esm/platform/haptics/index.mjs.map +1 -1
- package/dist/esm/platform/haptics/index.native.js +5 -1
- package/dist/esm/platform/haptics/index.native.js.map +1 -1
- package/dist/esm/platform/haptics/validation.mjs +27 -1
- package/dist/esm/platform/haptics/validation.mjs.map +1 -1
- package/dist/esm/platform/haptics/validation.native.js +27 -1
- package/dist/esm/platform/haptics/validation.native.js.map +1 -1
- package/dist/esm/platform/image-manipulator/index.mjs +10 -3
- package/dist/esm/platform/image-manipulator/index.mjs.map +1 -1
- package/dist/esm/platform/image-manipulator/index.native.js +1 -0
- package/dist/esm/platform/image-manipulator/index.native.js.map +1 -1
- package/dist/esm/platform/index.mjs +2 -2
- package/dist/esm/platform/index.mjs.map +1 -1
- package/dist/esm/platform/index.native.js +2 -2
- package/dist/esm/platform/index.native.js.map +1 -1
- package/dist/esm/platform/keep-awake/index.mjs +51 -15
- package/dist/esm/platform/keep-awake/index.mjs.map +1 -1
- package/dist/esm/platform/keep-awake/index.native.js +27 -3
- package/dist/esm/platform/keep-awake/index.native.js.map +1 -1
- package/dist/esm/platform/keep-awake/unavailable.mjs +12 -2
- package/dist/esm/platform/keep-awake/unavailable.mjs.map +1 -1
- package/dist/esm/platform/keep-awake/unavailable.native.js +12 -2
- package/dist/esm/platform/keep-awake/unavailable.native.js.map +1 -1
- package/dist/esm/platform/keep-awake/validate.mjs +10 -1
- package/dist/esm/platform/keep-awake/validate.mjs.map +1 -1
- package/dist/esm/platform/keep-awake/validate.native.js +10 -1
- package/dist/esm/platform/keep-awake/validate.native.js.map +1 -1
- package/dist/esm/platform/localization/index.mjs +77 -0
- package/dist/esm/platform/localization/index.mjs.map +1 -0
- package/dist/esm/platform/localization/index.native.js +46 -0
- package/dist/esm/platform/localization/index.native.js.map +1 -0
- package/dist/esm/platform/localization/map.mjs +59 -0
- package/dist/esm/platform/localization/map.mjs.map +1 -0
- package/dist/esm/platform/localization/map.native.js +61 -0
- package/dist/esm/platform/localization/map.native.js.map +1 -0
- package/dist/esm/platform/localization/types.mjs +0 -0
- package/dist/esm/platform/localization/types.native.js +0 -0
- package/dist/esm/platform/secure-store/index.mjs +13 -7
- package/dist/esm/platform/secure-store/index.mjs.map +1 -1
- package/dist/esm/platform/secure-store/index.native.js +19 -13
- package/dist/esm/platform/secure-store/index.native.js.map +1 -1
- package/dist/esm/platform/secure-store/types.mjs +0 -0
- package/dist/esm/platform/secure-store/types.native.js +0 -0
- package/dist/esm/platform/secure-store/validate.mjs +33 -1
- package/dist/esm/platform/secure-store/validate.mjs.map +1 -1
- package/dist/esm/platform/secure-store/validate.native.js +33 -1
- package/dist/esm/platform/secure-store/validate.native.js.map +1 -1
- package/ios/Nitro/HybridOneDevice.swift +117 -0
- package/ios/Nitro/HybridOneHaptics.swift +4 -0
- package/ios/Nitro/HybridOneImageManipulator.swift +25 -8
- package/ios/Nitro/HybridOneKeepAwake.swift +34 -2
- package/ios/Nitro/HybridOneSecureStore.swift +112 -46
- package/ios/Tests/ImageManipulator/Package.swift +12 -0
- package/ios/Tests/ImageManipulator/README.md +21 -0
- package/ios/Tests/ImageManipulator/Sources/NitroModules/Promise.swift +33 -0
- package/ios/Tests/ImageManipulator/Sources/OneImageManipulatorCore/Types.swift +41 -0
- package/ios/Tests/ImageManipulator/Sources/SDWebImageWebPCoder/SDImageWebPCoder.swift +23 -0
- package/nitrogen/generated/android/c++/JAndroidHaptic.hpp +109 -0
- package/nitrogen/generated/android/c++/JCalendarInfo.hpp +70 -0
- package/nitrogen/generated/android/c++/JHapticImpact.hpp +3 -3
- package/nitrogen/generated/android/c++/JHybridOneDeviceSpec.cpp +52 -0
- package/nitrogen/generated/android/c++/JHybridOneDeviceSpec.hpp +3 -0
- package/nitrogen/generated/android/c++/JHybridOneHapticsSpec.cpp +8 -0
- package/nitrogen/generated/android/c++/JHybridOneHapticsSpec.hpp +1 -0
- package/nitrogen/generated/android/c++/JHybridOneImageManipulatorSpec.cpp +5 -1
- package/nitrogen/generated/android/c++/JHybridOneKeepAwakeSpec.cpp +31 -0
- package/nitrogen/generated/android/c++/JHybridOneKeepAwakeSpec.hpp +2 -0
- package/nitrogen/generated/android/c++/JHybridOneSecureStoreSpec.cpp +26 -19
- package/nitrogen/generated/android/c++/JHybridOneSecureStoreSpec.hpp +6 -6
- package/nitrogen/generated/android/c++/JImageTransformOptions.hpp +7 -1
- package/nitrogen/generated/android/c++/JLocaleInfo.hpp +110 -0
- package/nitrogen/generated/android/c++/JOneImageFlip.hpp +58 -0
- package/nitrogen/generated/android/c++/JOneImageFormat.hpp +3 -0
- package/nitrogen/generated/android/c++/JSecureStoreAccessibility.hpp +73 -0
- package/nitrogen/generated/android/c++/JSecureStoreOptions.hpp +76 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/AndroidHaptic.kt +40 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/CalendarInfo.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/HapticImpact.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/HybridOneDeviceSpec.kt +17 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/HybridOneHapticsSpec.kt +4 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/HybridOneKeepAwakeSpec.kt +8 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/HybridOneSecureStoreSpec.kt +6 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/ImageTransformOptions.kt +7 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/LocaleInfo.kt +116 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/OneImageFlip.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/OneImageFormat.kt +2 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/SecureStoreAccessibility.kt +28 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/one/SecureStoreOptions.kt +71 -0
- package/nitrogen/generated/ios/One-Swift-Cxx-Bridge.hpp +133 -51
- package/nitrogen/generated/ios/One-Swift-Cxx-Umbrella.hpp +19 -1
- package/nitrogen/generated/ios/c++/HybridOneDeviceSpecSwift.hpp +31 -0
- package/nitrogen/generated/ios/c++/HybridOneHapticsSpecSwift.hpp +9 -0
- package/nitrogen/generated/ios/c++/HybridOneImageManipulatorSpecSwift.hpp +4 -1
- package/nitrogen/generated/ios/c++/HybridOneKeepAwakeSpecSwift.hpp +18 -1
- package/nitrogen/generated/ios/c++/HybridOneSecureStoreSpecSwift.hpp +18 -13
- package/nitrogen/generated/ios/swift/AndroidHaptic.swift +108 -0
- package/nitrogen/generated/ios/swift/CalendarInfo.swift +96 -0
- package/nitrogen/generated/ios/swift/HapticImpact.swift +4 -4
- package/nitrogen/generated/ios/swift/HybridOneDeviceSpec.swift +3 -0
- package/nitrogen/generated/ios/swift/HybridOneDeviceSpec_cxx.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridOneHapticsSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridOneHapticsSpec_cxx.swift +11 -0
- package/nitrogen/generated/ios/swift/HybridOneKeepAwakeSpec.swift +3 -1
- package/nitrogen/generated/ios/swift/HybridOneKeepAwakeSpec_cxx.swift +41 -3
- package/nitrogen/generated/ios/swift/HybridOneSecureStoreSpec.swift +6 -6
- package/nitrogen/generated/ios/swift/HybridOneSecureStoreSpec_cxx.swift +12 -12
- package/nitrogen/generated/ios/swift/ImageTransformOptions.swift +16 -5
- package/nitrogen/generated/ios/swift/LocaleInfo.swift +250 -0
- package/nitrogen/generated/ios/swift/OneImageFlip.swift +40 -0
- package/nitrogen/generated/ios/swift/OneImageFormat.swift +4 -0
- package/nitrogen/generated/ios/swift/SecureStoreAccessibility.swift +60 -0
- package/nitrogen/generated/ios/swift/SecureStoreOptions.swift +107 -0
- package/nitrogen/generated/shared/c++/AndroidHaptic.hpp +144 -0
- package/nitrogen/generated/shared/c++/CalendarInfo.hpp +96 -0
- package/nitrogen/generated/shared/c++/HapticImpact.hpp +5 -5
- package/nitrogen/generated/shared/c++/HybridOneDeviceSpec.cpp +3 -0
- package/nitrogen/generated/shared/c++/HybridOneDeviceSpec.hpp +11 -0
- package/nitrogen/generated/shared/c++/HybridOneHapticsSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridOneHapticsSpec.hpp +4 -0
- package/nitrogen/generated/shared/c++/HybridOneKeepAwakeSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridOneKeepAwakeSpec.hpp +4 -1
- package/nitrogen/generated/shared/c++/HybridOneSecureStoreSpec.hpp +9 -7
- package/nitrogen/generated/shared/c++/ImageTransformOptions.hpp +8 -1
- package/nitrogen/generated/shared/c++/LocaleInfo.hpp +136 -0
- package/nitrogen/generated/shared/c++/OneImageFlip.hpp +76 -0
- package/nitrogen/generated/shared/c++/OneImageFormat.hpp +4 -0
- package/nitrogen/generated/shared/c++/SecureStoreAccessibility.hpp +96 -0
- package/nitrogen/generated/shared/c++/SecureStoreOptions.hpp +102 -0
- package/package.json +15 -15
- package/src/index.ts +3 -0
- package/src/one.test.ts +2 -0
- package/src/one.ts +3 -0
- package/src/platform/extras.ts +3 -0
- package/src/platform/haptics/index.native.ts +13 -3
- package/src/platform/haptics/index.ts +12 -3
- package/src/platform/haptics/types.ts +25 -0
- package/src/platform/haptics/validation.ts +31 -1
- package/src/platform/image-manipulator/index.native.ts +3 -0
- package/src/platform/image-manipulator/index.ts +10 -3
- package/src/platform/index.native.ts +3 -2
- package/src/platform/index.ts +3 -2
- package/src/platform/keep-awake/index.native.ts +31 -2
- package/src/platform/keep-awake/index.ts +66 -17
- package/src/platform/keep-awake/unavailable.ts +12 -2
- package/src/platform/keep-awake/validate.ts +16 -0
- package/src/platform/localization/index.native.ts +47 -0
- package/src/platform/localization/index.ts +90 -0
- package/src/platform/localization/map.ts +77 -0
- package/src/platform/localization/types.ts +36 -0
- package/src/platform/secure-store/index.native.ts +26 -13
- package/src/platform/secure-store/index.ts +20 -7
- package/src/platform/secure-store/types.ts +33 -0
- package/src/platform/secure-store/validate.ts +48 -0
- package/src/platform/specs/OneDevice.nitro.ts +34 -0
- package/src/platform/specs/OneHaptics.nitro.ts +4 -1
- package/src/platform/specs/OneImageManipulator.nitro.ts +4 -1
- package/src/platform/specs/OneKeepAwake.nitro.ts +2 -0
- package/src/platform/specs/OneSecureStore.nitro.ts +12 -8
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/one.d.ts +2 -1
- package/types/one.d.ts.map +1 -1
- package/types/platform/extras.d.ts +3 -0
- package/types/platform/extras.d.ts.map +1 -1
- package/types/platform/haptics/index.d.ts +2 -2
- package/types/platform/haptics/index.d.ts.map +1 -1
- package/types/platform/haptics/index.native.d.ts +2 -2
- package/types/platform/haptics/index.native.d.ts.map +1 -1
- package/types/platform/haptics/types.d.ts +3 -0
- package/types/platform/haptics/types.d.ts.map +1 -1
- package/types/platform/haptics/validation.d.ts +3 -1
- package/types/platform/haptics/validation.d.ts.map +1 -1
- package/types/platform/image-manipulator/index.d.ts +1 -1
- package/types/platform/image-manipulator/index.d.ts.map +1 -1
- package/types/platform/image-manipulator/index.native.d.ts +1 -1
- package/types/platform/image-manipulator/index.native.d.ts.map +1 -1
- package/types/platform/index.d.ts +3 -3
- package/types/platform/index.d.ts.map +1 -1
- package/types/platform/index.native.d.ts +3 -3
- package/types/platform/index.native.d.ts.map +1 -1
- package/types/platform/keep-awake/index.d.ts +3 -0
- package/types/platform/keep-awake/index.d.ts.map +1 -1
- package/types/platform/keep-awake/index.native.d.ts +5 -0
- package/types/platform/keep-awake/index.native.d.ts.map +1 -1
- package/types/platform/keep-awake/unavailable.d.ts +4 -0
- package/types/platform/keep-awake/unavailable.d.ts.map +1 -1
- package/types/platform/keep-awake/validate.d.ts +3 -0
- package/types/platform/keep-awake/validate.d.ts.map +1 -1
- package/types/platform/localization/index.d.ts +7 -0
- package/types/platform/localization/index.d.ts.map +1 -0
- package/types/platform/localization/index.native.d.ts +7 -0
- package/types/platform/localization/index.native.d.ts.map +1 -0
- package/types/platform/localization/map.d.ts +9 -0
- package/types/platform/localization/map.d.ts.map +1 -0
- package/types/platform/localization/types.d.ts +31 -0
- package/types/platform/localization/types.d.ts.map +1 -0
- package/types/platform/secure-store/index.d.ts +8 -7
- package/types/platform/secure-store/index.d.ts.map +1 -1
- package/types/platform/secure-store/index.native.d.ts +8 -7
- package/types/platform/secure-store/index.native.d.ts.map +1 -1
- package/types/platform/secure-store/types.d.ts +24 -0
- package/types/platform/secure-store/types.d.ts.map +1 -0
- package/types/platform/secure-store/validate.d.ts +3 -0
- package/types/platform/secure-store/validate.d.ts.map +1 -1
- package/types/platform/specs/OneDevice.nitro.d.ts +25 -0
- package/types/platform/specs/OneDevice.nitro.d.ts.map +1 -1
- package/types/platform/specs/OneHaptics.nitro.d.ts +2 -1
- package/types/platform/specs/OneHaptics.nitro.d.ts.map +1 -1
- package/types/platform/specs/OneImageManipulator.nitro.d.ts +3 -1
- package/types/platform/specs/OneImageManipulator.nitro.d.ts.map +1 -1
- package/types/platform/specs/OneKeepAwake.nitro.d.ts +2 -0
- package/types/platform/specs/OneKeepAwake.nitro.d.ts.map +1 -1
- package/types/platform/specs/OneSecureStore.nitro.d.ts +8 -6
- package/types/platform/specs/OneSecureStore.nitro.d.ts.map +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
function toLocale(info) {
|
|
2
|
+
var _info_languageCode, _info_languageScriptCode, _info_regionCode, _info_languageRegionCode, _info_currencyCode, _info_currencySymbol, _info_languageCurrencyCode, _info_languageCurrencySymbol, _info_decimalSeparator, _info_digitGroupingSeparator;
|
|
3
|
+
return {
|
|
4
|
+
languageTag: info.languageTag,
|
|
5
|
+
languageCode: (_info_languageCode = info.languageCode) !== null && _info_languageCode !== void 0 ? _info_languageCode : null,
|
|
6
|
+
languageScriptCode: (_info_languageScriptCode = info.languageScriptCode) !== null && _info_languageScriptCode !== void 0 ? _info_languageScriptCode : null,
|
|
7
|
+
regionCode: (_info_regionCode = info.regionCode) !== null && _info_regionCode !== void 0 ? _info_regionCode : null,
|
|
8
|
+
languageRegionCode: (_info_languageRegionCode = info.languageRegionCode) !== null && _info_languageRegionCode !== void 0 ? _info_languageRegionCode : null,
|
|
9
|
+
currencyCode: (_info_currencyCode = info.currencyCode) !== null && _info_currencyCode !== void 0 ? _info_currencyCode : null,
|
|
10
|
+
currencySymbol: (_info_currencySymbol = info.currencySymbol) !== null && _info_currencySymbol !== void 0 ? _info_currencySymbol : null,
|
|
11
|
+
languageCurrencyCode: (_info_languageCurrencyCode = info.languageCurrencyCode) !== null && _info_languageCurrencyCode !== void 0 ? _info_languageCurrencyCode : null,
|
|
12
|
+
languageCurrencySymbol: (_info_languageCurrencySymbol = info.languageCurrencySymbol) !== null && _info_languageCurrencySymbol !== void 0 ? _info_languageCurrencySymbol : null,
|
|
13
|
+
decimalSeparator: (_info_decimalSeparator = info.decimalSeparator) !== null && _info_decimalSeparator !== void 0 ? _info_decimalSeparator : null,
|
|
14
|
+
digitGroupingSeparator: (_info_digitGroupingSeparator = info.digitGroupingSeparator) !== null && _info_digitGroupingSeparator !== void 0 ? _info_digitGroupingSeparator : null,
|
|
15
|
+
textDirection: info.textDirection === "rtl" ? "rtl" : "ltr",
|
|
16
|
+
measurementSystem: info.measurementSystem === "metric" || info.measurementSystem === "us" || info.measurementSystem === "uk" ? info.measurementSystem : null,
|
|
17
|
+
temperatureUnit: info.temperatureUnit === "celsius" || info.temperatureUnit === "fahrenheit" ? info.temperatureUnit : null
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function toCalendar(info) {
|
|
21
|
+
var _info_calendar, _info_timeZone, _info_uses24hourClock, _info_firstWeekday;
|
|
22
|
+
return {
|
|
23
|
+
calendar: (_info_calendar = info.calendar) !== null && _info_calendar !== void 0 ? _info_calendar : null,
|
|
24
|
+
timeZone: (_info_timeZone = info.timeZone) !== null && _info_timeZone !== void 0 ? _info_timeZone : null,
|
|
25
|
+
uses24hourClock: (_info_uses24hourClock = info.uses24hourClock) !== null && _info_uses24hourClock !== void 0 ? _info_uses24hourClock : null,
|
|
26
|
+
firstWeekday: (_info_firstWeekday = info.firstWeekday) !== null && _info_firstWeekday !== void 0 ? _info_firstWeekday : null
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
var FALLBACK_LOCALE = {
|
|
30
|
+
languageTag: "en-US",
|
|
31
|
+
languageCode: "en",
|
|
32
|
+
languageScriptCode: null,
|
|
33
|
+
regionCode: "US",
|
|
34
|
+
languageRegionCode: "US",
|
|
35
|
+
currencyCode: null,
|
|
36
|
+
currencySymbol: null,
|
|
37
|
+
languageCurrencyCode: null,
|
|
38
|
+
languageCurrencySymbol: null,
|
|
39
|
+
decimalSeparator: null,
|
|
40
|
+
digitGroupingSeparator: null,
|
|
41
|
+
textDirection: "ltr",
|
|
42
|
+
measurementSystem: null,
|
|
43
|
+
temperatureUnit: null
|
|
44
|
+
};
|
|
45
|
+
var FALLBACK_CALENDAR = {
|
|
46
|
+
calendar: "gregory",
|
|
47
|
+
timeZone: null,
|
|
48
|
+
uses24hourClock: null,
|
|
49
|
+
firstWeekday: null
|
|
50
|
+
};
|
|
51
|
+
function toLocales(infos) {
|
|
52
|
+
var locales = infos.map(toLocale);
|
|
53
|
+
return locales.length > 0 ? locales : [FALLBACK_LOCALE];
|
|
54
|
+
}
|
|
55
|
+
function toCalendars(infos) {
|
|
56
|
+
var calendars = infos.map(toCalendar);
|
|
57
|
+
return calendars.length > 0 ? calendars : [FALLBACK_CALENDAR];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { FALLBACK_CALENDAR, FALLBACK_LOCALE, toCalendar, toCalendars, toLocale, toLocales };
|
|
61
|
+
//# sourceMappingURL=map.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.native.js","names":[],"sources":["esm/platform/localization/map.native.js"],"sourcesContent":["function toLocale(info) {\n var _info_languageCode, _info_languageScriptCode, _info_regionCode, _info_languageRegionCode, _info_currencyCode, _info_currencySymbol, _info_languageCurrencyCode, _info_languageCurrencySymbol, _info_decimalSeparator, _info_digitGroupingSeparator;\n return {\n languageTag: info.languageTag,\n languageCode: (_info_languageCode = info.languageCode) !== null && _info_languageCode !== void 0 ? _info_languageCode : null,\n languageScriptCode: (_info_languageScriptCode = info.languageScriptCode) !== null && _info_languageScriptCode !== void 0 ? _info_languageScriptCode : null,\n regionCode: (_info_regionCode = info.regionCode) !== null && _info_regionCode !== void 0 ? _info_regionCode : null,\n languageRegionCode: (_info_languageRegionCode = info.languageRegionCode) !== null && _info_languageRegionCode !== void 0 ? _info_languageRegionCode : null,\n currencyCode: (_info_currencyCode = info.currencyCode) !== null && _info_currencyCode !== void 0 ? _info_currencyCode : null,\n currencySymbol: (_info_currencySymbol = info.currencySymbol) !== null && _info_currencySymbol !== void 0 ? _info_currencySymbol : null,\n languageCurrencyCode: (_info_languageCurrencyCode = info.languageCurrencyCode) !== null && _info_languageCurrencyCode !== void 0 ? _info_languageCurrencyCode : null,\n languageCurrencySymbol: (_info_languageCurrencySymbol = info.languageCurrencySymbol) !== null && _info_languageCurrencySymbol !== void 0 ? _info_languageCurrencySymbol : null,\n decimalSeparator: (_info_decimalSeparator = info.decimalSeparator) !== null && _info_decimalSeparator !== void 0 ? _info_decimalSeparator : null,\n digitGroupingSeparator: (_info_digitGroupingSeparator = info.digitGroupingSeparator) !== null && _info_digitGroupingSeparator !== void 0 ? _info_digitGroupingSeparator : null,\n textDirection: info.textDirection === \"rtl\" ? \"rtl\" : \"ltr\",\n measurementSystem: info.measurementSystem === \"metric\" || info.measurementSystem === \"us\" || info.measurementSystem === \"uk\" ? info.measurementSystem : null,\n temperatureUnit: info.temperatureUnit === \"celsius\" || info.temperatureUnit === \"fahrenheit\" ? info.temperatureUnit : null\n };\n}\nfunction toCalendar(info) {\n var _info_calendar, _info_timeZone, _info_uses24hourClock, _info_firstWeekday;\n return {\n calendar: (_info_calendar = info.calendar) !== null && _info_calendar !== void 0 ? _info_calendar : null,\n timeZone: (_info_timeZone = info.timeZone) !== null && _info_timeZone !== void 0 ? _info_timeZone : null,\n uses24hourClock: (_info_uses24hourClock = info.uses24hourClock) !== null && _info_uses24hourClock !== void 0 ? _info_uses24hourClock : null,\n firstWeekday: (_info_firstWeekday = info.firstWeekday) !== null && _info_firstWeekday !== void 0 ? _info_firstWeekday : null\n };\n}\nvar FALLBACK_LOCALE = {\n languageTag: \"en-US\",\n languageCode: \"en\",\n languageScriptCode: null,\n regionCode: \"US\",\n languageRegionCode: \"US\",\n currencyCode: null,\n currencySymbol: null,\n languageCurrencyCode: null,\n languageCurrencySymbol: null,\n decimalSeparator: null,\n digitGroupingSeparator: null,\n textDirection: \"ltr\",\n measurementSystem: null,\n temperatureUnit: null\n};\nvar FALLBACK_CALENDAR = {\n calendar: \"gregory\",\n timeZone: null,\n uses24hourClock: null,\n firstWeekday: null\n};\nfunction toLocales(infos) {\n var locales = infos.map(toLocale);\n return locales.length > 0 ? locales : [\n FALLBACK_LOCALE\n ];\n}\nfunction toCalendars(infos) {\n var calendars = infos.map(toCalendar);\n return calendars.length > 0 ? calendars : [\n FALLBACK_CALENDAR\n ];\n}\nexport {\n FALLBACK_CALENDAR,\n FALLBACK_LOCALE,\n toCalendar,\n toCalendars,\n toLocale,\n toLocales\n};\n//# sourceMappingURL=map.js.map\n"],"mappings":";AAAA,SAAS,SAAS,MAAM;CACtB,IAAI,oBAAoB,0BAA0B,kBAAkB,0BAA0B,oBAAoB,sBAAsB,4BAA4B,8BAA8B,wBAAwB;CAC1N,OAAO;EACL,aAAa,KAAK;EAClB,eAAe,qBAAqB,KAAK,kBAAkB,QAAQ,uBAAuB,KAAK,IAAI,qBAAqB;EACxH,qBAAqB,2BAA2B,KAAK,wBAAwB,QAAQ,6BAA6B,KAAK,IAAI,2BAA2B;EACtJ,aAAa,mBAAmB,KAAK,gBAAgB,QAAQ,qBAAqB,KAAK,IAAI,mBAAmB;EAC9G,qBAAqB,2BAA2B,KAAK,wBAAwB,QAAQ,6BAA6B,KAAK,IAAI,2BAA2B;EACtJ,eAAe,qBAAqB,KAAK,kBAAkB,QAAQ,uBAAuB,KAAK,IAAI,qBAAqB;EACxH,iBAAiB,uBAAuB,KAAK,oBAAoB,QAAQ,yBAAyB,KAAK,IAAI,uBAAuB;EAClI,uBAAuB,6BAA6B,KAAK,0BAA0B,QAAQ,+BAA+B,KAAK,IAAI,6BAA6B;EAChK,yBAAyB,+BAA+B,KAAK,4BAA4B,QAAQ,iCAAiC,KAAK,IAAI,+BAA+B;EAC1K,mBAAmB,yBAAyB,KAAK,sBAAsB,QAAQ,2BAA2B,KAAK,IAAI,yBAAyB;EAC5I,yBAAyB,+BAA+B,KAAK,4BAA4B,QAAQ,iCAAiC,KAAK,IAAI,+BAA+B;EAC1K,eAAe,KAAK,kBAAkB,QAAQ,QAAQ;EACtD,mBAAmB,KAAK,sBAAsB,YAAY,KAAK,sBAAsB,QAAQ,KAAK,sBAAsB,OAAO,KAAK,oBAAoB;EACxJ,iBAAiB,KAAK,oBAAoB,aAAa,KAAK,oBAAoB,eAAe,KAAK,kBAAkB;CACxH;AACF;AACA,SAAS,WAAW,MAAM;CACxB,IAAI,gBAAgB,gBAAgB,uBAAuB;CAC3D,OAAO;EACL,WAAW,iBAAiB,KAAK,cAAc,QAAQ,mBAAmB,KAAK,IAAI,iBAAiB;EACpG,WAAW,iBAAiB,KAAK,cAAc,QAAQ,mBAAmB,KAAK,IAAI,iBAAiB;EACpG,kBAAkB,wBAAwB,KAAK,qBAAqB,QAAQ,0BAA0B,KAAK,IAAI,wBAAwB;EACvI,eAAe,qBAAqB,KAAK,kBAAkB,QAAQ,uBAAuB,KAAK,IAAI,qBAAqB;CAC1H;AACF;AACA,IAAI,kBAAkB;CACpB,aAAa;CACb,cAAc;CACd,oBAAoB;CACpB,YAAY;CACZ,oBAAoB;CACpB,cAAc;CACd,gBAAgB;CAChB,sBAAsB;CACtB,wBAAwB;CACxB,kBAAkB;CAClB,wBAAwB;CACxB,eAAe;CACf,mBAAmB;CACnB,iBAAiB;AACnB;AACA,IAAI,oBAAoB;CACtB,UAAU;CACV,UAAU;CACV,iBAAiB;CACjB,cAAc;AAChB;AACA,SAAS,UAAU,OAAO;CACxB,IAAI,UAAU,MAAM,IAAI,QAAQ;CAChC,OAAO,QAAQ,SAAS,IAAI,UAAU,CACpC,eACF;AACF;AACA,SAAS,YAAY,OAAO;CAC1B,IAAI,YAAY,MAAM,IAAI,UAAU;CACpC,OAAO,UAAU,SAAS,IAAI,YAAY,CACxC,iBACF;AACF"}
|
|
File without changes
|
|
File without changes
|
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
import { assertSecureStoreKey, assertSecureStoreValue } from "./validate.mjs";
|
|
1
|
+
import { assertSecureStoreKey, assertSecureStoreOptions, assertSecureStoreValue } from "./validate.mjs";
|
|
2
2
|
|
|
3
|
-
function getItem(key) {
|
|
3
|
+
function getItem(key, options) {
|
|
4
4
|
assertSecureStoreKey(key, "SecureStore.getItem");
|
|
5
|
+
assertSecureStoreOptions(options, "SecureStore.getItem");
|
|
5
6
|
return Promise.reject(new Error("SecureStore.getItem needs an iOS or Android build"));
|
|
6
7
|
}
|
|
7
|
-
function setItem(key, value) {
|
|
8
|
+
function setItem(key, value, options) {
|
|
8
9
|
assertSecureStoreKey(key, "SecureStore.setItem");
|
|
9
10
|
assertSecureStoreValue(value, "SecureStore.setItem");
|
|
11
|
+
assertSecureStoreOptions(options, "SecureStore.setItem");
|
|
10
12
|
return Promise.reject(new Error("SecureStore.setItem needs an iOS or Android build"));
|
|
11
13
|
}
|
|
12
|
-
function deleteItem(key) {
|
|
14
|
+
function deleteItem(key, options) {
|
|
13
15
|
assertSecureStoreKey(key, "SecureStore.deleteItem");
|
|
16
|
+
assertSecureStoreOptions(options, "SecureStore.deleteItem");
|
|
14
17
|
return Promise.reject(new Error("SecureStore.deleteItem needs an iOS or Android build"));
|
|
15
18
|
}
|
|
16
|
-
function getItemSync(key) {
|
|
19
|
+
function getItemSync(key, options) {
|
|
17
20
|
assertSecureStoreKey(key, "SecureStore.getItemSync");
|
|
21
|
+
assertSecureStoreOptions(options, "SecureStore.getItemSync");
|
|
18
22
|
throw new Error("SecureStore.getItemSync needs an iOS or Android build");
|
|
19
23
|
}
|
|
20
|
-
function setItemSync(key, value) {
|
|
24
|
+
function setItemSync(key, value, options) {
|
|
21
25
|
assertSecureStoreKey(key, "SecureStore.setItemSync");
|
|
22
26
|
assertSecureStoreValue(value, "SecureStore.setItemSync");
|
|
27
|
+
assertSecureStoreOptions(options, "SecureStore.setItemSync");
|
|
23
28
|
throw new Error("SecureStore.setItemSync needs an iOS or Android build");
|
|
24
29
|
}
|
|
25
|
-
function deleteItemSync(key) {
|
|
30
|
+
function deleteItemSync(key, options) {
|
|
26
31
|
assertSecureStoreKey(key, "SecureStore.deleteItemSync");
|
|
32
|
+
assertSecureStoreOptions(options, "SecureStore.deleteItemSync");
|
|
27
33
|
throw new Error("SecureStore.deleteItemSync needs an iOS or Android build");
|
|
28
34
|
}
|
|
29
35
|
const SecureStore = Object.freeze({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["esm/platform/secure-store/index.js"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["esm/platform/secure-store/index.js"],"sourcesContent":["import {\n assertSecureStoreKey,\n assertSecureStoreOptions,\n assertSecureStoreValue\n} from \"./validate\";\nfunction getItem(key, options) {\n assertSecureStoreKey(key, \"SecureStore.getItem\");\n assertSecureStoreOptions(options, \"SecureStore.getItem\");\n return Promise.reject(new Error(\"SecureStore.getItem needs an iOS or Android build\"));\n}\nfunction setItem(key, value, options) {\n assertSecureStoreKey(key, \"SecureStore.setItem\");\n assertSecureStoreValue(value, \"SecureStore.setItem\");\n assertSecureStoreOptions(options, \"SecureStore.setItem\");\n return Promise.reject(new Error(\"SecureStore.setItem needs an iOS or Android build\"));\n}\nfunction deleteItem(key, options) {\n assertSecureStoreKey(key, \"SecureStore.deleteItem\");\n assertSecureStoreOptions(options, \"SecureStore.deleteItem\");\n return Promise.reject(new Error(\"SecureStore.deleteItem needs an iOS or Android build\"));\n}\nfunction getItemSync(key, options) {\n assertSecureStoreKey(key, \"SecureStore.getItemSync\");\n assertSecureStoreOptions(options, \"SecureStore.getItemSync\");\n throw new Error(\"SecureStore.getItemSync needs an iOS or Android build\");\n}\nfunction setItemSync(key, value, options) {\n assertSecureStoreKey(key, \"SecureStore.setItemSync\");\n assertSecureStoreValue(value, \"SecureStore.setItemSync\");\n assertSecureStoreOptions(options, \"SecureStore.setItemSync\");\n throw new Error(\"SecureStore.setItemSync needs an iOS or Android build\");\n}\nfunction deleteItemSync(key, options) {\n assertSecureStoreKey(key, \"SecureStore.deleteItemSync\");\n assertSecureStoreOptions(options, \"SecureStore.deleteItemSync\");\n throw new Error(\"SecureStore.deleteItemSync needs an iOS or Android build\");\n}\nconst SecureStore = Object.freeze({\n getItem,\n setItem,\n deleteItem,\n getItemSync,\n setItemSync,\n deleteItemSync\n});\nexport {\n SecureStore\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;AAKA,SAAS,QAAQ,KAAK,SAAS;CAC7B,qBAAqB,KAAK,qBAAqB;CAC/C,yBAAyB,SAAS,qBAAqB;CACvD,OAAO,QAAQ,OAAO,IAAI,MAAM,mDAAmD,CAAC;AACtF;AACA,SAAS,QAAQ,KAAK,OAAO,SAAS;CACpC,qBAAqB,KAAK,qBAAqB;CAC/C,uBAAuB,OAAO,qBAAqB;CACnD,yBAAyB,SAAS,qBAAqB;CACvD,OAAO,QAAQ,OAAO,IAAI,MAAM,mDAAmD,CAAC;AACtF;AACA,SAAS,WAAW,KAAK,SAAS;CAChC,qBAAqB,KAAK,wBAAwB;CAClD,yBAAyB,SAAS,wBAAwB;CAC1D,OAAO,QAAQ,OAAO,IAAI,MAAM,sDAAsD,CAAC;AACzF;AACA,SAAS,YAAY,KAAK,SAAS;CACjC,qBAAqB,KAAK,yBAAyB;CACnD,yBAAyB,SAAS,yBAAyB;CAC3D,MAAM,IAAI,MAAM,uDAAuD;AACzE;AACA,SAAS,YAAY,KAAK,OAAO,SAAS;CACxC,qBAAqB,KAAK,yBAAyB;CACnD,uBAAuB,OAAO,yBAAyB;CACvD,yBAAyB,SAAS,yBAAyB;CAC3D,MAAM,IAAI,MAAM,uDAAuD;AACzE;AACA,SAAS,eAAe,KAAK,SAAS;CACpC,qBAAqB,KAAK,4BAA4B;CACtD,yBAAyB,SAAS,4BAA4B;CAC9D,MAAM,IAAI,MAAM,0DAA0D;AAC5E;AACA,MAAM,cAAc,OAAO,OAAO;CAChC;CACA;CACA;CACA;CACA;CACA;AACF,CAAC"}
|
|
@@ -1,49 +1,55 @@
|
|
|
1
1
|
import { NitroModules } from "react-native-nitro-modules";
|
|
2
2
|
import { rethrowNativeError } from "../nativeError.native.js";
|
|
3
|
-
import { assertSecureStoreKey, assertSecureStoreValue } from "./validate.native.js";
|
|
3
|
+
import { assertSecureStoreKey, assertSecureStoreOptions, assertSecureStoreValue } from "./validate.native.js";
|
|
4
4
|
|
|
5
5
|
var hybrid;
|
|
6
6
|
function native() {
|
|
7
7
|
hybrid !== null && hybrid !== void 0 ? hybrid : hybrid = NitroModules.createHybridObject("OneSecureStore");
|
|
8
8
|
return hybrid;
|
|
9
9
|
}
|
|
10
|
-
function getItem(key) {
|
|
10
|
+
function getItem(key, options) {
|
|
11
11
|
assertSecureStoreKey(key, "SecureStore.getItem");
|
|
12
|
-
|
|
12
|
+
var checked = assertSecureStoreOptions(options, "SecureStore.getItem");
|
|
13
|
+
return native().getItem(key, checked).then(function(value) {
|
|
13
14
|
return value !== null && value !== void 0 ? value : null;
|
|
14
15
|
}, rethrowNativeError);
|
|
15
16
|
}
|
|
16
|
-
function setItem(key, value) {
|
|
17
|
+
function setItem(key, value, options) {
|
|
17
18
|
assertSecureStoreKey(key, "SecureStore.setItem");
|
|
18
19
|
assertSecureStoreValue(value, "SecureStore.setItem");
|
|
19
|
-
|
|
20
|
+
var checked = assertSecureStoreOptions(options, "SecureStore.setItem");
|
|
21
|
+
return native().setItem(key, value, checked).catch(rethrowNativeError);
|
|
20
22
|
}
|
|
21
|
-
function deleteItem(key) {
|
|
23
|
+
function deleteItem(key, options) {
|
|
22
24
|
assertSecureStoreKey(key, "SecureStore.deleteItem");
|
|
23
|
-
|
|
25
|
+
var checked = assertSecureStoreOptions(options, "SecureStore.deleteItem");
|
|
26
|
+
return native().deleteItem(key, checked).catch(rethrowNativeError);
|
|
24
27
|
}
|
|
25
|
-
function getItemSync(key) {
|
|
28
|
+
function getItemSync(key, options) {
|
|
26
29
|
assertSecureStoreKey(key, "SecureStore.getItemSync");
|
|
30
|
+
var checked = assertSecureStoreOptions(options, "SecureStore.getItemSync");
|
|
27
31
|
try {
|
|
28
32
|
var _native_getItemSync;
|
|
29
|
-
return (_native_getItemSync = native().getItemSync(key)) !== null && _native_getItemSync !== void 0 ? _native_getItemSync : null;
|
|
33
|
+
return (_native_getItemSync = native().getItemSync(key, checked)) !== null && _native_getItemSync !== void 0 ? _native_getItemSync : null;
|
|
30
34
|
} catch (error) {
|
|
31
35
|
rethrowNativeError(error);
|
|
32
36
|
}
|
|
33
37
|
}
|
|
34
|
-
function setItemSync(key, value) {
|
|
38
|
+
function setItemSync(key, value, options) {
|
|
35
39
|
assertSecureStoreKey(key, "SecureStore.setItemSync");
|
|
36
40
|
assertSecureStoreValue(value, "SecureStore.setItemSync");
|
|
41
|
+
var checked = assertSecureStoreOptions(options, "SecureStore.setItemSync");
|
|
37
42
|
try {
|
|
38
|
-
native().setItemSync(key, value);
|
|
43
|
+
native().setItemSync(key, value, checked);
|
|
39
44
|
} catch (error) {
|
|
40
45
|
rethrowNativeError(error);
|
|
41
46
|
}
|
|
42
47
|
}
|
|
43
|
-
function deleteItemSync(key) {
|
|
48
|
+
function deleteItemSync(key, options) {
|
|
44
49
|
assertSecureStoreKey(key, "SecureStore.deleteItemSync");
|
|
50
|
+
var checked = assertSecureStoreOptions(options, "SecureStore.deleteItemSync");
|
|
45
51
|
try {
|
|
46
|
-
native().deleteItemSync(key);
|
|
52
|
+
native().deleteItemSync(key, checked);
|
|
47
53
|
} catch (error) {
|
|
48
54
|
rethrowNativeError(error);
|
|
49
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":[],"sources":["esm/platform/secure-store/index.native.js"],"sourcesContent":["import { NitroModules } from \"react-native-nitro-modules\";\nimport { rethrowNativeError } from \"../nativeError\";\nimport { assertSecureStoreKey, assertSecureStoreValue } from \"./validate\";\nvar hybrid;\nfunction native() {\n hybrid !== null && hybrid !== void 0 ? hybrid : hybrid = NitroModules.createHybridObject(\"OneSecureStore\");\n return hybrid;\n}\nfunction getItem(key) {\n assertSecureStoreKey(key, \"SecureStore.getItem\");\n return native().getItem(key).then(function(value) {\n return value !== null && value !== void 0 ? value : null;\n }, rethrowNativeError);\n}\nfunction setItem(key, value) {\n assertSecureStoreKey(key, \"SecureStore.setItem\");\n assertSecureStoreValue(value, \"SecureStore.setItem\");\n return native().setItem(key, value).catch(rethrowNativeError);\n}\nfunction deleteItem(key) {\n assertSecureStoreKey(key, \"SecureStore.deleteItem\");\n return native().deleteItem(key).catch(rethrowNativeError);\n}\nfunction getItemSync(key) {\n assertSecureStoreKey(key, \"SecureStore.getItemSync\");\n try {\n var _native_getItemSync;\n return (_native_getItemSync = native().getItemSync(key)) !== null && _native_getItemSync !== void 0 ? _native_getItemSync : null;\n } catch (error) {\n rethrowNativeError(error);\n }\n}\nfunction setItemSync(key, value) {\n assertSecureStoreKey(key, \"SecureStore.setItemSync\");\n assertSecureStoreValue(value, \"SecureStore.setItemSync\");\n try {\n native().setItemSync(key, value);\n } catch (error) {\n rethrowNativeError(error);\n }\n}\nfunction deleteItemSync(key) {\n assertSecureStoreKey(key, \"SecureStore.deleteItemSync\");\n try {\n native().deleteItemSync(key);\n } catch (error) {\n rethrowNativeError(error);\n }\n}\nvar SecureStore = Object.freeze({\n getItem,\n setItem,\n deleteItem,\n getItemSync,\n setItemSync,\n deleteItemSync\n});\nexport {\n SecureStore\n};\n//# sourceMappingURL=index.native.js.map\n"],"mappings":";;;;;AAGA,IAAI;AACJ,SAAS,SAAS;CAChB,WAAW,QAAQ,WAAW,KAAK,IAAI,SAAS,SAAS,aAAa,mBAAmB,gBAAgB;CACzG,OAAO;AACT;AACA,SAAS,QAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["esm/platform/secure-store/index.native.js"],"sourcesContent":["import { NitroModules } from \"react-native-nitro-modules\";\nimport { rethrowNativeError } from \"../nativeError\";\nimport { assertSecureStoreKey, assertSecureStoreOptions, assertSecureStoreValue } from \"./validate\";\nvar hybrid;\nfunction native() {\n hybrid !== null && hybrid !== void 0 ? hybrid : hybrid = NitroModules.createHybridObject(\"OneSecureStore\");\n return hybrid;\n}\nfunction getItem(key, options) {\n assertSecureStoreKey(key, \"SecureStore.getItem\");\n var checked = assertSecureStoreOptions(options, \"SecureStore.getItem\");\n return native().getItem(key, checked).then(function(value) {\n return value !== null && value !== void 0 ? value : null;\n }, rethrowNativeError);\n}\nfunction setItem(key, value, options) {\n assertSecureStoreKey(key, \"SecureStore.setItem\");\n assertSecureStoreValue(value, \"SecureStore.setItem\");\n var checked = assertSecureStoreOptions(options, \"SecureStore.setItem\");\n return native().setItem(key, value, checked).catch(rethrowNativeError);\n}\nfunction deleteItem(key, options) {\n assertSecureStoreKey(key, \"SecureStore.deleteItem\");\n var checked = assertSecureStoreOptions(options, \"SecureStore.deleteItem\");\n return native().deleteItem(key, checked).catch(rethrowNativeError);\n}\nfunction getItemSync(key, options) {\n assertSecureStoreKey(key, \"SecureStore.getItemSync\");\n var checked = assertSecureStoreOptions(options, \"SecureStore.getItemSync\");\n try {\n var _native_getItemSync;\n return (_native_getItemSync = native().getItemSync(key, checked)) !== null && _native_getItemSync !== void 0 ? _native_getItemSync : null;\n } catch (error) {\n rethrowNativeError(error);\n }\n}\nfunction setItemSync(key, value, options) {\n assertSecureStoreKey(key, \"SecureStore.setItemSync\");\n assertSecureStoreValue(value, \"SecureStore.setItemSync\");\n var checked = assertSecureStoreOptions(options, \"SecureStore.setItemSync\");\n try {\n native().setItemSync(key, value, checked);\n } catch (error) {\n rethrowNativeError(error);\n }\n}\nfunction deleteItemSync(key, options) {\n assertSecureStoreKey(key, \"SecureStore.deleteItemSync\");\n var checked = assertSecureStoreOptions(options, \"SecureStore.deleteItemSync\");\n try {\n native().deleteItemSync(key, checked);\n } catch (error) {\n rethrowNativeError(error);\n }\n}\nvar SecureStore = Object.freeze({\n getItem,\n setItem,\n deleteItem,\n getItemSync,\n setItemSync,\n deleteItemSync\n});\nexport {\n SecureStore\n};\n//# sourceMappingURL=index.native.js.map\n"],"mappings":";;;;;AAGA,IAAI;AACJ,SAAS,SAAS;CAChB,WAAW,QAAQ,WAAW,KAAK,IAAI,SAAS,SAAS,aAAa,mBAAmB,gBAAgB;CACzG,OAAO;AACT;AACA,SAAS,QAAQ,KAAK,SAAS;CAC7B,qBAAqB,KAAK,qBAAqB;CAC/C,IAAI,UAAU,yBAAyB,SAAS,qBAAqB;CACrE,OAAO,OAAO,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,KAAK,SAAS,OAAO;EACzD,OAAO,UAAU,QAAQ,UAAU,KAAK,IAAI,QAAQ;CACtD,GAAG,kBAAkB;AACvB;AACA,SAAS,QAAQ,KAAK,OAAO,SAAS;CACpC,qBAAqB,KAAK,qBAAqB;CAC/C,uBAAuB,OAAO,qBAAqB;CACnD,IAAI,UAAU,yBAAyB,SAAS,qBAAqB;CACrE,OAAO,OAAO,CAAC,CAAC,QAAQ,KAAK,OAAO,OAAO,CAAC,CAAC,MAAM,kBAAkB;AACvE;AACA,SAAS,WAAW,KAAK,SAAS;CAChC,qBAAqB,KAAK,wBAAwB;CAClD,IAAI,UAAU,yBAAyB,SAAS,wBAAwB;CACxE,OAAO,OAAO,CAAC,CAAC,WAAW,KAAK,OAAO,CAAC,CAAC,MAAM,kBAAkB;AACnE;AACA,SAAS,YAAY,KAAK,SAAS;CACjC,qBAAqB,KAAK,yBAAyB;CACnD,IAAI,UAAU,yBAAyB,SAAS,yBAAyB;CACzE,IAAI;EACF,IAAI;EACJ,QAAQ,sBAAsB,OAAO,CAAC,CAAC,YAAY,KAAK,OAAO,OAAO,QAAQ,wBAAwB,KAAK,IAAI,sBAAsB;CACvI,SAAS,OAAO;EACd,mBAAmB,KAAK;CAC1B;AACF;AACA,SAAS,YAAY,KAAK,OAAO,SAAS;CACxC,qBAAqB,KAAK,yBAAyB;CACnD,uBAAuB,OAAO,yBAAyB;CACvD,IAAI,UAAU,yBAAyB,SAAS,yBAAyB;CACzE,IAAI;EACF,OAAO,CAAC,CAAC,YAAY,KAAK,OAAO,OAAO;CAC1C,SAAS,OAAO;EACd,mBAAmB,KAAK;CAC1B;AACF;AACA,SAAS,eAAe,KAAK,SAAS;CACpC,qBAAqB,KAAK,4BAA4B;CACtD,IAAI,UAAU,yBAAyB,SAAS,4BAA4B;CAC5E,IAAI;EACF,OAAO,CAAC,CAAC,eAAe,KAAK,OAAO;CACtC,SAAS,OAAO;EACd,mBAAmB,KAAK;CAC1B;AACF;AACA,IAAI,cAAc,OAAO,OAAO;CAC9B;CACA;CACA;CACA;CACA;CACA;AACF,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -8,6 +8,38 @@ function assertSecureStoreValue(value, verb) {
|
|
|
8
8
|
throw new Error(`${verb}: value must be a string`);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
+
const SECURE_STORE_ACCESSIBILITIES = [
|
|
12
|
+
"afterFirstUnlock",
|
|
13
|
+
"afterFirstUnlockThisDeviceOnly",
|
|
14
|
+
"always",
|
|
15
|
+
"alwaysThisDeviceOnly",
|
|
16
|
+
"whenPasscodeSetThisDeviceOnly",
|
|
17
|
+
"whenUnlocked",
|
|
18
|
+
"whenUnlockedThisDeviceOnly"
|
|
19
|
+
];
|
|
20
|
+
function assertSecureStoreOptions(options, verb) {
|
|
21
|
+
if (options === void 0) return {};
|
|
22
|
+
if (typeof options !== "object" || options === null || Array.isArray(options)) {
|
|
23
|
+
throw new Error(`${verb}: options must be an object`);
|
|
24
|
+
}
|
|
25
|
+
const { keychainService, keychainAccessible, requireAuthentication, authenticationPrompt, accessGroup } = options;
|
|
26
|
+
if (keychainService !== void 0 && typeof keychainService !== "string") {
|
|
27
|
+
throw new Error(`${verb}: options.keychainService must be a string`);
|
|
28
|
+
}
|
|
29
|
+
if (keychainAccessible !== void 0 && !SECURE_STORE_ACCESSIBILITIES.includes(keychainAccessible)) {
|
|
30
|
+
throw new Error(`${verb}: options.keychainAccessible must be one of: ${SECURE_STORE_ACCESSIBILITIES.join(", ")}`);
|
|
31
|
+
}
|
|
32
|
+
if (requireAuthentication !== void 0 && typeof requireAuthentication !== "boolean") {
|
|
33
|
+
throw new Error(`${verb}: options.requireAuthentication must be a boolean`);
|
|
34
|
+
}
|
|
35
|
+
if (authenticationPrompt !== void 0 && typeof authenticationPrompt !== "string") {
|
|
36
|
+
throw new Error(`${verb}: options.authenticationPrompt must be a string`);
|
|
37
|
+
}
|
|
38
|
+
if (accessGroup !== void 0 && typeof accessGroup !== "string") {
|
|
39
|
+
throw new Error(`${verb}: options.accessGroup must be a string`);
|
|
40
|
+
}
|
|
41
|
+
return options;
|
|
42
|
+
}
|
|
11
43
|
|
|
12
|
-
export { assertSecureStoreKey, assertSecureStoreValue };
|
|
44
|
+
export { SECURE_STORE_ACCESSIBILITIES, assertSecureStoreKey, assertSecureStoreOptions, assertSecureStoreValue };
|
|
13
45
|
//# sourceMappingURL=validate.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","names":[],"sources":["esm/platform/secure-store/validate.js"],"sourcesContent":["function assertSecureStoreKey(key, verb) {\n if (typeof key !== \"string\" || key.length === 0) {\n throw new Error(`${verb}: key must be a non-empty string`);\n }\n}\nfunction assertSecureStoreValue(value, verb) {\n if (typeof value !== \"string\") {\n throw new Error(`${verb}: value must be a string`);\n }\n}\nexport {\n assertSecureStoreKey,\n assertSecureStoreValue\n};\n//# sourceMappingURL=validate.js.map\n"],"mappings":";AAAA,SAAS,qBAAqB,KAAK,MAAM;CACvC,IAAI,OAAO,QAAQ,YAAY,IAAI,WAAW,GAAG;EAC/C,MAAM,IAAI,MAAM,GAAG,KAAK,iCAAiC;CAC3D;AACF;AACA,SAAS,uBAAuB,OAAO,MAAM;CAC3C,IAAI,OAAO,UAAU,UAAU;EAC7B,MAAM,IAAI,MAAM,GAAG,KAAK,yBAAyB;CACnD;AACF"}
|
|
1
|
+
{"version":3,"file":"validate.js","names":[],"sources":["esm/platform/secure-store/validate.js"],"sourcesContent":["function assertSecureStoreKey(key, verb) {\n if (typeof key !== \"string\" || key.length === 0) {\n throw new Error(`${verb}: key must be a non-empty string`);\n }\n}\nfunction assertSecureStoreValue(value, verb) {\n if (typeof value !== \"string\") {\n throw new Error(`${verb}: value must be a string`);\n }\n}\nconst SECURE_STORE_ACCESSIBILITIES = [\n \"afterFirstUnlock\",\n \"afterFirstUnlockThisDeviceOnly\",\n \"always\",\n \"alwaysThisDeviceOnly\",\n \"whenPasscodeSetThisDeviceOnly\",\n \"whenUnlocked\",\n \"whenUnlockedThisDeviceOnly\"\n];\nfunction assertSecureStoreOptions(options, verb) {\n if (options === void 0) return {};\n if (typeof options !== \"object\" || options === null || Array.isArray(options)) {\n throw new Error(`${verb}: options must be an object`);\n }\n const { keychainService, keychainAccessible, requireAuthentication, authenticationPrompt, accessGroup } = options;\n if (keychainService !== void 0 && typeof keychainService !== \"string\") {\n throw new Error(`${verb}: options.keychainService must be a string`);\n }\n if (keychainAccessible !== void 0 && !SECURE_STORE_ACCESSIBILITIES.includes(keychainAccessible)) {\n throw new Error(\n `${verb}: options.keychainAccessible must be one of: ${SECURE_STORE_ACCESSIBILITIES.join(\", \")}`\n );\n }\n if (requireAuthentication !== void 0 && typeof requireAuthentication !== \"boolean\") {\n throw new Error(`${verb}: options.requireAuthentication must be a boolean`);\n }\n if (authenticationPrompt !== void 0 && typeof authenticationPrompt !== \"string\") {\n throw new Error(`${verb}: options.authenticationPrompt must be a string`);\n }\n if (accessGroup !== void 0 && typeof accessGroup !== \"string\") {\n throw new Error(`${verb}: options.accessGroup must be a string`);\n }\n return options;\n}\nexport {\n SECURE_STORE_ACCESSIBILITIES,\n assertSecureStoreKey,\n assertSecureStoreOptions,\n assertSecureStoreValue\n};\n//# sourceMappingURL=validate.js.map\n"],"mappings":";AAAA,SAAS,qBAAqB,KAAK,MAAM;CACvC,IAAI,OAAO,QAAQ,YAAY,IAAI,WAAW,GAAG;EAC/C,MAAM,IAAI,MAAM,GAAG,KAAK,iCAAiC;CAC3D;AACF;AACA,SAAS,uBAAuB,OAAO,MAAM;CAC3C,IAAI,OAAO,UAAU,UAAU;EAC7B,MAAM,IAAI,MAAM,GAAG,KAAK,yBAAyB;CACnD;AACF;AACA,MAAM,+BAA+B;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,SAAS,yBAAyB,SAAS,MAAM;CAC/C,IAAI,YAAY,KAAK,GAAG,OAAO,CAAC;CAChC,IAAI,OAAO,YAAY,YAAY,YAAY,QAAQ,MAAM,QAAQ,OAAO,GAAG;EAC7E,MAAM,IAAI,MAAM,GAAG,KAAK,4BAA4B;CACtD;CACA,MAAM,EAAE,iBAAiB,oBAAoB,uBAAuB,sBAAsB,gBAAgB;CAC1G,IAAI,oBAAoB,KAAK,KAAK,OAAO,oBAAoB,UAAU;EACrE,MAAM,IAAI,MAAM,GAAG,KAAK,2CAA2C;CACrE;CACA,IAAI,uBAAuB,KAAK,KAAK,CAAC,6BAA6B,SAAS,kBAAkB,GAAG;EAC/F,MAAM,IAAI,MACR,GAAG,KAAK,+CAA+C,6BAA6B,KAAK,IAAI,GAC/F;CACF;CACA,IAAI,0BAA0B,KAAK,KAAK,OAAO,0BAA0B,WAAW;EAClF,MAAM,IAAI,MAAM,GAAG,KAAK,kDAAkD;CAC5E;CACA,IAAI,yBAAyB,KAAK,KAAK,OAAO,yBAAyB,UAAU;EAC/E,MAAM,IAAI,MAAM,GAAG,KAAK,gDAAgD;CAC1E;CACA,IAAI,gBAAgB,KAAK,KAAK,OAAO,gBAAgB,UAAU;EAC7D,MAAM,IAAI,MAAM,GAAG,KAAK,uCAAuC;CACjE;CACA,OAAO;AACT"}
|
|
@@ -8,6 +8,38 @@ function assertSecureStoreValue(value, verb) {
|
|
|
8
8
|
throw new Error(`${verb}: value must be a string`);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
+
var SECURE_STORE_ACCESSIBILITIES = [
|
|
12
|
+
"afterFirstUnlock",
|
|
13
|
+
"afterFirstUnlockThisDeviceOnly",
|
|
14
|
+
"always",
|
|
15
|
+
"alwaysThisDeviceOnly",
|
|
16
|
+
"whenPasscodeSetThisDeviceOnly",
|
|
17
|
+
"whenUnlocked",
|
|
18
|
+
"whenUnlockedThisDeviceOnly"
|
|
19
|
+
];
|
|
20
|
+
function assertSecureStoreOptions(options, verb) {
|
|
21
|
+
if (options === void 0) return {};
|
|
22
|
+
if (typeof options !== "object" || options === null || Array.isArray(options)) {
|
|
23
|
+
throw new Error(`${verb}: options must be an object`);
|
|
24
|
+
}
|
|
25
|
+
var { keychainService, keychainAccessible, requireAuthentication, authenticationPrompt, accessGroup } = options;
|
|
26
|
+
if (keychainService !== void 0 && typeof keychainService !== "string") {
|
|
27
|
+
throw new Error(`${verb}: options.keychainService must be a string`);
|
|
28
|
+
}
|
|
29
|
+
if (keychainAccessible !== void 0 && !SECURE_STORE_ACCESSIBILITIES.includes(keychainAccessible)) {
|
|
30
|
+
throw new Error(`${verb}: options.keychainAccessible must be one of: ${SECURE_STORE_ACCESSIBILITIES.join(", ")}`);
|
|
31
|
+
}
|
|
32
|
+
if (requireAuthentication !== void 0 && typeof requireAuthentication !== "boolean") {
|
|
33
|
+
throw new Error(`${verb}: options.requireAuthentication must be a boolean`);
|
|
34
|
+
}
|
|
35
|
+
if (authenticationPrompt !== void 0 && typeof authenticationPrompt !== "string") {
|
|
36
|
+
throw new Error(`${verb}: options.authenticationPrompt must be a string`);
|
|
37
|
+
}
|
|
38
|
+
if (accessGroup !== void 0 && typeof accessGroup !== "string") {
|
|
39
|
+
throw new Error(`${verb}: options.accessGroup must be a string`);
|
|
40
|
+
}
|
|
41
|
+
return options;
|
|
42
|
+
}
|
|
11
43
|
|
|
12
|
-
export { assertSecureStoreKey, assertSecureStoreValue };
|
|
44
|
+
export { SECURE_STORE_ACCESSIBILITIES, assertSecureStoreKey, assertSecureStoreOptions, assertSecureStoreValue };
|
|
13
45
|
//# sourceMappingURL=validate.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.native.js","names":[],"sources":["esm/platform/secure-store/validate.native.js"],"sourcesContent":["function assertSecureStoreKey(key, verb) {\n if (typeof key !== \"string\" || key.length === 0) {\n throw new Error(`${verb}: key must be a non-empty string`);\n }\n}\nfunction assertSecureStoreValue(value, verb) {\n if (typeof value !== \"string\") {\n throw new Error(`${verb}: value must be a string`);\n }\n}\nexport {\n assertSecureStoreKey,\n assertSecureStoreValue\n};\n//# sourceMappingURL=validate.js.map\n"],"mappings":";AAAA,SAAS,qBAAqB,KAAK,MAAM;CACvC,IAAI,OAAO,QAAQ,YAAY,IAAI,WAAW,GAAG;EAC/C,MAAM,IAAI,MAAM,GAAG,KAAK,iCAAiC;CAC3D;AACF;AACA,SAAS,uBAAuB,OAAO,MAAM;CAC3C,IAAI,OAAO,UAAU,UAAU;EAC7B,MAAM,IAAI,MAAM,GAAG,KAAK,yBAAyB;CACnD;AACF"}
|
|
1
|
+
{"version":3,"file":"validate.native.js","names":[],"sources":["esm/platform/secure-store/validate.native.js"],"sourcesContent":["function assertSecureStoreKey(key, verb) {\n if (typeof key !== \"string\" || key.length === 0) {\n throw new Error(`${verb}: key must be a non-empty string`);\n }\n}\nfunction assertSecureStoreValue(value, verb) {\n if (typeof value !== \"string\") {\n throw new Error(`${verb}: value must be a string`);\n }\n}\nvar SECURE_STORE_ACCESSIBILITIES = [\n \"afterFirstUnlock\",\n \"afterFirstUnlockThisDeviceOnly\",\n \"always\",\n \"alwaysThisDeviceOnly\",\n \"whenPasscodeSetThisDeviceOnly\",\n \"whenUnlocked\",\n \"whenUnlockedThisDeviceOnly\"\n];\nfunction assertSecureStoreOptions(options, verb) {\n if (options === void 0) return {};\n if (typeof options !== \"object\" || options === null || Array.isArray(options)) {\n throw new Error(`${verb}: options must be an object`);\n }\n var { keychainService, keychainAccessible, requireAuthentication, authenticationPrompt, accessGroup } = options;\n if (keychainService !== void 0 && typeof keychainService !== \"string\") {\n throw new Error(`${verb}: options.keychainService must be a string`);\n }\n if (keychainAccessible !== void 0 && !SECURE_STORE_ACCESSIBILITIES.includes(keychainAccessible)) {\n throw new Error(`${verb}: options.keychainAccessible must be one of: ${SECURE_STORE_ACCESSIBILITIES.join(\", \")}`);\n }\n if (requireAuthentication !== void 0 && typeof requireAuthentication !== \"boolean\") {\n throw new Error(`${verb}: options.requireAuthentication must be a boolean`);\n }\n if (authenticationPrompt !== void 0 && typeof authenticationPrompt !== \"string\") {\n throw new Error(`${verb}: options.authenticationPrompt must be a string`);\n }\n if (accessGroup !== void 0 && typeof accessGroup !== \"string\") {\n throw new Error(`${verb}: options.accessGroup must be a string`);\n }\n return options;\n}\nexport {\n SECURE_STORE_ACCESSIBILITIES,\n assertSecureStoreKey,\n assertSecureStoreOptions,\n assertSecureStoreValue\n};\n//# sourceMappingURL=validate.js.map\n"],"mappings":";AAAA,SAAS,qBAAqB,KAAK,MAAM;CACvC,IAAI,OAAO,QAAQ,YAAY,IAAI,WAAW,GAAG;EAC/C,MAAM,IAAI,MAAM,GAAG,KAAK,iCAAiC;CAC3D;AACF;AACA,SAAS,uBAAuB,OAAO,MAAM;CAC3C,IAAI,OAAO,UAAU,UAAU;EAC7B,MAAM,IAAI,MAAM,GAAG,KAAK,yBAAyB;CACnD;AACF;AACA,IAAI,+BAA+B;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,SAAS,yBAAyB,SAAS,MAAM;CAC/C,IAAI,YAAY,KAAK,GAAG,OAAO,CAAC;CAChC,IAAI,OAAO,YAAY,YAAY,YAAY,QAAQ,MAAM,QAAQ,OAAO,GAAG;EAC7E,MAAM,IAAI,MAAM,GAAG,KAAK,4BAA4B;CACtD;CACA,IAAI,EAAE,iBAAiB,oBAAoB,uBAAuB,sBAAsB,gBAAgB;CACxG,IAAI,oBAAoB,KAAK,KAAK,OAAO,oBAAoB,UAAU;EACrE,MAAM,IAAI,MAAM,GAAG,KAAK,2CAA2C;CACrE;CACA,IAAI,uBAAuB,KAAK,KAAK,CAAC,6BAA6B,SAAS,kBAAkB,GAAG;EAC/F,MAAM,IAAI,MAAM,GAAG,KAAK,+CAA+C,6BAA6B,KAAK,IAAI,GAAG;CAClH;CACA,IAAI,0BAA0B,KAAK,KAAK,OAAO,0BAA0B,WAAW;EAClF,MAAM,IAAI,MAAM,GAAG,KAAK,kDAAkD;CAC5E;CACA,IAAI,yBAAyB,KAAK,KAAK,OAAO,yBAAyB,UAAU;EAC/E,MAAM,IAAI,MAAM,GAAG,KAAK,gDAAgD;CAC1E;CACA,IAAI,gBAAgB,KAAK,KAAK,OAAO,gBAAgB,UAAU;EAC7D,MAAM,IAAI,MAAM,GAAG,KAAK,uCAAuC;CACjE;CACA,OAAO;AACT"}
|
|
@@ -2,6 +2,123 @@ import NitroModules
|
|
|
2
2
|
import UIKit
|
|
3
3
|
|
|
4
4
|
final class HybridOneDevice: HybridOneDeviceSpec {
|
|
5
|
+
private let lock = NSLock()
|
|
6
|
+
private var listeners: [Int: () -> Void] = [:]
|
|
7
|
+
private var nextListenerId = 0
|
|
8
|
+
private var observers: [NSObjectProtocol] = []
|
|
9
|
+
|
|
10
|
+
// like expo-localization, each preferred language contributes its own
|
|
11
|
+
// language fields, while separators, measurement, currency and temperature
|
|
12
|
+
// come from the device's current settings.
|
|
13
|
+
func getLocales() throws -> [LocaleInfo] {
|
|
14
|
+
let current = Locale.current
|
|
15
|
+
let regionCode = current.region?.identifier
|
|
16
|
+
let temperatureUnit = Self.temperatureUnit(current)
|
|
17
|
+
return Locale.preferredLanguages.map { identifier in
|
|
18
|
+
let locale = Locale(identifier: identifier)
|
|
19
|
+
return LocaleInfo(
|
|
20
|
+
languageTag: locale.identifier(.bcp47),
|
|
21
|
+
languageCode: locale.language.languageCode?.identifier,
|
|
22
|
+
// only a script the tag names, as expo and android report it.
|
|
23
|
+
languageScriptCode: Locale.Components(locale: locale).languageComponents.script?.identifier,
|
|
24
|
+
regionCode: regionCode,
|
|
25
|
+
languageRegionCode: locale.region?.identifier ?? regionCode,
|
|
26
|
+
currencyCode: current.currency?.identifier,
|
|
27
|
+
currencySymbol: current.currencySymbol,
|
|
28
|
+
languageCurrencyCode: locale.currency?.identifier,
|
|
29
|
+
languageCurrencySymbol: locale.currencySymbol,
|
|
30
|
+
decimalSeparator: current.decimalSeparator,
|
|
31
|
+
digitGroupingSeparator: current.groupingSeparator,
|
|
32
|
+
textDirection: Locale.characterDirection(
|
|
33
|
+
forLanguage: locale.language.languageCode?.identifier ?? identifier) == .rightToLeft
|
|
34
|
+
? "rtl" : "ltr",
|
|
35
|
+
measurementSystem: Self.measurementSystem(current.measurementSystem),
|
|
36
|
+
temperatureUnit: temperatureUnit
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
func getCalendars() throws -> [CalendarInfo] {
|
|
42
|
+
let calendar = Calendar.current
|
|
43
|
+
let template = DateFormatter.dateFormat(fromTemplate: "j", options: 0, locale: .current) ?? ""
|
|
44
|
+
return [
|
|
45
|
+
CalendarInfo(
|
|
46
|
+
calendar: Self.unicodeCalendar(calendar.identifier),
|
|
47
|
+
timeZone: TimeZone.current.identifier,
|
|
48
|
+
uses24hourClock: template.contains("H") || template.contains("k"),
|
|
49
|
+
firstWeekday: Double(calendar.firstWeekday)
|
|
50
|
+
)
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// the first listener starts the observers and the last removal stops them,
|
|
55
|
+
// so a locale change can never race the subscription.
|
|
56
|
+
func addLocalizationListener(listener: @escaping () -> Void) throws -> () -> Void {
|
|
57
|
+
lock.lock()
|
|
58
|
+
defer { lock.unlock() }
|
|
59
|
+
let id = nextListenerId
|
|
60
|
+
nextListenerId += 1
|
|
61
|
+
listeners[id] = listener
|
|
62
|
+
if observers.isEmpty {
|
|
63
|
+
let center = NotificationCenter.default
|
|
64
|
+
for name in [NSLocale.currentLocaleDidChangeNotification, .NSSystemTimeZoneDidChange] {
|
|
65
|
+
observers.append(
|
|
66
|
+
center.addObserver(forName: name, object: nil, queue: .main) { [weak self] _ in
|
|
67
|
+
self?.emit()
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return { [weak self] in self?.removeListener(id) }
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private func emit() {
|
|
75
|
+
lock.lock()
|
|
76
|
+
let current = Array(listeners.values)
|
|
77
|
+
lock.unlock()
|
|
78
|
+
current.forEach { $0() }
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private func removeListener(_ id: Int) {
|
|
82
|
+
lock.lock()
|
|
83
|
+
defer { lock.unlock() }
|
|
84
|
+
listeners.removeValue(forKey: id)
|
|
85
|
+
if listeners.isEmpty {
|
|
86
|
+
observers.forEach { NotificationCenter.default.removeObserver($0) }
|
|
87
|
+
observers = []
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// the unit the device's own formatter shows for a temperature, which
|
|
92
|
+
// follows the user's temperature setting, not just the region.
|
|
93
|
+
private static func temperatureUnit(_ locale: Locale) -> String {
|
|
94
|
+
let formatter = MeasurementFormatter()
|
|
95
|
+
formatter.locale = locale
|
|
96
|
+
let shown = formatter.string(from: Measurement(value: 0, unit: UnitTemperature.celsius))
|
|
97
|
+
return shown.hasSuffix("F") ? "fahrenheit" : "celsius"
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private static func measurementSystem(_ system: Locale.MeasurementSystem) -> String {
|
|
101
|
+
switch system {
|
|
102
|
+
case .us: return "us"
|
|
103
|
+
case .uk: return "uk"
|
|
104
|
+
default: return "metric"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// foundation calendar identifiers to unicode calendar types, expo's terms.
|
|
109
|
+
private static func unicodeCalendar(_ identifier: Calendar.Identifier) -> String {
|
|
110
|
+
switch identifier {
|
|
111
|
+
case .gregorian: return "gregory"
|
|
112
|
+
case .ethiopicAmeteMihret: return "ethiopic"
|
|
113
|
+
case .ethiopicAmeteAlem: return "ethioaa"
|
|
114
|
+
case .islamicCivil: return "islamic-civil"
|
|
115
|
+
case .islamicTabular: return "islamic-tbla"
|
|
116
|
+
case .islamicUmmAlQura: return "islamic-umalqura"
|
|
117
|
+
case .republicOfChina: return "roc"
|
|
118
|
+
default: return String(describing: identifier)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
5
122
|
func getInfo() throws -> Promise<DeviceInfo> {
|
|
6
123
|
let promise = Promise<DeviceInfo>()
|
|
7
124
|
DispatchQueue.main.async {
|
|
@@ -37,6 +37,10 @@ final class HybridOneHaptics: HybridOneHapticsSpec {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
// android-only feedback: expo-haptics returns without effect off android,
|
|
41
|
+
// so ios validates at the js boundary and does nothing here.
|
|
42
|
+
func performAndroidHaptics(type: AndroidHaptic) throws {}
|
|
43
|
+
|
|
40
44
|
func notification(type: HapticNotification) throws {
|
|
41
45
|
DispatchQueue.main.async {
|
|
42
46
|
let feedbackType: UINotificationFeedbackGenerator.FeedbackType
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import CoreImage
|
|
2
2
|
import Foundation
|
|
3
3
|
import NitroModules
|
|
4
|
+
import SDWebImageWebPCoder
|
|
4
5
|
import UIKit
|
|
5
6
|
|
|
6
7
|
final class HybridOneImageManipulator: HybridOneImageManipulatorSpec {
|
|
@@ -92,18 +93,26 @@ final class HybridOneImageManipulator: HybridOneImageManipulatorSpec {
|
|
|
92
93
|
default: throw Problem.input("rotate must be 0, 90, 180, or 270 degrees")
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
|
-
let
|
|
96
|
+
if let flip = options.flip {
|
|
97
|
+
switch flip {
|
|
98
|
+
case .horizontal:
|
|
99
|
+
image = image.transformed(by: CGAffineTransform(a: -1, b: 0, c: 0, d: 1, tx: CGFloat(width), ty: 0))
|
|
100
|
+
case .vertical:
|
|
101
|
+
image = image.transformed(by: CGAffineTransform(a: 1, b: 0, c: 0, d: -1, tx: 0, ty: CGFloat(height)))
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
let quality: Double
|
|
96
105
|
switch options.format {
|
|
97
|
-
case .jpeg:
|
|
98
|
-
|
|
99
|
-
guard
|
|
100
|
-
throw Problem.input("
|
|
106
|
+
case .jpeg, .webp:
|
|
107
|
+
quality = options.quality ?? 0.9
|
|
108
|
+
guard quality.isFinite, (0...1).contains(quality) else {
|
|
109
|
+
throw Problem.input("quality must be between 0 and 1")
|
|
101
110
|
}
|
|
102
111
|
case .png:
|
|
103
112
|
guard options.quality == nil else {
|
|
104
|
-
throw Problem.input("quality applies only to JPEG")
|
|
113
|
+
throw Problem.input("quality applies only to JPEG or WebP")
|
|
105
114
|
}
|
|
106
|
-
|
|
115
|
+
quality = 0
|
|
107
116
|
}
|
|
108
117
|
try checkOutputSize(width, height)
|
|
109
118
|
guard let cgImage = context.createCGImage(image, from: CGRect(
|
|
@@ -114,11 +123,14 @@ final class HybridOneImageManipulator: HybridOneImageManipulatorSpec {
|
|
|
114
123
|
let ext: String
|
|
115
124
|
switch options.format {
|
|
116
125
|
case .jpeg:
|
|
117
|
-
data = output.jpegData(compressionQuality: CGFloat(
|
|
126
|
+
data = output.jpegData(compressionQuality: CGFloat(quality))
|
|
118
127
|
ext = "jpg"
|
|
119
128
|
case .png:
|
|
120
129
|
data = output.pngData()
|
|
121
130
|
ext = "png"
|
|
131
|
+
case .webp:
|
|
132
|
+
data = Self.webPData(output, quality: quality)
|
|
133
|
+
ext = "webp"
|
|
122
134
|
}
|
|
123
135
|
guard let data else { throw Problem.encode }
|
|
124
136
|
let folder = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask)[0]
|
|
@@ -130,6 +142,11 @@ final class HybridOneImageManipulator: HybridOneImageManipulatorSpec {
|
|
|
130
142
|
uri: destination.absoluteString, width: Double(width), height: Double(height), size: Double(data.count))
|
|
131
143
|
}
|
|
132
144
|
|
|
145
|
+
private static func webPData(_ image: UIImage, quality: Double) -> Data? {
|
|
146
|
+
SDImageWebPCoder.sharedCoder.encodedData(
|
|
147
|
+
with: image, format: .webP, options: [.encodeCompressionQuality: quality])
|
|
148
|
+
}
|
|
149
|
+
|
|
133
150
|
private static func normalized(_ image: CIImage) -> CIImage {
|
|
134
151
|
image.transformed(by: CGAffineTransform(
|
|
135
152
|
translationX: -image.extent.minX, y: -image.extent.minY))
|
|
@@ -2,10 +2,17 @@ import NitroModules
|
|
|
2
2
|
import UIKit
|
|
3
3
|
|
|
4
4
|
final class HybridOneKeepAwake: HybridOneKeepAwakeSpec {
|
|
5
|
+
private static let defaultTag = "ExpoKeepAwakeDefaultTag"
|
|
6
|
+
private var tags = Set<String>()
|
|
7
|
+
|
|
8
|
+
private func apply() {
|
|
9
|
+
UIApplication.shared.isIdleTimerDisabled = !tags.isEmpty
|
|
10
|
+
}
|
|
11
|
+
|
|
5
12
|
func isEnabled() throws -> Promise<Bool> {
|
|
6
13
|
let promise = Promise<Bool>()
|
|
7
14
|
DispatchQueue.main.async {
|
|
8
|
-
promise.resolve(withResult:
|
|
15
|
+
promise.resolve(withResult: !self.tags.isEmpty)
|
|
9
16
|
}
|
|
10
17
|
return promise
|
|
11
18
|
}
|
|
@@ -13,7 +20,32 @@ final class HybridOneKeepAwake: HybridOneKeepAwakeSpec {
|
|
|
13
20
|
func setEnabled(enabled: Bool) throws -> Promise<Void> {
|
|
14
21
|
let promise = Promise<Void>()
|
|
15
22
|
DispatchQueue.main.async {
|
|
16
|
-
|
|
23
|
+
if enabled {
|
|
24
|
+
self.tags.insert(Self.defaultTag)
|
|
25
|
+
} else {
|
|
26
|
+
self.tags.remove(Self.defaultTag)
|
|
27
|
+
}
|
|
28
|
+
self.apply()
|
|
29
|
+
promise.resolve(withResult: ())
|
|
30
|
+
}
|
|
31
|
+
return promise
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
func activate(tag: String) throws -> Promise<Void> {
|
|
35
|
+
let promise = Promise<Void>()
|
|
36
|
+
DispatchQueue.main.async {
|
|
37
|
+
self.tags.insert(tag)
|
|
38
|
+
self.apply()
|
|
39
|
+
promise.resolve(withResult: ())
|
|
40
|
+
}
|
|
41
|
+
return promise
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
func deactivate(tag: String) throws -> Promise<Void> {
|
|
45
|
+
let promise = Promise<Void>()
|
|
46
|
+
DispatchQueue.main.async {
|
|
47
|
+
self.tags.remove(tag)
|
|
48
|
+
self.apply()
|
|
17
49
|
promise.resolve(withResult: ())
|
|
18
50
|
}
|
|
19
51
|
return promise
|