@regulaforensics/face-sdk 8.5.1481-beta → 8.5.1485-rc

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.
@@ -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.5.1481-beta",
24
- "@regulaforensics/face-core-basic": "8.4.884",
23
+ "@regulaforensics/face-sdk": "8.5.1485-rc",
24
+ "@regulaforensics/face-core-basic": "8.5.906-rc",
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.2",
38
+ "serialize-javascript": "^7.1.1",
39
39
  "uuid": "^11.1.1",
40
40
  "source-map-js": "^1.2.2",
41
41
  "shell-quote": "^1.11.0"
@@ -19,12 +19,9 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
19
19
  },
20
20
  plugins: [
21
21
  '@regulaforensics/face-sdk',
22
- './scripts/withoutMetroServer',
23
22
  ['expo-custom-assets', { assetsPaths: ['./assets'] }],
24
23
  ['expo-build-properties', {
25
- ios: { networkInspector: false },
26
24
  android: {
27
- networkInspector: false,
28
25
  extraMavenRepos: [
29
26
  { url: 'https://maven.regulaforensics.com/RegulaDocumentReader' },
30
27
  { url: 'https://maven.regulaforensics.com/RegulaDocumentReader/Beta' },
@@ -0,0 +1,12 @@
1
+ <meta name="viewport" content="initial-scale=1, user-scalable=no, viewport-fit=cover">
2
+ <link rel="stylesheet" href="src/main.css">
3
+
4
+ <div id="content" style="height: 100%"></div>
5
+
6
+ <script>
7
+ (async () => {
8
+ document.getElementById("content").innerHTML = await fetch("src/main.html").then(r => r.text())
9
+ await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)))
10
+ window.ReactNativeWebView.postMessage(JSON.stringify({ id: "ready" }))
11
+ })()
12
+ </script>
@@ -6,36 +6,6 @@ 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
-
39
9
  var webViewRef: any
40
10
  const onclicks: any = {}
41
11
  const onMessage = (json: any) => {
@@ -80,45 +50,45 @@ const document = {
80
50
  }
81
51
 
82
52
  function parseValue(value: any) {
83
- const json = JSON.stringify(value)
84
- return typeof value === 'string' ? `(window.webImages[${json}] ?? ${json})` : json
85
- }
86
-
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')))
93
-
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')}`
98
- }
99
-
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>`
53
+ if (value !== true && value !== false) return `"${value}"`
54
+ return value
110
55
  }
111
56
 
112
57
  (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
58
+ registerRootComponent(() =>
59
+ <WebView
117
60
  ref={ref => { webViewRef = ref }}
118
61
  onMessage={onMessage}
119
- originWhitelist={['*']}
120
- source={{ html }}
62
+ source={require("./index.html")}
121
63
  scrollEnabled={false}
122
64
  overScrollMode={'content'}
123
- /> : null
124
- })
65
+ />
66
+ )
67
+
68
+ export async function loadAssetIfExists(path: string): Promise<string | null> {
69
+ if (Platform.OS === 'ios') path = RNFS.MainBundlePath + "/" + path
70
+ var readFile = Platform.OS === 'ios' ? RNFS.readFile : RNFS.readFileRes
71
+ try {
72
+ return await readFile(path, 'base64')
73
+ } catch {
74
+ return null
75
+ }
76
+ }
77
+
78
+ export async function pickImage(): Promise<string | null> {
79
+ var response = await launchImageLibrary({
80
+ mediaType: 'photo',
81
+ selectionLimit: 1,
82
+ includeBase64: true
83
+ })
84
+ return "data:image/png;base64," + response?.assets?.[0].base64!
85
+ }
86
+
87
+ export async function chooseOption(): Promise<boolean | null> {
88
+ return new Promise<boolean | null>((resolve) => {
89
+ Alert.alert("Select option", "", [
90
+ { text: "Use gallery", onPress: () => { resolve(false) } },
91
+ { text: "Use camera", onPress: () => { resolve(true) } }
92
+ ], { cancelable: true, onDismiss: () => resolve(null) })
93
+ })
94
+ }
@@ -1,5 +1,7 @@
1
1
  const config = require('expo/metro-config').getDefaultConfig(__dirname)
2
2
  config.watchFolders = [
3
+ __dirname + '/node_modules'
3
4
  ]
4
- config.resolver.nodeModulesPaths = [__dirname + '/node_modules']
5
+ config.resolver.nodeModulesPaths = config.watchFolders
6
+ config.resolver.assetExts.push('css')
5
7
  module.exports = config