@regulaforensics/idv 4.0.169-nightly → 4.0.290-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 +27 -0
- package/README.md +3 -0
- package/android/CDVIDV.kt +5 -3
- package/android/build.gradle.kts +41 -0
- package/android/cordova.gradle.kts +20 -0
- package/android/src/main/{java → kotlin}/com/regula/plugin/idv/RNIDVModule.kt +3 -2
- package/app.plugin.js +10 -7
- package/examples/capacitor/README.md +4 -2
- package/examples/capacitor/android/app/build.gradle +2 -10
- package/examples/capacitor/android/build.gradle +12 -3
- package/examples/capacitor/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/examples/capacitor/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/examples/capacitor/android/gradle.properties +4 -0
- package/examples/capacitor/android/gradlew +4 -7
- package/examples/capacitor/android/gradlew.bat +82 -94
- package/examples/capacitor/android/variables.gradle +13 -9
- package/examples/capacitor/capacitor.config.json +15 -0
- package/examples/capacitor/index.tsx +2 -7
- package/examples/capacitor/ios/App/App/AppDelegate.swift +5 -40
- package/examples/capacitor/ios/App/App/Info.plist +18 -2
- package/examples/capacitor/ios/App/App/SceneDelegate.swift +23 -0
- package/examples/capacitor/ios/App/App.xcodeproj/project.pbxproj +25 -69
- package/examples/capacitor/ios/App/CapApp-SPM/Sources/CapApp-SPM/CapApp-SPM.swift +1 -0
- package/examples/capacitor/package-lock.json +392 -1493
- package/examples/capacitor/package.json +17 -18
- package/examples/capacitor/scripts/android.sh +5 -8
- package/examples/capacitor/scripts/ios.sh +5 -7
- package/examples/capacitor/scripts/setup.sh +2 -7
- package/examples/capacitor/src/main.css +5 -1
- package/examples/capacitor/src/main.tsx +51 -29
- package/examples/capacitor/vite.config.ts +0 -12
- package/examples/ionic/README.md +4 -2
- package/examples/ionic/config.xml +1 -1
- package/examples/ionic/index.tsx +8 -3
- package/examples/ionic/package-lock.json +8732 -7327
- package/examples/ionic/package.json +28 -25
- package/examples/ionic/scripts/android.sh +1 -3
- package/examples/ionic/scripts/ios.sh +3 -3
- package/examples/ionic/scripts/setup.sh +0 -2
- package/examples/ionic/src/main.tsx +51 -29
- package/examples/ionic/tsconfig.json +0 -1
- package/examples/react_native/README.md +5 -3
- package/examples/react_native/app.config.ts +4 -2
- package/examples/react_native/index.tsx +37 -7
- package/examples/react_native/metro.config.js +1 -3
- package/examples/react_native/package-lock.json +2074 -1328
- package/examples/react_native/package.json +19 -20
- package/examples/react_native/scripts/android.sh +1 -6
- package/examples/react_native/scripts/ios.sh +3 -9
- package/examples/react_native/scripts/setup.sh +2 -3
- package/examples/react_native/scripts/withoutMetroServer.js +86 -0
- package/examples/react_native/src/main.tsx +51 -29
- package/ios/CDVIDV.swift +23 -6
- package/ios/{Main.swift → Implementation.swift} +4 -4
- package/ios/RNIDV.swift +9 -3
- package/ios/Utils.swift +2 -0
- package/package.json +1 -1
- package/plugin.xml +10 -10
- package/react-native-idv.podspec +14 -0
- package/test/test.tsx +26 -2
- package/www/capacitor/index.js +21 -3
- package/www/capacitor/internal/bridge.js +2 -1
- package/www/capacitor/internal/cordova.js +2 -2
- package/www/cordova.js +17 -40
- package/www/react-native/index.js +21 -3
- package/www/react-native/internal/bridge.js +2 -1
- package/www/types/index.d.ts +13 -2
- package/RNIDV.podspec +0 -21
- package/android/build.gradle +0 -32
- package/android/cordova.gradle +0 -20
- package/examples/capacitor/android/app/capacitor.build.gradle +0 -19
- package/examples/capacitor/android/capacitor.settings.gradle +0 -9
- package/examples/capacitor/ionic.config.json +0 -7
- package/examples/capacitor/ios/App/App/Base.lproj/Main.storyboard +0 -19
- package/examples/capacitor/ios/App/App.xcworkspace/contents.xcworkspacedata +0 -10
- package/examples/capacitor/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/examples/capacitor/ios/App/Podfile +0 -29
- package/examples/capacitor/ios/App/Podfile.lock +0 -52
- package/examples/react_native/index.html +0 -12
- /package/android/src/main/{java/com/regula/plugin/idv/Main.kt → kotlin/com/regula/plugin/idv/Implementation.kt} +0 -0
- /package/android/src/main/{java → kotlin}/com/regula/plugin/idv/JSONConstructor.kt +0 -0
- /package/android/src/main/{java → kotlin}/com/regula/plugin/idv/Utils.kt +0 -0
|
@@ -4,29 +4,28 @@
|
|
|
4
4
|
"scripts": {
|
|
5
5
|
"setup": "scripts/setup.sh",
|
|
6
6
|
"ios": "scripts/ios.sh",
|
|
7
|
-
"android": "scripts/android.sh"
|
|
8
|
-
"start": "expo start"
|
|
7
|
+
"android": "scripts/android.sh"
|
|
9
8
|
},
|
|
10
9
|
"dependencies": {
|
|
11
|
-
"@regulaforensics/idv": "4.0.
|
|
12
|
-
"@regulaforensics/idv-module-document-reader": "4.0.
|
|
13
|
-
"@regulaforensics/idv-module-face": "4.0.
|
|
14
|
-
"@regulaforensics/document-reader-core-fullauthrfid": "9.
|
|
15
|
-
"@regulaforensics/face-core-basic": "8.
|
|
16
|
-
"expo": "
|
|
17
|
-
"expo-
|
|
18
|
-
"expo-build-properties": "^56.0.16",
|
|
10
|
+
"@regulaforensics/idv": "4.0.290-rc",
|
|
11
|
+
"@regulaforensics/idv-module-document-reader": "4.0.438-rc",
|
|
12
|
+
"@regulaforensics/idv-module-face": "4.0.439-rc",
|
|
13
|
+
"@regulaforensics/document-reader-core-fullauthrfid": "9.10.3518-rc",
|
|
14
|
+
"@regulaforensics/face-core-basic": "8.5.909-rc",
|
|
15
|
+
"expo": "~58.0.10",
|
|
16
|
+
"expo-build-properties": "~58.0.10",
|
|
19
17
|
"expo-custom-assets": "^1.5.0",
|
|
20
|
-
"react-native": "
|
|
21
|
-
"
|
|
22
|
-
"react": "
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
18
|
+
"react-native": "0.88.0",
|
|
19
|
+
"react": "19.3.1",
|
|
20
|
+
"@types/react": "19.3.0",
|
|
21
|
+
"react-native-webview": "^14.0.1",
|
|
22
|
+
"typescript": "^7.0.2",
|
|
23
|
+
"@expo/config-plugins": "~58.0.9",
|
|
24
|
+
"react-native-fs": "^2.20.0"
|
|
26
25
|
},
|
|
27
26
|
"overrides": {
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
"xcode": {
|
|
28
|
+
"uuid": "^11.1.1"
|
|
29
|
+
}
|
|
31
30
|
}
|
|
32
|
-
}
|
|
31
|
+
}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -e
|
|
3
3
|
|
|
4
|
-
adb reverse tcp:8081 tcp:8081 >/dev/null || :
|
|
5
4
|
if [[ " $* " == *" --open "* ]] || [[ " $* " == *" -o "* ]]; then
|
|
6
5
|
open -a 'Android Studio' android
|
|
7
|
-
# check if metro is already running
|
|
8
|
-
[[ -z $(pgrep -f 'expo start') ]] && npm start
|
|
9
6
|
else
|
|
10
|
-
expo run:android --device
|
|
7
|
+
npx expo run:android --device --no-bundler "$@"
|
|
11
8
|
fi
|
|
12
|
-
|
|
13
|
-
exit 0
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -e
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
open ios/IDV.xcworkspace
|
|
6
|
-
|
|
7
|
-
[[ -z $(pgrep -f 'expo start') ]] && npm start
|
|
8
|
-
else
|
|
9
|
-
npx expo run:ios --device
|
|
10
|
-
fi
|
|
11
|
-
|
|
12
|
-
exit 0
|
|
4
|
+
[[ " $* " == *" --open "* || " $* " == *" -o "* ]] &&
|
|
5
|
+
open ios/IDV.xcworkspace ||
|
|
6
|
+
npx expo run:ios --device --no-bundler "$@"
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
set -e
|
|
3
3
|
|
|
4
4
|
npm install
|
|
5
|
-
expo prebuild
|
|
5
|
+
npx expo prebuild --no-install
|
|
6
|
+
(cd ios && (pod install || (pod repo update && pod install)))
|
|
6
7
|
|
|
7
8
|
mkdir -p android/app/src/main/assets/Regula
|
|
8
9
|
mv android/app/src/main/res/raw/regula.license android/app/src/main/assets/Regula/
|
|
@@ -10,5 +11,3 @@ mv android/app/src/main/res/raw/db.dat android/app/src/main/assets/Regula/
|
|
|
10
11
|
|
|
11
12
|
sed -i '' '$a\
|
|
12
13
|
android { buildFeatures { dataBinding true } }' android/app/build.gradle
|
|
13
|
-
|
|
14
|
-
exit 0
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const { withAppDelegate, withAppBuildGradle, withMainApplication, withXcodeProject } = require('expo/config-plugins')
|
|
2
|
+
|
|
3
|
+
function replaceRequired(contents, pattern, replacement, description) {
|
|
4
|
+
if (!pattern.test(contents)) throw new Error(`Standalone build: cannot find ${description}`)
|
|
5
|
+
return contents.replace(pattern, replacement)
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
module.exports = config => {
|
|
9
|
+
config = withAppDelegate(config, config => {
|
|
10
|
+
let contents = config.modResults.contents
|
|
11
|
+
if (!contents.includes('// Standalone demo: no development menu.')) {
|
|
12
|
+
contents = replaceRequired(contents, /let factory = ExpoReactNativeFactory\(delegate: delegate\)/,
|
|
13
|
+
`let factory = ExpoReactNativeFactory(delegate: delegate)
|
|
14
|
+
// Standalone demo: no development menu.
|
|
15
|
+
#if DEBUG
|
|
16
|
+
factory.devMenuConfiguration = RCTDevMenuConfiguration(
|
|
17
|
+
devMenuEnabled: false, shakeGestureEnabled: false, keyboardShortcutsEnabled: false)
|
|
18
|
+
#endif`, 'React Native factory')
|
|
19
|
+
}
|
|
20
|
+
contents = replaceRequired(contents,
|
|
21
|
+
/override func bundleURL\(\) -> URL\? \{[\s\S]*?\n \}/,
|
|
22
|
+
`override func bundleURL() -> URL? {
|
|
23
|
+
return Bundle.main.url(forResource: "main", withExtension: "jsbundle")
|
|
24
|
+
}`, 'bundleURL method')
|
|
25
|
+
config.modResults.contents = contents
|
|
26
|
+
return config
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
config = withXcodeProject(config, config => {
|
|
30
|
+
const phases = Object.values(config.modResults.hash.project.objects.PBXShellScriptBuildPhase || {})
|
|
31
|
+
const phase = phases.find(phase => phase.name === '"Bundle React Native code and images"')
|
|
32
|
+
if (!phase) throw new Error('Standalone build: cannot find iOS bundle build phase')
|
|
33
|
+
// Bundle plain JS in Debug as well. Hermes loads it directly, without an
|
|
34
|
+
// additional optimizing bytecode compiler pass or a Metro server.
|
|
35
|
+
phase.shellScript = JSON.stringify(`set -e
|
|
36
|
+
if [[ -f "$SRCROOT/.xcode.env" ]]; then source "$SRCROOT/.xcode.env"; fi
|
|
37
|
+
if [[ -f "$SRCROOT/.xcode.env.local" ]]; then source "$SRCROOT/.xcode.env.local"; fi
|
|
38
|
+
export PROJECT_ROOT="$PROJECT_DIR/.."
|
|
39
|
+
cd "$PROJECT_ROOT"
|
|
40
|
+
export NODE_ENV=production
|
|
41
|
+
export RCT_NO_LAUNCH_PACKAGER=1
|
|
42
|
+
ENTRY_FILE=$("$NODE_BINARY" -e "require('expo/scripts/resolveAppEntry')" "$PROJECT_ROOT" ios absolute | tail -n 1)
|
|
43
|
+
CLI_PATH=$("$NODE_BINARY" --print "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })")
|
|
44
|
+
DEST="$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH"
|
|
45
|
+
mkdir -p "$DEST"
|
|
46
|
+
rm -rf "$DEST/web"
|
|
47
|
+
mkdir -p "$DEST/web/src"
|
|
48
|
+
cp src/*.html src/*.css "$DEST/web/src/"
|
|
49
|
+
cp -R images "$DEST/web/"
|
|
50
|
+
"$NODE_BINARY" "$CLI_PATH" export:embed --entry-file "$ENTRY_FILE" --platform ios --dev false --minify false --bundle-output "$DEST/main.jsbundle" --assets-dest "$DEST"
|
|
51
|
+
`)
|
|
52
|
+
phase.alwaysOutOfDate = 1
|
|
53
|
+
return config
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
config = withMainApplication(config, config => {
|
|
57
|
+
if (!config.modResults.contents.includes('useDevSupport = false')) {
|
|
58
|
+
config.modResults.contents = replaceRequired(config.modResults.contents,
|
|
59
|
+
/context = applicationContext,/, 'context = applicationContext,\n useDevSupport = false,', 'Android ReactHost context')
|
|
60
|
+
}
|
|
61
|
+
return config
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
config = withAppBuildGradle(config, config => {
|
|
65
|
+
if (!config.modResults.contents.includes('// Standalone demo: embed JS in Debug.')) {
|
|
66
|
+
config.modResults.contents = replaceRequired(config.modResults.contents, /react \{/,
|
|
67
|
+
`react {
|
|
68
|
+
// Standalone demo: embed JS in Debug.
|
|
69
|
+
debuggableVariants = []
|
|
70
|
+
extraPackagerArgs = ["--minify", "false"]
|
|
71
|
+
hermesFlags = ["-O0"]`, 'Android react block')
|
|
72
|
+
}
|
|
73
|
+
if (!config.modResults.contents.includes('tasks.register("copyWebAssets", Sync)')) {
|
|
74
|
+
config.modResults.contents += `
|
|
75
|
+
android.sourceSets.main.assets.srcDir(layout.buildDirectory.dir("generated/webAssets").get().asFile)
|
|
76
|
+
tasks.register("copyWebAssets", Sync) {
|
|
77
|
+
from(projectRoot) { include "src/*.html", "src/*.css", "images/**" }
|
|
78
|
+
into(layout.buildDirectory.dir("generated/webAssets/web"))
|
|
79
|
+
}
|
|
80
|
+
tasks.named("preBuild").configure { dependsOn("copyWebAssets") }
|
|
81
|
+
`
|
|
82
|
+
}
|
|
83
|
+
return config
|
|
84
|
+
})
|
|
85
|
+
return config
|
|
86
|
+
}
|
|
@@ -3,35 +3,71 @@ import { IDV, Workflow } from '@regulaforensics/idv'
|
|
|
3
3
|
enum Configuration { credentials, token, apiKey }
|
|
4
4
|
|
|
5
5
|
const loginType: Configuration = Configuration.credentials
|
|
6
|
-
const baseUrl = "https://idv.
|
|
6
|
+
const baseUrl = "https://app.idv-platform.com"
|
|
7
7
|
const username = "username_placeholder"
|
|
8
8
|
const password = "password_placeholder"
|
|
9
9
|
const tokenUrl = "token_placeholder"
|
|
10
10
|
const apiKey = "api_key_placeholder"
|
|
11
11
|
|
|
12
|
-
var idv = IDV.instance
|
|
13
12
|
var selectedWorkflow = ""
|
|
14
|
-
|
|
13
|
+
|
|
14
|
+
var idv = IDV.instance
|
|
15
|
+
var workflowFilter: string[] = []
|
|
15
16
|
|
|
16
17
|
async function init() {
|
|
18
|
+
setStatus("Initializing...")
|
|
17
19
|
var [_, iError] = await idv.initialize()
|
|
18
20
|
if (handleException(iError, "initialize")) return
|
|
19
21
|
|
|
20
|
-
var
|
|
22
|
+
var login = ({
|
|
21
23
|
[Configuration.credentials]: async () => await configureWithCredentials(),
|
|
22
24
|
[Configuration.token]: async () => await configureWithToken(),
|
|
23
25
|
[Configuration.apiKey]: async () => await configureApiKey(),
|
|
24
26
|
})[loginType]!
|
|
25
|
-
if (!await
|
|
27
|
+
if (!await login()) return
|
|
28
|
+
|
|
29
|
+
if (selectedWorkflow.length > 0) {
|
|
30
|
+
workflowFilter = [] // Reset the filter in case both workflow and filter are specified.
|
|
31
|
+
// Show a list of 1 element just to show the workflow name.
|
|
32
|
+
var workflow = await prepareSelectedWorkflow()
|
|
33
|
+
if (workflow != null) setWorkflows([workflow])
|
|
34
|
+
return
|
|
35
|
+
}
|
|
36
|
+
if (workflowFilter.length > 0) {
|
|
37
|
+
showWorkflowList()
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
setStatus("No workflow selected!")
|
|
41
|
+
setDescription("Manually set `selectedWorkflow` to your workflow ID")
|
|
42
|
+
}
|
|
26
43
|
|
|
27
|
-
|
|
44
|
+
async function showWorkflowList() {
|
|
45
|
+
setStatus("Fetching workflows...")
|
|
46
|
+
let [wfs, error] = await idv.getWorkflows()
|
|
28
47
|
if (handleException(error, "getWorkflows")) return
|
|
29
|
-
|
|
30
|
-
|
|
48
|
+
wfs = workflowFilter.flatMap(id => wfs!.filter(wf => wf.id === id))
|
|
49
|
+
if (wfs.length > 0) {
|
|
50
|
+
setWorkflows(wfs)
|
|
51
|
+
return
|
|
31
52
|
}
|
|
53
|
+
setStatus("Empty workflow list!")
|
|
54
|
+
setDescription("No workflows remain after filtration")
|
|
55
|
+
}
|
|
32
56
|
|
|
33
|
-
|
|
34
|
-
setStatus("
|
|
57
|
+
async function prepareSelectedWorkflow() {
|
|
58
|
+
setStatus("Preparing Workflow...")
|
|
59
|
+
const [workflow, prepareError] = await idv.prepareWorkflow({ workflowId: selectedWorkflow })
|
|
60
|
+
handleException(prepareError, "prepareWorkflow")
|
|
61
|
+
return workflow
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async function startWorkflow(): Promise<void> {
|
|
65
|
+
// If workflow is chosen from the list then it's not prepared yet.
|
|
66
|
+
if (workflowFilter.length > 0 && await prepareSelectedWorkflow() == null) return
|
|
67
|
+
var [result, error] = await idv.startWorkflow()
|
|
68
|
+
if (handleException(error, "startWorkflow")) return
|
|
69
|
+
setStatus("Success")
|
|
70
|
+
setDescription(`SessionID: ${result?.sessionId}`)
|
|
35
71
|
}
|
|
36
72
|
|
|
37
73
|
async function configureWithCredentials(): Promise<boolean> {
|
|
@@ -45,9 +81,10 @@ async function configureWithCredentials(): Promise<boolean> {
|
|
|
45
81
|
}
|
|
46
82
|
|
|
47
83
|
async function configureWithToken(): Promise<boolean> {
|
|
48
|
-
var [
|
|
84
|
+
var [workflowIds, error] = await idv.configureWithToken({ url: tokenUrl })
|
|
49
85
|
if (handleException(error, "configureWithToken")) return false
|
|
50
|
-
|
|
86
|
+
// Filter the IDs to the ones allowed by the token.
|
|
87
|
+
workflowFilter = workflowFilter.filter(wf => workflowIds!.includes(wf))
|
|
51
88
|
return true
|
|
52
89
|
}
|
|
53
90
|
|
|
@@ -57,20 +94,6 @@ async function configureApiKey(): Promise<boolean> {
|
|
|
57
94
|
return success
|
|
58
95
|
}
|
|
59
96
|
|
|
60
|
-
async function startWorkflow(): Promise<void> {
|
|
61
|
-
if (selectedWorkflow.length == 0) return
|
|
62
|
-
setStatus("Preparing Workflow...")
|
|
63
|
-
|
|
64
|
-
var [_, prepareError] = await idv.prepareWorkflow({ workflowId: selectedWorkflow })
|
|
65
|
-
if (handleException(prepareError, "prepareWorkflow")) return
|
|
66
|
-
|
|
67
|
-
var [result, error] = await idv.startWorkflow()
|
|
68
|
-
if (handleException(error, "startWorkflow")) return
|
|
69
|
-
|
|
70
|
-
setStatus("Success")
|
|
71
|
-
setDescription(`SessionID: ${result?.sessionId}`)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
97
|
function handleException(error?: string | null, tag?: string): boolean {
|
|
75
98
|
if (error == null) return false
|
|
76
99
|
setStatus(`Error - IDV.${tag}()`)
|
|
@@ -97,9 +120,8 @@ var workflows: Workflow[] = []
|
|
|
97
120
|
function setWorkflows(data: Workflow[]) {
|
|
98
121
|
var radioGroup = document.getElementById("radio-group")!
|
|
99
122
|
workflows = data
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
123
|
+
selectedWorkflow = workflows[0].id
|
|
124
|
+
setStatus("Ready")
|
|
103
125
|
|
|
104
126
|
data.forEach(item => {
|
|
105
127
|
var checked = selectedWorkflow == item.id ? "checked" : ""
|
package/ios/CDVIDV.swift
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
#if canImport(Cordova)
|
|
2
|
+
import Cordova
|
|
3
|
+
#endif
|
|
4
|
+
import UIKit
|
|
5
|
+
|
|
1
6
|
@objc(CDVIDV)
|
|
2
7
|
class CDVIDV: CDVPlugin {
|
|
3
8
|
@objc(exec:)
|
|
@@ -33,10 +38,22 @@ func sendEvent(_ event: String, _ data: Any? = "") {
|
|
|
33
38
|
this!.commandDelegate.send(result!, callbackId: callbackId)
|
|
34
39
|
}
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
func withPresenter(_ action: @escaping (UIViewController) -> Void) {
|
|
42
|
+
DispatchQueue.main.async {
|
|
43
|
+
let windows = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.filter { $0.activationState == .foregroundActive || $0.activationState == .foregroundInactive }.flatMap { $0.windows }
|
|
44
|
+
let candidates = windows.filter { $0.isKeyWindow } + windows.filter { !$0.isKeyWindow && !$0.isHidden && $0.alpha > 0 && $0.windowLevel == .normal }
|
|
45
|
+
for window in candidates {
|
|
46
|
+
guard var presenter = window.rootViewController else { continue }
|
|
47
|
+
while let next = presenter.presentedViewController
|
|
48
|
+
?? (presenter as? UINavigationController)?.visibleViewController
|
|
49
|
+
?? (presenter as? UINavigationController)?.topViewController
|
|
50
|
+
?? (presenter as? UITabBarController)?.selectedViewController {
|
|
51
|
+
presenter = next
|
|
52
|
+
}
|
|
53
|
+
guard presenter.viewIfLoaded?.window != nil else { continue }
|
|
54
|
+
action(presenter)
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
print("REGULA: Cannot present the UI: no presenter available.")
|
|
58
|
+
}
|
|
42
59
|
}
|
|
@@ -68,8 +68,8 @@ func prepareWorkflow(_ callback: @escaping Callback, _ data: [String: Any?]) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
func startWorkflow(_ callback: @escaping Callback, _ data: [String: Any?]?) {
|
|
71
|
-
|
|
72
|
-
IDV.shared.startWorkflow(presenter:
|
|
71
|
+
withPresenter { presenter in
|
|
72
|
+
IDV.shared.startWorkflow(presenter: presenter,
|
|
73
73
|
config: startWorkflowConfigFromJSON(input: data),
|
|
74
74
|
completion: { result in
|
|
75
75
|
callback(generateCompletion(generateWorkflowResult(result.successOrNil), result.failureOrNil))
|
|
@@ -97,8 +97,8 @@ func sendData(_ callback: @escaping Callback, _ data: [String: Any?]) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
func startLogin(_ callback: @escaping Callback, _ data: [String: Any?]) {
|
|
100
|
-
|
|
101
|
-
IDV.shared.startLogin(presenter:
|
|
100
|
+
withPresenter { presenter in
|
|
101
|
+
IDV.shared.startLogin(presenter: presenter,
|
|
102
102
|
config: loginConfigFromJSON(data),
|
|
103
103
|
completion: { result in
|
|
104
104
|
callback(generateCompletion(result.successOrNil, result.failureOrNil))
|
package/ios/RNIDV.swift
CHANGED
|
@@ -30,9 +30,15 @@ private var this: RNIDV?
|
|
|
30
30
|
|
|
31
31
|
func sendEvent(_ event: String, _ data: Any? = nil) {
|
|
32
32
|
guard let plugin = this, hasListeners else { return }
|
|
33
|
+
DispatchQueue.main.async { plugin.sendEvent(withName: event, body: data.toSendable()) }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
func withPresenter(_ action: @escaping (UIViewController) -> Void) {
|
|
33
37
|
DispatchQueue.main.async {
|
|
34
|
-
|
|
38
|
+
if let presenter = RCTPresentedViewController() {
|
|
39
|
+
action(presenter)
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
print("REGULA: Cannot present Face SDK UI: no presenter available.")
|
|
35
43
|
}
|
|
36
44
|
}
|
|
37
|
-
|
|
38
|
-
let rootViewController: () -> UIViewController? = { return RCTPresentedViewController() }
|
package/ios/Utils.swift
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regulaforensics/idv",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.290-rc",
|
|
4
4
|
"description": "This is an npm module for Regula IDV, which unifies access to all Regula products. This plugin makes possible to use it with react-native, cordova and capacitor applications. Supports Android and iOS.",
|
|
5
5
|
"main": "www/react-native/index.js",
|
|
6
6
|
"module": "www/capacitor/index.js",
|
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<plugin id="@regulaforensics/idv" version="4.0.
|
|
2
|
+
<plugin id="@regulaforensics/idv" version="4.0.290-rc" xmlns="http://apache.org/cordova/ns/plugins/1.0">
|
|
3
3
|
<name>IDV</name>
|
|
4
4
|
<description>Cordova plugin for Regula IDV</description>
|
|
5
5
|
<license>commercial</license>
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
<clobbers target="IDVPlugin" />
|
|
10
10
|
</js-module>
|
|
11
11
|
|
|
12
|
-
<platform name="ios">
|
|
12
|
+
<platform name="ios" package="swift">
|
|
13
13
|
<config-file target="config.xml" parent="/widget">
|
|
14
14
|
<feature name="IDV">
|
|
15
15
|
<param name="ios-package" value="CDVIDV" />
|
|
16
16
|
</feature>
|
|
17
|
-
<preference name="deployment-target" value="
|
|
17
|
+
<preference name="deployment-target" value="15.0" />
|
|
18
18
|
<preference name="SwiftVersion" value="5" />
|
|
19
19
|
</config-file>
|
|
20
20
|
<source-file src="ios/CDVIDV.swift" />
|
|
21
|
-
<source-file src="ios/
|
|
21
|
+
<source-file src="ios/Implementation.swift" />
|
|
22
22
|
<source-file src="ios/JSONConstructor.swift" />
|
|
23
23
|
<source-file src="ios/Utils.swift" />
|
|
24
24
|
<podspec>
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<source url="https://github.com/regulaforensics/podspecs.git" />
|
|
27
27
|
</config>
|
|
28
28
|
<pods>
|
|
29
|
-
<pod name="
|
|
29
|
+
<pod name="IDVSDKStage" spec="4.0.2164" nospm="true" />
|
|
30
30
|
</pods>
|
|
31
31
|
</podspec>
|
|
32
32
|
</platform>
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
<param name="android-package" value="com.regula.plugin.idv.CDVIDV" />
|
|
38
38
|
</feature>
|
|
39
39
|
</config-file>
|
|
40
|
-
<framework src="android/cordova.gradle" custom="true" type="gradleReference" />
|
|
41
|
-
<source-file src="android/CDVIDV.kt" target-dir="
|
|
42
|
-
<source-file src="android/src/main/
|
|
43
|
-
<source-file src="android/src/main/
|
|
44
|
-
<source-file src="android/src/main/
|
|
40
|
+
<framework src="android/cordova.gradle.kts" custom="true" type="gradleReference" />
|
|
41
|
+
<source-file src="android/CDVIDV.kt" target-dir="kotlin/com.regula.plugin.idv" />
|
|
42
|
+
<source-file src="android/src/main/kotlin/com/regula/plugin/idv/Implementation.kt" target-dir="kotlin/com.regula.plugin.idv" />
|
|
43
|
+
<source-file src="android/src/main/kotlin/com/regula/plugin/idv/JSONConstructor.kt" target-dir="kotlin/com.regula.plugin.idv" />
|
|
44
|
+
<source-file src="android/src/main/kotlin/com/regula/plugin/idv/Utils.kt" target-dir="kotlin/com.regula.plugin.idv" />
|
|
45
45
|
</platform>
|
|
46
46
|
</plugin>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Pod::Spec.new do |s|
|
|
2
|
+
s.name = 'react-native-idv'
|
|
3
|
+
s.version = '4.0.290-rc'
|
|
4
|
+
s.summary = 'Regula React Native plugin.'
|
|
5
|
+
s.license = 'commercial'
|
|
6
|
+
s.authors = { 'RegulaForensics' => 'support@regulaforensics.com' }
|
|
7
|
+
s.homepage = 'https://regulaforensics.com'
|
|
8
|
+
s.source = { :path => '.' }
|
|
9
|
+
s.ios.deployment_target = '15.0'
|
|
10
|
+
s.source_files = [ 'ios/*.swift', 'ios/RN*.m' ]
|
|
11
|
+
s.exclude_files = [ 'ios/CDVIDV.swift' ]
|
|
12
|
+
s.dependency 'IDVSDKStage', '4.0.2164'
|
|
13
|
+
s.dependency 'React'
|
|
14
|
+
end
|
package/test/test.tsx
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
import { compare } from './utils'
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
CredentialsConnectionConfig,
|
|
4
|
+
TokenConnectionConfig,
|
|
5
|
+
ApiKeyConnectionConfig,
|
|
6
|
+
PrepareWorkflowConfig,
|
|
7
|
+
StartWorkflowConfig,
|
|
8
|
+
Workflow,
|
|
9
|
+
WorkflowStep,
|
|
10
|
+
WorkflowResult,
|
|
11
|
+
StartSessionConfig,
|
|
12
|
+
SendDataConfig,
|
|
13
|
+
LoginConfig,
|
|
14
|
+
} from '@regulaforensics/idv/www/capacitor'
|
|
15
|
+
import {
|
|
16
|
+
apiKeyConnectionConfig,
|
|
17
|
+
credentialsConnectionConfig,
|
|
18
|
+
prepareWorkflowConfig,
|
|
19
|
+
startWorkflowConfig,
|
|
20
|
+
tokenConnectionConfig,
|
|
21
|
+
workflow,
|
|
22
|
+
workflowStep,
|
|
23
|
+
workflowResult,
|
|
24
|
+
startSessionConfig,
|
|
25
|
+
sendDataConfig,
|
|
26
|
+
loginConfig,
|
|
27
|
+
} from './json'
|
|
4
28
|
|
|
5
29
|
compare('credentialsConnectionConfig', credentialsConnectionConfig, CredentialsConnectionConfig.fromJson)
|
|
6
30
|
compare('tokenConnectionConfig', tokenConnectionConfig, TokenConnectionConfig.fromJson)
|
package/www/capacitor/index.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
exec,
|
|
3
|
+
serializeInterface,
|
|
4
|
+
setDidStartSessionCompletion,
|
|
5
|
+
setDidEndSessionCompletion,
|
|
6
|
+
setDidStartRestoreSessionCompletion,
|
|
7
|
+
setDidContinueRemoteSessionCompletion,
|
|
8
|
+
} from './internal/bridge'
|
|
2
9
|
|
|
3
10
|
import { TokenConnectionConfig } from './config/token_connection_config'
|
|
4
11
|
import { CredentialsConnectionConfig } from './config/credentials_connection_config'
|
|
@@ -11,8 +18,19 @@ import { LoginConfig } from './config/login_config'
|
|
|
11
18
|
import { Workflow } from './model/workflow'
|
|
12
19
|
import { WorkflowResult } from './model/workflow_result'
|
|
13
20
|
import { WorkflowStep } from './model/workflow_step'
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
export {
|
|
22
|
+
TokenConnectionConfig,
|
|
23
|
+
CredentialsConnectionConfig,
|
|
24
|
+
ApiKeyConnectionConfig,
|
|
25
|
+
PrepareWorkflowConfig,
|
|
26
|
+
StartWorkflowConfig,
|
|
27
|
+
StartSessionConfig,
|
|
28
|
+
SendDataConfig,
|
|
29
|
+
LoginConfig,
|
|
30
|
+
Workflow,
|
|
31
|
+
WorkflowResult,
|
|
32
|
+
WorkflowStep,
|
|
33
|
+
}
|
|
16
34
|
|
|
17
35
|
export class IDV {
|
|
18
36
|
static get instance() { return IDV._instance }
|
|
@@ -8,7 +8,8 @@ export async function exec(name, params) {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export function serializeInterface(value, ctor) {
|
|
11
|
-
if (value
|
|
11
|
+
if (value === undefined) return undefined
|
|
12
|
+
if (value === null) return null
|
|
12
13
|
if (value instanceof ctor) return value.toJson()
|
|
13
14
|
return (new ctor(value)).toJson()
|
|
14
15
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var _exec = (completion, params) => cordova.exec(completion,
|
|
1
|
+
var _exec = (completion, params, errorCallback = null) => cordova.exec(completion, errorCallback, "IDV", "exec", params)
|
|
2
2
|
|
|
3
3
|
export const NativeModules = {
|
|
4
4
|
RNIDV: {
|
|
5
|
-
exec: async (name, params) => new Promise((resolve,
|
|
5
|
+
exec: async (name, params) => new Promise((resolve, reject) => _exec(resolve, [name, ...params], error => reject(new Error(error))))
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
|