@sanctum-key/react-native-sdk 1.0.6 → 1.0.8
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/README.md +3 -3
- package/android/build/.transforms/{f62cb96b2d1f78ca96ab35932dd530dc → c9d62bb333688ab562f51958998d5a48}/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/generated/source/buildConfig/debug/kyc/{transfergratis → SanctumKey}/com/BuildConfig.java +2 -2
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +1 -1
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +1 -1
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +2 -2
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/kyc/SanctumKey/com/BuildConfig.class +0 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +1 -1
- package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +1 -1
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +1 -1
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +1 -1
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/SanctumKey/com/SanctumKeySdkModule$definition$1$5$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/SanctumKey/com/SanctumKeySdkModule$definition$1$5$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$1.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunction$1.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$2.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunction$2.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$3.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunction$3.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$4.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunction$4.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$5.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunction$5.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunction$6.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunction$6.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$1.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$1.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$2.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$2.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$3.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$3.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$4.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$AsyncFunctionWithPromise$4.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$$inlined$View$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$lambda$4$$inlined$Prop$1.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$lambda$4$$inlined$Prop$1.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule$definition$lambda$5$lambda$4$$inlined$Prop$2.class → SanctumKey/com/SanctumKeySdkModule$definition$lambda$5$lambda$4$$inlined$Prop$2.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkModule.class → SanctumKey/com/SanctumKeySdkModule.class} +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/{transfergratis/com/TransfergratisSdkView.class → SanctumKey/com/SanctumKeySdkView.class} +0 -0
- package/android/build.gradle +2 -2
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/kyc/transfergratis/com/TransfergratisSdkModule.kt +6 -6
- package/android/src/main/java/kyc/transfergratis/com/TransfergratisSdkView.kt +2 -2
- package/build/package.json +9 -7
- package/build/src/App.d.ts +2 -2
- package/build/src/App.d.ts.map +1 -1
- package/build/src/App.js +2 -2
- package/build/src/App.js.map +1 -1
- package/build/src/{TransfergratisSdk.types.d.ts → SanctumKeySdk.types.d.ts} +3 -3
- package/build/src/SanctumKeySdk.types.d.ts.map +1 -0
- package/build/src/SanctumKeySdk.types.js +2 -0
- package/build/src/SanctumKeySdk.types.js.map +1 -0
- package/build/src/{TransfergratisSdkModule.d.ts → SanctumKeySdkModule.d.ts} +4 -4
- package/build/src/SanctumKeySdkModule.d.ts.map +1 -0
- package/build/src/{TransfergratisSdkModule.js → SanctumKeySdkModule.js} +2 -2
- package/build/src/SanctumKeySdkModule.js.map +1 -0
- package/build/src/{TransfergratisSdkModule.web.d.ts → SanctumKeySdkModule.web.d.ts} +4 -4
- package/build/src/SanctumKeySdkModule.web.d.ts.map +1 -0
- package/build/src/{TransfergratisSdkModule.web.js → SanctumKeySdkModule.web.js} +3 -3
- package/build/src/SanctumKeySdkModule.web.js.map +1 -0
- package/build/src/SanctumKeySdkView.d.ts +4 -0
- package/build/src/SanctumKeySdkView.d.ts.map +1 -0
- package/build/src/SanctumKeySdkView.js +7 -0
- package/build/src/SanctumKeySdkView.js.map +1 -0
- package/build/src/SanctumKeySdkView.web.d.ts +4 -0
- package/build/src/SanctumKeySdkView.web.d.ts.map +1 -0
- package/build/src/{TransfergratisSdkView.web.js → SanctumKeySdkView.web.js} +2 -2
- package/build/src/SanctumKeySdkView.web.js.map +1 -0
- package/build/src/api/axios.js +2 -2
- package/build/src/api/axios.js.map +1 -1
- package/build/src/components/EnhancedCameraView.d.ts.map +1 -1
- package/build/src/components/EnhancedCameraView.js +107 -330
- package/build/src/components/EnhancedCameraView.js.map +1 -1
- package/build/src/components/KYCElements/EmailVerificationTemplate.d.ts.map +1 -1
- package/build/src/components/KYCElements/EmailVerificationTemplate.js +114 -15
- package/build/src/components/KYCElements/EmailVerificationTemplate.js.map +1 -1
- package/build/src/components/KYCElements/IDCardCapture.d.ts.map +1 -1
- package/build/src/components/KYCElements/IDCardCapture.js +166 -695
- package/build/src/components/KYCElements/IDCardCapture.js.map +1 -1
- package/build/src/components/KYCElements/PhoneVerificationTemplate.d.ts.map +1 -1
- package/build/src/components/KYCElements/PhoneVerificationTemplate.js +282 -40
- package/build/src/components/KYCElements/PhoneVerificationTemplate.js.map +1 -1
- package/build/src/components/KYCElements/SelfieCapture.d.ts +1 -1
- package/build/src/components/KYCElements/SelfieCapture.d.ts.map +1 -1
- package/build/src/components/KYCElements/SelfieCapture.js +130 -192
- package/build/src/components/KYCElements/SelfieCapture.js.map +1 -1
- package/build/src/components/KYCElements/SelfieCaptureTemplate.d.ts.map +1 -1
- package/build/src/components/KYCElements/SelfieCaptureTemplate.js +131 -433
- package/build/src/components/KYCElements/SelfieCaptureTemplate.js.map +1 -1
- package/build/src/components/NativeCameraView.js +1 -1
- package/build/src/components/NativeCameraView.js.map +1 -1
- package/build/src/components/OverLay/IdCard.d.ts +3 -2
- package/build/src/components/OverLay/IdCard.d.ts.map +1 -1
- package/build/src/components/OverLay/IdCard.js +149 -141
- package/build/src/components/OverLay/IdCard.js.map +1 -1
- package/build/src/components/OverLay/SelfieOverlay.d.ts +2 -1
- package/build/src/components/OverLay/SelfieOverlay.d.ts.map +1 -1
- package/build/src/components/OverLay/SelfieOverlay.js +37 -95
- package/build/src/components/OverLay/SelfieOverlay.js.map +1 -1
- package/build/src/components/OverLay/type.d.ts +1 -0
- package/build/src/components/OverLay/type.d.ts.map +1 -1
- package/build/src/components/OverLay/type.js.map +1 -1
- package/build/src/components/Svgs/scanningLine.d.ts +2 -1
- package/build/src/components/Svgs/scanningLine.d.ts.map +1 -1
- package/build/src/components/Svgs/scanningLine.js +55 -51
- package/build/src/components/Svgs/scanningLine.js.map +1 -1
- package/build/src/config/KYCConfig.js +1 -1
- package/build/src/config/KYCConfig.js.map +1 -1
- package/build/src/config/allowedDomains.js +6 -6
- package/build/src/config/allowedDomains.js.map +1 -1
- package/build/src/hooks/useTemplateKYCFlow.d.ts.map +1 -1
- package/build/src/hooks/useTemplateKYCFlow.js +37 -38
- package/build/src/hooks/useTemplateKYCFlow.js.map +1 -1
- package/build/src/index.d.ts +3 -3
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +3 -3
- package/build/src/index.js.map +1 -1
- package/build/src/modules/api/CardAuthentification.d.ts +0 -5
- package/build/src/modules/api/CardAuthentification.d.ts.map +1 -1
- package/build/src/modules/api/CardAuthentification.js +114 -116
- package/build/src/modules/api/CardAuthentification.js.map +1 -1
- package/build/src/modules/api/KYCService.d.ts +12 -1
- package/build/src/modules/api/KYCService.d.ts.map +1 -1
- package/build/src/modules/api/KYCService.js +102 -38
- package/build/src/modules/api/KYCService.js.map +1 -1
- package/build/src/modules/camera/NativeCameraModule.js +17 -17
- package/build/src/modules/camera/NativeCameraModule.js.map +1 -1
- package/expo-module.config.json +2 -2
- package/ios/TransfergratisSdk.podspec +2 -2
- package/ios/TransfergratisSdkModule.swift +12 -12
- package/package.json +9 -7
- package/src/App.tsx +2 -2
- package/src/{TransfergratisSdk.types.ts → SanctumKeySdk.types.ts} +2 -2
- package/src/{TransfergratisSdkModule.ts → SanctumKeySdkModule.ts} +3 -3
- package/src/{TransfergratisSdkModule.web.ts → SanctumKeySdkModule.web.ts} +3 -3
- package/src/SanctumKeySdkView.tsx +11 -0
- package/src/{TransfergratisSdkView.web.tsx → SanctumKeySdkView.web.tsx} +2 -2
- package/src/api/axios.ts +2 -2
- package/src/components/EnhancedCameraView.tsx +131 -385
- package/src/components/KYCElements/EmailVerificationTemplate.tsx +141 -26
- package/src/components/KYCElements/IDCardCapture.tsx +228 -868
- package/src/components/KYCElements/PhoneVerificationTemplate.tsx +342 -60
- package/src/components/KYCElements/SelfieCapture.tsx +184 -213
- package/src/components/KYCElements/SelfieCaptureTemplate.tsx +330 -662
- package/src/components/NativeCameraView.tsx +1 -1
- package/src/components/OverLay/IdCard.tsx +218 -217
- package/src/components/OverLay/SelfieOverlay.tsx +56 -134
- package/src/components/OverLay/type.ts +1 -0
- package/src/components/Svgs/scanningLine.tsx +71 -72
- package/src/config/KYCConfig.ts +1 -1
- package/src/config/allowedDomains.ts +6 -6
- package/src/hooks/useTemplateKYCFlow.tsx +45 -39
- package/src/i18n/README.md +1 -1
- package/src/index.ts +3 -3
- package/src/modules/api/CardAuthentification.ts +202 -200
- package/src/modules/api/KYCService.ts +169 -53
- package/src/modules/camera/NativeCameraModule.ts +17 -17
- package/android/build/tmp/kotlin-classes/debug/kyc/transfergratis/com/TransfergratisSdkModule$definition$1$5$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/transfergratis/com/TransfergratisSdkModule$definition$1$5$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kyc/transfergratis/com/TransfergratisSdkModule$definition$lambda$5$$inlined$View$1.class +0 -0
- package/build/src/TransfergratisSdk.types.d.ts.map +0 -1
- package/build/src/TransfergratisSdk.types.js +0 -2
- package/build/src/TransfergratisSdk.types.js.map +0 -1
- package/build/src/TransfergratisSdkModule.d.ts.map +0 -1
- package/build/src/TransfergratisSdkModule.js.map +0 -1
- package/build/src/TransfergratisSdkModule.web.d.ts.map +0 -1
- package/build/src/TransfergratisSdkModule.web.js.map +0 -1
- package/build/src/TransfergratisSdkView.d.ts +0 -4
- package/build/src/TransfergratisSdkView.d.ts.map +0 -1
- package/build/src/TransfergratisSdkView.js +0 -7
- package/build/src/TransfergratisSdkView.js.map +0 -1
- package/build/src/TransfergratisSdkView.web.d.ts +0 -4
- package/build/src/TransfergratisSdkView.web.d.ts.map +0 -1
- package/build/src/TransfergratisSdkView.web.js.map +0 -1
- package/src/TransfergratisSdkView.tsx +0 -11
- /package/android/build/.transforms/{532c0e65d82f446633d0a7dab2772198 → ab90740579f5bd05b27b4343ada2d1c9}/results.bin +0 -0
- /package/android/build/.transforms/{532c0e65d82f446633d0a7dab2772198 → ab90740579f5bd05b27b4343ada2d1c9}/transformed/classes/classes_dex/classes.dex +0 -0
- /package/android/build/.transforms/{f62cb96b2d1f78ca96ab35932dd530dc → c9d62bb333688ab562f51958998d5a48}/results.bin +0 -0
- /package/android/build/{intermediates/javac/debug/compileDebugJavaWithJavac/classes/kyc/transfergratis/com/BuildConfig.class → tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/BuildConfig.class.uniqueId0} +0 -0
package/build/src/api/axios.js
CHANGED
|
@@ -81,12 +81,12 @@ export class HttpClient {
|
|
|
81
81
|
export default HttpClient;
|
|
82
82
|
// ml service api
|
|
83
83
|
export const mlService = new HttpClient({
|
|
84
|
-
baseURL: 'https://api.ml.
|
|
84
|
+
baseURL: 'https://api.ml.SanctumKey.com',
|
|
85
85
|
apiKey: 'your-api-key',
|
|
86
86
|
});
|
|
87
87
|
// backedn service api
|
|
88
88
|
export const backendService = new HttpClient({
|
|
89
|
-
baseURL: 'https://api.backend.
|
|
89
|
+
baseURL: 'https://api.backend.SanctumKey.com',
|
|
90
90
|
apiKey: 'your-api-key',
|
|
91
91
|
});
|
|
92
92
|
//# sourceMappingURL=axios.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axios.js","sourceRoot":"","sources":["../../../src/api/axios.ts"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAef,MAAM,OAAO,UAAU;IACX,QAAQ,CAAgB;IACxB,MAAM,CAAU;IAChB,SAAS,CAAU;IAE3B,YAAY,aAA+B;QACvC,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC;YACzB,OAAO,EAAE,aAAa,CAAC,OAAO;YAC9B,OAAO,EAAE,aAAa,CAAC,SAAS,IAAI,KAAK;YACzC,OAAO,EAAE;gBACL,MAAM,EAAE,kBAAkB;gBAC1B,cAAc,EAAE,kBAAkB;aACrC;SACJ,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAClC,CAAC,OAAmC,EAAE,EAAE;YACpC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;YACtC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;gBACvC,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;YACvC,CAAC;YACD,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ig,\n InternalAxiosRequestConfig,\n AxiosResponse,\n} from 'axios';\n\nexport type ApiConfiguration = {\n baseURL: string;\n apiKey?: string;\n authToken?: string;\n timeoutMs?: number;\n};\n\nexport type ApiErrorData = {\n message?: string;\n code?: string | number;\n details?: unknown;\n};\n\nexport class HttpClient {\n private instance: AxiosInstance;\n private apiKey?: string;\n private authToken?: string;\n\n constructor(configuration: ApiConfiguration) {\n this.apiKey = configuration.apiKey;\n this.authToken = configuration.authToken;\n this.instance = axios.create({\n baseURL: configuration.baseURL,\n timeout: configuration.timeoutMs ?? 15000,\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n });\n\n this.instance.interceptors.request.use(\n (request: InternalAxiosRequestConfig) => {\n const headers = request.headers ?? {};\n if (this.apiKey && !headers['x-api-key']) {\n headers['x-api-key'] = this.apiKey;\n }\n if (this.authToken && !headers.Authorization) {\n headers.Authorization = `Bearer ${this.authToken}`;\n }\n request.headers = headers;\n return request;\n },\n (error) => Promise.reject(error)\n );\n\n this.instance.interceptors.response.use(\n (response: AxiosResponse) => response,\n (error) => {\n if (!error.response) {\n return Promise.reject({\n message: 'Network error. Please check your connection.',\n code: 'network_error',\n details: error?.message,\n } as ApiErrorData);\n }\n const { status, data } = error.response as AxiosResponse<ApiErrorData>;\n if (status === 401) {\n return Promise.reject({\n message: data?.message || 'Unauthorized',\n code: 401,\n details: data,\n } as ApiErrorData);\n }\n return Promise.reject({\n message: data?.message || 'Request failed',\n code: status,\n details: data,\n } as ApiErrorData);\n }\n );\n }\n\n setAuthToken(token?: string): void {\n this.authToken = token;\n }\n\n setApiKey(key?: string): void {\n this.apiKey = key;\n }\n\n setBaseURL(url: string): void {\n this.instance.defaults.baseURL = url;\n }\n\n async get<T = unknown>(url: string, requestConfig?: AxiosRequestConfig): Promise<T> {\n const res = await this.instance.get<T>(url, requestConfig);\n return res.data as T;\n }\n\n async post<T = unknown, B = unknown>(\n url: string,\n body?: B,\n requestConfig?: AxiosRequestConfig\n ): Promise<T> {\n const res = await this.instance.post<T>(url, body, requestConfig);\n return res.data as T;\n }\n\n async put<T = unknown, B = unknown>(\n url: string,\n body?: B,\n requestConfig?: AxiosRequestConfig\n ): Promise<T> {\n const res = await this.instance.put<T>(url, body, requestConfig);\n return res.data as T;\n }\n\n async patch<T = unknown, B = unknown>(\n url: string,\n body?: B,\n requestConfig?: AxiosRequestConfig\n ): Promise<T> {\n const res = await this.instance.patch<T>(url, body, requestConfig);\n return res.data as T;\n }\n\n async delete<T = unknown>(url: string, requestConfig?: AxiosRequestConfig): Promise<T> {\n const res = await this.instance.delete<T>(url, requestConfig);\n return res.data as T;\n }\n}\n\nexport default HttpClient;\n\n\n// ml service api\nexport const mlService = new HttpClient({\n baseURL: 'https://api.ml.SanctumKey.com',\n apiKey: 'your-api-key',\n});\n// backedn service api\nexport const backendService = new HttpClient({\n baseURL: 'https://api.backend.SanctumKey.com',\n apiKey: 'your-api-key',\n});\n\n\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnhancedCameraView.d.ts","sourceRoot":"","sources":["../../../src/components/EnhancedCameraView.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"EnhancedCameraView.d.ts","sourceRoot":"","sources":["../../../src/components/EnhancedCameraView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAKxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAGzD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA6MhE,CAAC"}
|
|
@@ -1,51 +1,31 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useRef, useState
|
|
2
|
-
import { View, StyleSheet,
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { View, StyleSheet, Text, AppState, ActivityIndicator } from 'react-native';
|
|
3
3
|
import { Camera, useCameraDevice } from 'react-native-vision-camera';
|
|
4
4
|
import VisionCameraModule from '../modules/camera/VisionCameraModule';
|
|
5
5
|
import { useI18n } from '../hooks/useI18n';
|
|
6
6
|
import { Button } from './ui/Button';
|
|
7
|
-
export const EnhancedCameraView = ({ showCamera, cameraType: initialCameraType = 'front', style,
|
|
7
|
+
export const EnhancedCameraView = ({ showCamera, cameraType: initialCameraType = 'front', style, onError, onSilentCapture, silentCaptureResult, isProcessing = false, overlayComponent, }) => {
|
|
8
8
|
const { t } = useI18n();
|
|
9
9
|
const camera = useRef(null);
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const isCapturingRef = useRef(false);
|
|
11
|
+
const isProcessingRef = useRef(isProcessing);
|
|
12
|
+
const [cameraType] = useState(initialCameraType);
|
|
13
|
+
const [hasPermission, setHasPermission] = useState(null);
|
|
12
14
|
const [isInitialized, setIsInitialized] = useState(false);
|
|
13
|
-
const [flash, setFlash] = useState('off');
|
|
14
15
|
const [refreshCamera, setRefreshCamera] = useState(false);
|
|
16
|
+
// 🚨 ADDED: A timeout state to show a refresh button if the camera gets stuck booting
|
|
17
|
+
const [showInitTimeout, setShowInitTimeout] = useState(false);
|
|
15
18
|
const device = useCameraDevice(cameraType);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const bestFormat = useMemo(() => {
|
|
20
|
-
if (!device || !device.formats || device.formats.length === 0) {
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
23
|
-
// Trier les formats en combinant la résolution vidéo (pour la prévisualisation) et photo (pour la capture)
|
|
24
|
-
// On priorise les formats avec une bonne résolution vidéo car c'est ce qui est affiché en temps réel
|
|
25
|
-
const sortedFormats = [...device.formats].sort((a, b) => {
|
|
26
|
-
// Résolution vidéo (pour la prévisualisation live)
|
|
27
|
-
const videoResolutionA = (a.videoWidth || 0) * (a.videoHeight || 0);
|
|
28
|
-
const videoResolutionB = (b.videoWidth || 0) * (b.videoHeight || 0);
|
|
29
|
-
// Résolution photo (pour la capture)
|
|
30
|
-
const photoResolutionA = (a.photoWidth || 0) * (a.photoHeight || 0);
|
|
31
|
-
const photoResolutionB = (b.photoWidth || 0) * (b.photoHeight || 0);
|
|
32
|
-
// Prioriser d'abord la résolution vidéo (prévisualisation), puis la résolution photo
|
|
33
|
-
if (videoResolutionB !== videoResolutionA) {
|
|
34
|
-
return videoResolutionB - videoResolutionA;
|
|
35
|
-
}
|
|
36
|
-
return photoResolutionB - photoResolutionA;
|
|
37
|
-
});
|
|
38
|
-
return sortedFormats[0];
|
|
39
|
-
}, [device]);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
isProcessingRef.current = isProcessing;
|
|
21
|
+
}, [isProcessing]);
|
|
40
22
|
const checkPermissions = async () => {
|
|
41
23
|
try {
|
|
42
24
|
const hasAllPermissions = await VisionCameraModule.hasAllPermissions();
|
|
43
|
-
console.log('hasAllPermissions', hasAllPermissions);
|
|
44
25
|
if (!hasAllPermissions) {
|
|
45
26
|
const granted = await VisionCameraModule.requestAllPermissions();
|
|
46
|
-
console.log('granted', granted);
|
|
47
27
|
if (!granted) {
|
|
48
|
-
|
|
28
|
+
setHasPermission(false);
|
|
49
29
|
onError?.({ message: t('camera.permissionRequired') });
|
|
50
30
|
return;
|
|
51
31
|
}
|
|
@@ -53,341 +33,138 @@ export const EnhancedCameraView = ({ showCamera, cameraType: initialCameraType =
|
|
|
53
33
|
setHasPermission(true);
|
|
54
34
|
}
|
|
55
35
|
catch (error) {
|
|
56
|
-
|
|
36
|
+
setHasPermission(false);
|
|
57
37
|
onError?.({ message: t('camera.errorOccurred') });
|
|
58
38
|
}
|
|
59
39
|
};
|
|
60
|
-
// Check permissions on component mount
|
|
61
40
|
useEffect(() => {
|
|
62
41
|
if (showCamera) {
|
|
42
|
+
setIsInitialized(false); // Reset init state when checking permissions/refreshing
|
|
63
43
|
checkPermissions();
|
|
64
44
|
}
|
|
65
45
|
}, [showCamera, refreshCamera]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const subscription = AppState.addEventListener('change', nextAppState => {
|
|
48
|
+
if (nextAppState === 'active' && showCamera && hasPermission === false) {
|
|
49
|
+
checkPermissions();
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return () => subscription.remove();
|
|
53
|
+
}, [showCamera, hasPermission]);
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
let timer;
|
|
56
|
+
if (hasPermission && device && showCamera && !isInitialized) {
|
|
57
|
+
timer = setTimeout(() => setShowInitTimeout(true), 3000);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
setShowInitTimeout(false);
|
|
61
|
+
}
|
|
62
|
+
return () => {
|
|
63
|
+
if (timer)
|
|
64
|
+
clearTimeout(timer);
|
|
65
|
+
};
|
|
66
|
+
}, [hasPermission, device, showCamera, isInitialized]);
|
|
66
67
|
const onInitialized = useCallback(() => {
|
|
67
|
-
console.log('Camera initialized!');
|
|
68
68
|
setIsInitialized(true);
|
|
69
|
+
setShowInitTimeout(false);
|
|
69
70
|
}, []);
|
|
70
71
|
const onCameraError = useCallback((error) => {
|
|
71
|
-
console.error('Camera error:', error);
|
|
72
72
|
onError?.({ message: error.message || t('camera.errorOccurred') });
|
|
73
73
|
}, [onError, t]);
|
|
74
74
|
const captureSilentPhoto = useCallback(async () => {
|
|
75
|
-
if (!camera.current || !isInitialized)
|
|
76
|
-
onError?.({ message: t('camera.notReady') });
|
|
75
|
+
if (!camera.current || !isInitialized || isProcessingRef.current || isCapturingRef.current)
|
|
77
76
|
return;
|
|
78
|
-
|
|
79
|
-
console.log('silentCaptureResult', silentCaptureResult);
|
|
80
|
-
if (silentCaptureResult?.isAnalyzing || silentCaptureResult?.success) {
|
|
77
|
+
if (silentCaptureResult?.isAnalyzing)
|
|
81
78
|
return;
|
|
82
|
-
}
|
|
83
79
|
try {
|
|
80
|
+
isCapturingRef.current = true;
|
|
84
81
|
const photo = await camera.current.takePhoto({
|
|
85
|
-
enableShutterSound:
|
|
86
|
-
flash:
|
|
82
|
+
enableShutterSound: false,
|
|
83
|
+
flash: 'off',
|
|
87
84
|
});
|
|
88
85
|
const result = await VisionCameraModule.processPhotoResult(photo);
|
|
89
|
-
onSilentCapture?.(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
}, [isInitialized, onError, onSilentCapture, enableFlash, flash, silentCaptureResult]);
|
|
94
|
-
// Automatically take a silent photo every 5 seconds when ready
|
|
95
|
-
useEffect(() => {
|
|
96
|
-
if (!showCamera || !isInitialized) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
const intervalId = setInterval(() => {
|
|
100
|
-
captureSilentPhoto();
|
|
101
|
-
}, 2500);
|
|
102
|
-
return () => clearInterval(intervalId);
|
|
103
|
-
}, [showCamera, isInitialized, captureSilentPhoto]);
|
|
104
|
-
const capturePhoto = useCallback(async () => {
|
|
105
|
-
try {
|
|
106
|
-
if (!camera.current || !isInitialized) {
|
|
107
|
-
onError?.({ message: t('camera.notReady') });
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
if (silentCaptureResult?.success) {
|
|
111
|
-
onCapture?.({
|
|
112
|
-
success: true,
|
|
113
|
-
path: silentCaptureResult.path,
|
|
114
|
-
});
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const photo = await camera.current.takePhoto({
|
|
118
|
-
enableShutterSound: true,
|
|
119
|
-
flash: enableFlash ? flash : 'off',
|
|
86
|
+
onSilentCapture?.({
|
|
87
|
+
...result,
|
|
88
|
+
path: result.path || photo.path,
|
|
120
89
|
});
|
|
121
|
-
const result = await VisionCameraModule.processPhotoResult(photo);
|
|
122
|
-
onCapture?.(result);
|
|
123
90
|
}
|
|
124
91
|
catch (error) {
|
|
125
|
-
|
|
126
|
-
onCapture?.({
|
|
127
|
-
success: false,
|
|
128
|
-
error: error instanceof Error ? error.message : t('camera.failedToCapture'),
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}, [isInitialized, quality, flash, enableFlash, onCapture, onError]);
|
|
132
|
-
const startVideoRecording = useCallback(async () => {
|
|
133
|
-
try {
|
|
134
|
-
if (!camera.current || !isInitialized) {
|
|
135
|
-
onError?.({ message: t('camera.notReady') });
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
await camera.current.startRecording({
|
|
139
|
-
onRecordingFinished: (video) => {
|
|
140
|
-
onVideoRecordingStop?.({
|
|
141
|
-
success: true,
|
|
142
|
-
path: video.path,
|
|
143
|
-
});
|
|
144
|
-
},
|
|
145
|
-
onRecordingError: (error) => {
|
|
146
|
-
console.error('Recording error:', error);
|
|
147
|
-
onVideoRecordingStop?.({
|
|
148
|
-
success: false,
|
|
149
|
-
error: error.message || t('camera.failedToStartRecording'),
|
|
150
|
-
});
|
|
151
|
-
},
|
|
152
|
-
});
|
|
153
|
-
onVideoRecordingStart?.();
|
|
92
|
+
// Silent background fail
|
|
154
93
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
onVideoRecordingStop?.({
|
|
158
|
-
success: false,
|
|
159
|
-
error: error instanceof Error ? error.message : t('camera.failedToStartRecording'),
|
|
160
|
-
});
|
|
94
|
+
finally {
|
|
95
|
+
isCapturingRef.current = false;
|
|
161
96
|
}
|
|
162
|
-
}, [isInitialized,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
97
|
+
}, [isInitialized, onSilentCapture, silentCaptureResult]);
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (!showCamera || !isInitialized || isProcessing)
|
|
100
|
+
return;
|
|
101
|
+
let isActive = true;
|
|
102
|
+
let intervalId;
|
|
103
|
+
const warmupTimer = setTimeout(() => {
|
|
104
|
+
if (!isActive)
|
|
167
105
|
return;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
//
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
// case 'off': return 'on';
|
|
183
|
-
// case 'on': return 'auto';
|
|
184
|
-
// case 'auto': return 'off';
|
|
185
|
-
// default: return 'off';
|
|
186
|
-
// }
|
|
187
|
-
// });
|
|
188
|
-
// }, []);
|
|
189
|
-
if (!hasPermission) {
|
|
190
|
-
return (<View style={[styles.container, style]}>
|
|
191
|
-
<Text style={styles.permissionMessage}>
|
|
192
|
-
{t('camera.permissionRequired')}
|
|
193
|
-
</Text>
|
|
194
|
-
<Button title="Refresh Camera" onPress={() => setRefreshCamera(!refreshCamera)}/>
|
|
195
|
-
</View>);
|
|
106
|
+
intervalId = setInterval(() => {
|
|
107
|
+
captureSilentPhoto();
|
|
108
|
+
}, 1500);
|
|
109
|
+
}, 1000);
|
|
110
|
+
return () => {
|
|
111
|
+
isActive = false;
|
|
112
|
+
clearTimeout(warmupTimer);
|
|
113
|
+
if (intervalId)
|
|
114
|
+
clearInterval(intervalId);
|
|
115
|
+
};
|
|
116
|
+
}, [showCamera, isInitialized, isProcessing, captureSilentPhoto]);
|
|
117
|
+
// --- RENDERERS ---
|
|
118
|
+
if (hasPermission === null) {
|
|
119
|
+
return <View style={[styles.container, style]}/>;
|
|
196
120
|
}
|
|
197
|
-
if (
|
|
198
|
-
return (<View style={[styles.container, style]}>
|
|
199
|
-
<Text style={styles.
|
|
200
|
-
|
|
201
|
-
</Text>
|
|
121
|
+
if (hasPermission === false) {
|
|
122
|
+
return (<View style={[styles.container, style, styles.centerContent]}>
|
|
123
|
+
<Text style={styles.permissionMessage}>{t('camera.permissionRequired')}</Text>
|
|
124
|
+
<Button title="Refresh Camera" onPress={() => setRefreshCamera(prev => !prev)} variant="primary"/>
|
|
202
125
|
</View>);
|
|
203
126
|
}
|
|
204
|
-
if
|
|
205
|
-
|
|
127
|
+
// 🚨 FIX: Don't return an invisible blank screen if the device is loading!
|
|
128
|
+
// Give them a UI and a way out.
|
|
129
|
+
if (!device || !showCamera) {
|
|
130
|
+
return (<View style={[styles.container, style, styles.centerContent]}>
|
|
131
|
+
<ActivityIndicator size="large" color="#2DBD60" style={{ marginBottom: 16 }}/>
|
|
132
|
+
<Text style={styles.permissionMessage}>Loading Camera Hardware...</Text>
|
|
133
|
+
<Button title="Refresh" onPress={() => setRefreshCamera(prev => !prev)} variant="outline"/>
|
|
134
|
+
</View>);
|
|
206
135
|
}
|
|
207
136
|
return (<View style={[styles.container, style]}>
|
|
208
|
-
<Camera
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
137
|
+
<Camera
|
|
138
|
+
// 🚨 FIX: This key forces the native component to completely remount
|
|
139
|
+
// when permissions are granted or when manually refreshed.
|
|
140
|
+
key={`cam-${hasPermission}-${refreshCamera ? '1' : '0'}`} ref={camera} style={StyleSheet.absoluteFill} device={device} isActive={showCamera && !isProcessing} photo={true} video={false} audio={false} onInitialized={onInitialized} onError={onCameraError}/>
|
|
141
|
+
|
|
142
|
+
{/* 🚨 FIX: Floating Refresh Button if the hardware freezes on a black screen */}
|
|
143
|
+
{!isInitialized && showInitTimeout && (<View style={styles.stuckOverlay}>
|
|
144
|
+
<ActivityIndicator size="large" color="#2DBD60" style={{ marginBottom: 16 }}/>
|
|
145
|
+
<Text style={{ color: 'white', marginBottom: 16, fontWeight: 'bold' }}>
|
|
146
|
+
Camera is taking a while to start...
|
|
147
|
+
</Text>
|
|
148
|
+
<Button title="Restart Camera" onPress={() => {
|
|
149
|
+
setIsInitialized(false);
|
|
150
|
+
setRefreshCamera(prev => !prev);
|
|
151
|
+
}} variant="primary"/>
|
|
152
|
+
</View>)}
|
|
216
153
|
|
|
217
|
-
{/* Custom overlay component */}
|
|
218
154
|
{overlayComponent}
|
|
219
|
-
|
|
220
|
-
{/* Bounding box overlay */}
|
|
221
|
-
{bbox && (<View style={styles.bboxOverlay}>
|
|
222
|
-
<View style={[
|
|
223
|
-
styles.bbox,
|
|
224
|
-
{
|
|
225
|
-
left: `${bbox.xMin}%`,
|
|
226
|
-
top: `${bbox.yMin}%`,
|
|
227
|
-
width: `${bbox.xMax - bbox.xMin}%`,
|
|
228
|
-
height: `${bbox.yMax - bbox.yMin}%`,
|
|
229
|
-
borderColor: bbox.borderColor || '#2DBD60',
|
|
230
|
-
borderWidth: bbox.borderWidth || 3,
|
|
231
|
-
borderRadius: bbox.cornerRadius || 8,
|
|
232
|
-
}
|
|
233
|
-
]}/>
|
|
234
|
-
</View>)}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
{/* Camera controls */}
|
|
238
|
-
<View style={styles.controlsContainer}>
|
|
239
|
-
{/* Flash button */}
|
|
240
|
-
{/* {enableFlash && (
|
|
241
|
-
<TouchableOpacity style={styles.controlButton} onPress={toggleFlash}>
|
|
242
|
-
<Text style={styles.controlButtonText}>
|
|
243
|
-
{flash === 'off' ? '⚡' : flash === 'on' ? '⚡️' : '✨'}
|
|
244
|
-
</Text>
|
|
245
|
-
</TouchableOpacity>
|
|
246
|
-
)} */}
|
|
247
|
-
|
|
248
|
-
{/* Capture button */}
|
|
249
|
-
{showCaptureButton && !enableVideo && silentCaptureResult?.success && (<TouchableOpacity style={styles.captureButton} onPress={capturePhoto} disabled={!isInitialized}>
|
|
250
|
-
<View style={[
|
|
251
|
-
styles.captureButtonInner,
|
|
252
|
-
!isInitialized && styles.captureButtonDisabled
|
|
253
|
-
]}/>
|
|
254
|
-
</TouchableOpacity>)}
|
|
255
|
-
|
|
256
|
-
{/* Video recording button */}
|
|
257
|
-
{showCaptureButton && enableVideo && silentCaptureResult?.success && (<TouchableOpacity style={[
|
|
258
|
-
styles.captureButton,
|
|
259
|
-
isRecording && styles.recordingButton
|
|
260
|
-
]} onPress={isRecording ? stopVideoRecording : startVideoRecording} disabled={!isInitialized}>
|
|
261
|
-
<View style={[
|
|
262
|
-
styles.captureButtonInner,
|
|
263
|
-
!isInitialized && styles.captureButtonDisabled,
|
|
264
|
-
isRecording && styles.recordingButtonInner
|
|
265
|
-
]}/>
|
|
266
|
-
</TouchableOpacity>)}
|
|
267
|
-
|
|
268
|
-
{/* Switch camera button */}
|
|
269
|
-
{/* {showSwitchCamera && canFlip && (
|
|
270
|
-
<TouchableOpacity style={styles.controlButton} onPress={switchCamera}>
|
|
271
|
-
<Text style={styles.controlButtonText}>🔄</Text>
|
|
272
|
-
</TouchableOpacity>
|
|
273
|
-
)} */}
|
|
274
|
-
|
|
275
|
-
{silentCaptureResult?.isAnalyzing && (<View style={{ backgroundColor: 'rgba(0, 0, 0, 0.7)', padding: 10, borderRadius: 10 }}>
|
|
276
|
-
<Text style={{ color: 'white', fontSize: 16, fontWeight: 'bold' }}>{t('camera.analyzing')}</Text>
|
|
277
|
-
</View>)}
|
|
278
|
-
</View>
|
|
279
155
|
</View>);
|
|
280
156
|
};
|
|
281
157
|
const styles = StyleSheet.create({
|
|
282
|
-
container: {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
position: 'absolute',
|
|
288
|
-
top: 60,
|
|
289
|
-
left: 20,
|
|
290
|
-
right: 20,
|
|
291
|
-
backgroundColor: 'rgba(0, 0, 0, 0.7)',
|
|
292
|
-
padding: 15,
|
|
293
|
-
// borderRadius: 10,
|
|
294
|
-
zIndex: 1,
|
|
295
|
-
},
|
|
296
|
-
instructions: {
|
|
297
|
-
color: 'white',
|
|
298
|
-
fontSize: 16,
|
|
299
|
-
textAlign: 'center',
|
|
300
|
-
fontWeight: '500',
|
|
301
|
-
},
|
|
302
|
-
closeButton: {
|
|
303
|
-
position: 'absolute',
|
|
304
|
-
top: 50,
|
|
305
|
-
right: 20,
|
|
306
|
-
backgroundColor: 'rgba(0, 0, 0, 0.7)',
|
|
307
|
-
width: 40,
|
|
308
|
-
height: 40,
|
|
309
|
-
borderRadius: 20,
|
|
310
|
-
justifyContent: 'center',
|
|
311
|
-
alignItems: 'center',
|
|
312
|
-
zIndex: 2,
|
|
313
|
-
},
|
|
314
|
-
closeButtonText: {
|
|
315
|
-
color: 'white',
|
|
316
|
-
fontSize: 20,
|
|
317
|
-
fontWeight: 'bold',
|
|
318
|
-
},
|
|
319
|
-
controlsContainer: {
|
|
320
|
-
position: 'absolute',
|
|
321
|
-
bottom: 40,
|
|
322
|
-
left: 0,
|
|
323
|
-
right: 0,
|
|
324
|
-
flexDirection: 'row',
|
|
325
|
-
justifyContent: 'space-around',
|
|
326
|
-
alignItems: 'center',
|
|
327
|
-
paddingHorizontal: 40,
|
|
328
|
-
zIndex: 1,
|
|
329
|
-
},
|
|
330
|
-
controlButton: {
|
|
331
|
-
backgroundColor: 'rgba(0, 0, 0, 0.7)',
|
|
332
|
-
width: 50,
|
|
333
|
-
height: 50,
|
|
334
|
-
borderRadius: 25,
|
|
158
|
+
container: { flex: 1, backgroundColor: 'black' },
|
|
159
|
+
centerContent: { justifyContent: 'center', alignItems: 'center', padding: 20 },
|
|
160
|
+
permissionMessage: { color: 'white', textAlign: 'center', marginBottom: 20, fontSize: 16, fontWeight: '600' },
|
|
161
|
+
stuckOverlay: {
|
|
162
|
+
...StyleSheet.absoluteFillObject,
|
|
335
163
|
justifyContent: 'center',
|
|
336
164
|
alignItems: 'center',
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
}
|
|
341
|
-
captureButton: {
|
|
342
|
-
backgroundColor: 'rgba(255, 255, 255, 0.3)',
|
|
343
|
-
width: 80,
|
|
344
|
-
height: 80,
|
|
345
|
-
borderRadius: 40,
|
|
346
|
-
justifyContent: 'center',
|
|
347
|
-
alignItems: 'center',
|
|
348
|
-
borderWidth: 3,
|
|
349
|
-
borderColor: 'white',
|
|
350
|
-
},
|
|
351
|
-
captureButtonInner: {
|
|
352
|
-
backgroundColor: 'white',
|
|
353
|
-
width: 60,
|
|
354
|
-
height: 60,
|
|
355
|
-
borderRadius: 30,
|
|
356
|
-
},
|
|
357
|
-
captureButtonDisabled: {
|
|
358
|
-
backgroundColor: 'rgba(255, 255, 255, 0.5)',
|
|
359
|
-
},
|
|
360
|
-
recordingButton: {
|
|
361
|
-
backgroundColor: 'rgba(255, 59, 48, 0.3)',
|
|
362
|
-
borderColor: '#FF3B30',
|
|
363
|
-
},
|
|
364
|
-
recordingButtonInner: {
|
|
365
|
-
backgroundColor: '#FF3B30',
|
|
366
|
-
},
|
|
367
|
-
permissionMessage: {
|
|
368
|
-
color: 'white',
|
|
369
|
-
fontSize: 16,
|
|
370
|
-
textAlign: 'center',
|
|
371
|
-
margin: 20,
|
|
372
|
-
},
|
|
373
|
-
errorMessage: {
|
|
374
|
-
color: 'red',
|
|
375
|
-
fontSize: 16,
|
|
376
|
-
textAlign: 'center',
|
|
377
|
-
margin: 20,
|
|
378
|
-
},
|
|
379
|
-
bboxOverlay: {
|
|
380
|
-
position: 'absolute',
|
|
381
|
-
top: 0,
|
|
382
|
-
left: 0,
|
|
383
|
-
right: 0,
|
|
384
|
-
bottom: 0,
|
|
385
|
-
pointerEvents: 'none',
|
|
386
|
-
},
|
|
387
|
-
bbox: {
|
|
388
|
-
position: 'absolute',
|
|
389
|
-
borderStyle: 'solid',
|
|
390
|
-
backgroundColor: 'transparent',
|
|
391
|
-
},
|
|
165
|
+
backgroundColor: 'rgba(0,0,0,0.85)',
|
|
166
|
+
zIndex: 1000,
|
|
167
|
+
padding: 20
|
|
168
|
+
}
|
|
392
169
|
});
|
|
393
170
|
//# sourceMappingURL=EnhancedCameraView.js.map
|