@regulaforensics/face-sdk 8.4.1471-nightly → 8.4.1482-nightly
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/Package.swift +1 -1
- package/android/build.gradle.kts +1 -1
- package/android/cordova.gradle.kts +1 -1
- package/examples/capacitor/package-lock.json +0 -555
- package/examples/capacitor/package.json +2 -2
- package/examples/ionic/package-lock.json +299 -831
- package/examples/ionic/package.json +3 -3
- package/examples/react_native/app.config.ts +3 -0
- package/examples/react_native/index.tsx +65 -35
- package/examples/react_native/metro.config.js +1 -3
- package/examples/react_native/package-lock.json +1158 -1159
- package/examples/react_native/package.json +13 -22
- package/examples/react_native/scripts/android.sh +1 -8
- package/examples/react_native/scripts/ios.sh +3 -11
- package/examples/react_native/scripts/setup.sh +0 -4
- package/examples/react_native/scripts/withoutMetroServer.js +86 -0
- package/package.json +1 -1
- package/plugin.xml +2 -2
- package/react-native-face-sdk.podspec +2 -2
- package/examples/react_native/index.html +0 -12
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"@awesome-cordova-plugins/camera": "^9.6.0",
|
|
21
21
|
"@awesome-cordova-plugins/dialogs": "^9.6.0",
|
|
22
22
|
"@awesome-cordova-plugins/file": "^9.6.0",
|
|
23
|
-
"@regulaforensics/face-sdk": "8.4.
|
|
24
|
-
"@regulaforensics/face-core-basic": "8.5.
|
|
23
|
+
"@regulaforensics/face-sdk": "8.4.1482-nightly",
|
|
24
|
+
"@regulaforensics/face-core-basic": "8.5.902-nightly",
|
|
25
25
|
"cordova-android": "^15.1.0",
|
|
26
26
|
"cordova-ios": "^8.1.1",
|
|
27
27
|
"cordova-plugin-camera": "^8.0.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"typescript": "~6.0.3"
|
|
36
36
|
},
|
|
37
37
|
"overrides": {
|
|
38
|
-
"serialize-javascript": "^7.1.
|
|
38
|
+
"serialize-javascript": "^7.1.2",
|
|
39
39
|
"uuid": "^11.1.1",
|
|
40
40
|
"source-map-js": "^1.2.2",
|
|
41
41
|
"shell-quote": "^1.11.0"
|
|
@@ -19,9 +19,12 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
|
|
|
19
19
|
},
|
|
20
20
|
plugins: [
|
|
21
21
|
'@regulaforensics/face-sdk',
|
|
22
|
+
'./scripts/withoutMetroServer',
|
|
22
23
|
['expo-custom-assets', { assetsPaths: ['./assets'] }],
|
|
23
24
|
['expo-build-properties', {
|
|
25
|
+
ios: { networkInspector: false },
|
|
24
26
|
android: {
|
|
27
|
+
networkInspector: false,
|
|
25
28
|
extraMavenRepos: [
|
|
26
29
|
{ url: 'https://maven.regulaforensics.com/RegulaDocumentReader' },
|
|
27
30
|
{ url: 'https://maven.regulaforensics.com/RegulaDocumentReader/Beta' },
|
|
@@ -6,6 +6,36 @@ import { Alert, Platform } from 'react-native'
|
|
|
6
6
|
import { launchImageLibrary } from 'react-native-image-picker'
|
|
7
7
|
import { main } from './src/main'
|
|
8
8
|
|
|
9
|
+
export async function loadAssetIfExists(path: string): Promise<string | null> {
|
|
10
|
+
if (Platform.OS === 'ios') path = RNFS.MainBundlePath + "/" + path
|
|
11
|
+
var readFile = Platform.OS === 'ios' ? RNFS.readFile : RNFS.readFileRes
|
|
12
|
+
try {
|
|
13
|
+
return await readFile(path, 'base64')
|
|
14
|
+
} catch {
|
|
15
|
+
return null
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function pickImage(): Promise<string | null> {
|
|
20
|
+
var response = await launchImageLibrary({
|
|
21
|
+
mediaType: 'photo',
|
|
22
|
+
selectionLimit: 1,
|
|
23
|
+
includeBase64: true
|
|
24
|
+
})
|
|
25
|
+
return "data:image/png;base64," + response?.assets?.[0].base64!
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export async function chooseOption(): Promise<boolean | null> {
|
|
29
|
+
return new Promise<boolean | null>((resolve) => {
|
|
30
|
+
Alert.alert("Select option", "", [
|
|
31
|
+
{ text: "Use gallery", onPress: () => { resolve(false) } },
|
|
32
|
+
{ text: "Use camera", onPress: () => { resolve(true) } }
|
|
33
|
+
], { cancelable: true, onDismiss: () => resolve(null) })
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// --------------------------------------------------------------------------------------------------------------------
|
|
38
|
+
|
|
9
39
|
var webViewRef: any
|
|
10
40
|
const onclicks: any = {}
|
|
11
41
|
const onMessage = (json: any) => {
|
|
@@ -50,45 +80,45 @@ const document = {
|
|
|
50
80
|
}
|
|
51
81
|
|
|
52
82
|
function parseValue(value: any) {
|
|
53
|
-
|
|
54
|
-
return value
|
|
83
|
+
const json = JSON.stringify(value)
|
|
84
|
+
return typeof value === 'string' ? `(window.webImages[${json}] ?? ${json})` : json
|
|
55
85
|
}
|
|
56
86
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
scrollEnabled={false}
|
|
64
|
-
overScrollMode={'content'}
|
|
65
|
-
/>
|
|
66
|
-
)
|
|
87
|
+
async function loadWebUI() {
|
|
88
|
+
const webRoot = Platform.OS === 'ios' ? RNFS.MainBundlePath + '/web/' : 'web/'
|
|
89
|
+
const readWebFile = Platform.OS === 'ios' ? RNFS.readFile : RNFS.readFileAssets
|
|
90
|
+
const readWebDir = Platform.OS === 'ios' ? RNFS.readDir : RNFS.readDirAssets
|
|
91
|
+
const webImages: Record<string, string> = {}
|
|
92
|
+
const [styles, content] = await Promise.all(['src/main.css', 'src/main.html'].map(path => readWebFile(webRoot + path, 'utf8')))
|
|
67
93
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return await readFile(path, 'base64')
|
|
73
|
-
} catch {
|
|
74
|
-
return null
|
|
94
|
+
for (const file of (await readWebDir(webRoot + 'images')).filter(file => file.isFile())) {
|
|
95
|
+
const extension = file.name.split('.').pop()!.toLowerCase()
|
|
96
|
+
const type = ({ jpg: 'jpeg', svg: 'svg+xml' } as Record<string, string>)[extension] ?? extension
|
|
97
|
+
webImages['images/' + file.name] = `data:image/${type};base64,${await readWebFile(file.path, 'base64')}`
|
|
75
98
|
}
|
|
76
|
-
}
|
|
77
99
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
100
|
+
const html = content.replace(/src="([^"]+)"/g, (match, path) => webImages[path] ? `src="${webImages[path]}"` : match)
|
|
101
|
+
return `<meta name="viewport" content="initial-scale=1, user-scalable=no, viewport-fit=cover">
|
|
102
|
+
<style>${styles}</style>
|
|
103
|
+
<div id="content" style="height: 100%">${html}</div>
|
|
104
|
+
<script>
|
|
105
|
+
window.webImages = ${JSON.stringify(webImages)};
|
|
106
|
+
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
107
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({ id: "ready" }))
|
|
108
|
+
}))
|
|
109
|
+
</script>`
|
|
85
110
|
}
|
|
86
111
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
112
|
+
(globalThis as any).document = document;
|
|
113
|
+
registerRootComponent(() => {
|
|
114
|
+
const [html, setHtml] = React.useState('')
|
|
115
|
+
React.useEffect(() => { loadWebUI().then(setHtml).catch(console.error) }, [])
|
|
116
|
+
return html ? <WebView
|
|
117
|
+
ref={ref => { webViewRef = ref }}
|
|
118
|
+
onMessage={onMessage}
|
|
119
|
+
originWhitelist={['*']}
|
|
120
|
+
source={{ html }}
|
|
121
|
+
scrollEnabled={false}
|
|
122
|
+
overScrollMode={'content'}
|
|
123
|
+
/> : null
|
|
124
|
+
})
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
const config = require('expo/metro-config').getDefaultConfig(__dirname)
|
|
2
2
|
config.watchFolders = [
|
|
3
|
-
__dirname + '/node_modules'
|
|
4
3
|
]
|
|
5
|
-
config.resolver.nodeModulesPaths =
|
|
6
|
-
config.resolver.assetExts.push('css')
|
|
4
|
+
config.resolver.nodeModulesPaths = [__dirname + '/node_modules']
|
|
7
5
|
module.exports = config
|