@regulaforensics/document-reader 9.10.1236-nightly → 9.10.1237-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.
- 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 +558 -3
- package/examples/capacitor/package.json +3 -4
- package/examples/ionic/package-lock.json +829 -297
- package/examples/ionic/package.json +3 -5
- package/examples/react_native/app.config.ts +0 -3
- package/examples/react_native/index.html +12 -0
- package/examples/react_native/index.tsx +22 -52
- package/examples/react_native/metro.config.js +3 -1
- package/examples/react_native/package-lock.json +1173 -1171
- package/examples/react_native/package.json +17 -11
- package/examples/react_native/scripts/android.sh +8 -1
- package/examples/react_native/scripts/ios.sh +11 -3
- package/examples/react_native/scripts/setup.sh +4 -0
- package/package.json +1 -1
- package/plugin.xml +2 -2
- package/react-native-document-reader.podspec +2 -2
- package/test/package-lock.json +5 -2
- package/examples/react_native/scripts/withoutMetroServer.js +0 -86
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@ionic/cordova-builders": "^13.0.0",
|
|
20
20
|
"@awesome-cordova-plugins/camera": "^9.6.0",
|
|
21
21
|
"@awesome-cordova-plugins/file": "^9.6.0",
|
|
22
|
-
"@regulaforensics/document-reader": "9.10.
|
|
22
|
+
"@regulaforensics/document-reader": "9.10.1237-rc",
|
|
23
23
|
"@regulaforensics/document-reader-core-fullauthrfid": "9.9.3305",
|
|
24
24
|
"@regulaforensics/document-reader-btdevice": "9.9.140",
|
|
25
25
|
"cordova-android": "^15.1.0",
|
|
@@ -34,10 +34,8 @@
|
|
|
34
34
|
"typescript": "~6.0.3"
|
|
35
35
|
},
|
|
36
36
|
"overrides": {
|
|
37
|
-
"serialize-javascript": "^7.1.
|
|
38
|
-
"uuid": "^11.1.1"
|
|
39
|
-
"source-map-js": "^1.2.2",
|
|
40
|
-
"shell-quote": "^1.11.0"
|
|
37
|
+
"serialize-javascript": "^7.1.1",
|
|
38
|
+
"uuid": "^11.1.1"
|
|
41
39
|
},
|
|
42
40
|
"cordova": {
|
|
43
41
|
"plugins": {
|
|
@@ -36,12 +36,9 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
|
|
|
36
36
|
},
|
|
37
37
|
plugins: [
|
|
38
38
|
'@regulaforensics/document-reader',
|
|
39
|
-
'./scripts/withoutMetroServer',
|
|
40
39
|
['expo-custom-assets', { assetsPaths: ['./assets'] }],
|
|
41
40
|
['expo-build-properties', {
|
|
42
|
-
ios: { networkInspector: false },
|
|
43
41
|
android: {
|
|
44
|
-
networkInspector: false,
|
|
45
42
|
extraMavenRepos: [
|
|
46
43
|
{ url: 'https://maven.regulaforensics.com/RegulaDocumentReader' },
|
|
47
44
|
{ 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,23 +6,6 @@ import { 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 loadAsset(path: string): Promise<string> {
|
|
10
|
-
if (Platform.OS === 'ios') path = RNFS.MainBundlePath + "/" + path
|
|
11
|
-
var readFile = Platform.OS === 'ios' ? RNFS.readFile : RNFS.readFileRes
|
|
12
|
-
return await readFile(path, 'base64')
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export async function pickImage(): Promise<string | null> {
|
|
16
|
-
var response = await launchImageLibrary({
|
|
17
|
-
mediaType: 'photo',
|
|
18
|
-
selectionLimit: 1,
|
|
19
|
-
includeBase64: true
|
|
20
|
-
})
|
|
21
|
-
return response?.assets?.[0].base64!
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// --------------------------------------------------------------------------------------------------------------------
|
|
25
|
-
|
|
26
9
|
var webViewRef: any
|
|
27
10
|
const onclicks: any = {}
|
|
28
11
|
const onMessage = (json: any) => {
|
|
@@ -67,45 +50,32 @@ const document = {
|
|
|
67
50
|
}
|
|
68
51
|
|
|
69
52
|
function parseValue(value: any) {
|
|
70
|
-
|
|
71
|
-
return
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
async function loadWebUI() {
|
|
75
|
-
const webRoot = Platform.OS === 'ios' ? RNFS.MainBundlePath + '/web/' : 'web/'
|
|
76
|
-
const readWebFile = Platform.OS === 'ios' ? RNFS.readFile : RNFS.readFileAssets
|
|
77
|
-
const readWebDir = Platform.OS === 'ios' ? RNFS.readDir : RNFS.readDirAssets
|
|
78
|
-
const webImages: Record<string, string> = {}
|
|
79
|
-
const [styles, content] = await Promise.all(['src/main.css', 'src/main.html'].map(path => readWebFile(webRoot + path, 'utf8')))
|
|
80
|
-
|
|
81
|
-
for (const file of (await readWebDir(webRoot + 'images')).filter(file => file.isFile())) {
|
|
82
|
-
const extension = file.name.split('.').pop()!.toLowerCase()
|
|
83
|
-
const type = ({ jpg: 'jpeg', svg: 'svg+xml' } as Record<string, string>)[extension] ?? extension
|
|
84
|
-
webImages['images/' + file.name] = `data:image/${type};base64,${await readWebFile(file.path, 'base64')}`
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const html = content.replace(/src="([^"]+)"/g, (match, path) => webImages[path] ? `src="${webImages[path]}"` : match)
|
|
88
|
-
return `<meta name="viewport" content="initial-scale=1, user-scalable=no, viewport-fit=cover">
|
|
89
|
-
<style>${styles}</style>
|
|
90
|
-
<div id="content" style="height: 100%">${html}</div>
|
|
91
|
-
<script>
|
|
92
|
-
window.webImages = ${JSON.stringify(webImages)};
|
|
93
|
-
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
94
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({ id: "ready" }))
|
|
95
|
-
}))
|
|
96
|
-
</script>`
|
|
53
|
+
if (value !== true && value !== false) return `"${value}"`
|
|
54
|
+
return value
|
|
97
55
|
}
|
|
98
56
|
|
|
99
57
|
(globalThis as any).document = document;
|
|
100
|
-
registerRootComponent(() =>
|
|
101
|
-
|
|
102
|
-
React.useEffect(() => { loadWebUI().then(setHtml).catch(console.error) }, [])
|
|
103
|
-
return html ? <WebView
|
|
58
|
+
registerRootComponent(() =>
|
|
59
|
+
<WebView
|
|
104
60
|
ref={ref => { webViewRef = ref }}
|
|
105
61
|
onMessage={onMessage}
|
|
106
|
-
|
|
107
|
-
source={{ html }}
|
|
62
|
+
source={require("./index.html")}
|
|
108
63
|
scrollEnabled={false}
|
|
109
64
|
overScrollMode={'content'}
|
|
110
|
-
/>
|
|
111
|
-
|
|
65
|
+
/>
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
export async function loadAsset(path: string): Promise<string> {
|
|
69
|
+
if (Platform.OS === 'ios') path = RNFS.MainBundlePath + "/" + path
|
|
70
|
+
var readFile = Platform.OS === 'ios' ? RNFS.readFile : RNFS.readFileRes
|
|
71
|
+
return await readFile(path, 'base64')
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export async function pickImage(): Promise<string | null> {
|
|
75
|
+
var response = await launchImageLibrary({
|
|
76
|
+
mediaType: 'photo',
|
|
77
|
+
selectionLimit: 1,
|
|
78
|
+
includeBase64: true
|
|
79
|
+
})
|
|
80
|
+
return response?.assets?.[0].base64!
|
|
81
|
+
}
|
|
@@ -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 =
|
|
5
|
+
config.resolver.nodeModulesPaths = config.watchFolders
|
|
6
|
+
config.resolver.assetExts.push('css')
|
|
5
7
|
module.exports = config
|