@idpass/smartscanner-capacitor 0.6.0 → 0.7.0
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/IdpassSmartscannerCapacitor.podspec +17 -17
- package/LICENSE +201 -201
- package/README.md +125 -125
- package/android/.gradle/8.0.2/checksums/checksums.lock +0 -0
- package/android/.gradle/8.0.2/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.0.2/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.0.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/8.0.2/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.0.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.0.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.0.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.npmignore +1 -1
- package/android/.project +28 -0
- package/android/build.gradle +151 -151
- package/android/gradle/wrapper/gradle-wrapper.properties +6 -6
- package/android/gradle.properties +22 -22
- package/android/gradlew +188 -188
- package/android/proguard-rules.pro +21 -21
- package/android/settings.gradle +1 -1
- package/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java +28 -28
- package/android/src/main/AndroidManifest.xml +2 -2
- package/android/src/main/java/org/idpass/smartscanner/capacitor/SmartScannerPlugin.kt +75 -75
- package/android/src/main/res/layout/bridge_layout_main.xml +13 -13
- package/android/src/main/res/values/colors.xml +3 -3
- package/android/src/main/res/values/strings.xml +3 -3
- package/android/src/main/res/values/styles.xml +3 -3
- package/android/src/test/java/com/getcapacitor/ExampleUnitTest.java +18 -18
- package/ios/.npmignore +3 -3
- package/ios/Plugin/Info.plist +24 -24
- package/ios/Plugin/Plugin.h +10 -10
- package/ios/Plugin/Plugin.m +8 -8
- package/ios/Plugin/Plugin.swift +17 -17
- package/ios/Plugin.xcodeproj/project.pbxproj +554 -554
- package/ios/PluginTests/Info.plist +22 -22
- package/ios/PluginTests/PluginTests.swift +35 -35
- package/ios/Podfile +16 -16
- package/package.json +8 -9
- package/android/.DS_Store +0 -0
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
package org.idpass.smartscanner.capacitor
|
|
2
|
-
|
|
3
|
-
import android.app.Activity
|
|
4
|
-
import android.content.Intent
|
|
5
|
-
import androidx.activity.result.ActivityResult
|
|
6
|
-
import com.getcapacitor.JSObject
|
|
7
|
-
import com.getcapacitor.Logger
|
|
8
|
-
import com.getcapacitor.Plugin
|
|
9
|
-
import com.getcapacitor.PluginCall
|
|
10
|
-
import com.getcapacitor.PluginMethod
|
|
11
|
-
import com.getcapacitor.annotation.ActivityCallback
|
|
12
|
-
import com.getcapacitor.annotation.CapacitorPlugin
|
|
13
|
-
import com.google.gson.Gson
|
|
14
|
-
import org.idpass.smartscanner.lib.SmartScannerActivity
|
|
15
|
-
import org.idpass.smartscanner.lib.scanner.config.ScannerOptions
|
|
16
|
-
import org.json.JSONException
|
|
17
|
-
import org.json.JSONObject
|
|
18
|
-
import timber.log.Timber
|
|
19
|
-
|
|
20
|
-
@CapacitorPlugin(name = "SmartScanner")
|
|
21
|
-
class SmartScannerPlugin : Plugin() {
|
|
22
|
-
|
|
23
|
-
@PluginMethod
|
|
24
|
-
fun executeScanner(call: PluginCall) {
|
|
25
|
-
try {
|
|
26
|
-
val action = call.getString("action")
|
|
27
|
-
val options: JSONObject = call.getObject("options")
|
|
28
|
-
if (action == "START_SCANNER") {
|
|
29
|
-
Timber.d("executeScanner %s", action)
|
|
30
|
-
val intent = Intent(context, SmartScannerActivity::class.java)
|
|
31
|
-
val scannerOptions = Gson().fromJson(options.toString(), ScannerOptions::class.java)
|
|
32
|
-
intent.putExtra(SmartScannerActivity.SCANNER_OPTIONS, scannerOptions)
|
|
33
|
-
startActivityForResult(call, intent, "requestScannerResult")
|
|
34
|
-
} else {
|
|
35
|
-
call.reject("\"$action\" is not a recognized action.")
|
|
36
|
-
}
|
|
37
|
-
} catch (e: Exception) {
|
|
38
|
-
call.reject(e.toString() ,e)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@ActivityCallback
|
|
43
|
-
private fun requestScannerResult(call: PluginCall, result: ActivityResult) {
|
|
44
|
-
try {
|
|
45
|
-
if (result.resultCode == Activity.RESULT_CANCELED) {
|
|
46
|
-
Timber.d("SmartScanner: RESULT CANCELLED")
|
|
47
|
-
call.reject("Scanning Cancelled.")
|
|
48
|
-
} else {
|
|
49
|
-
if (result.resultCode == Activity.RESULT_OK) {
|
|
50
|
-
val returnedResult = result.data?.getStringExtra(SmartScannerActivity.SCANNER_RESULT)
|
|
51
|
-
try {
|
|
52
|
-
if (returnedResult != null) {
|
|
53
|
-
Timber.d("SmartScanner: RESULT OK -- $returnedResult")
|
|
54
|
-
val scannerResult = JSONObject(returnedResult)
|
|
55
|
-
val ret = JSObject()
|
|
56
|
-
ret.put(SmartScannerActivity.SCANNER_RESULT, scannerResult)
|
|
57
|
-
call.resolve(ret)
|
|
58
|
-
} else {
|
|
59
|
-
Timber.d("SmartScanner: RESULT SCANNING NULL")
|
|
60
|
-
call.reject("Scanning result is null.")
|
|
61
|
-
}
|
|
62
|
-
} catch (e: JSONException) {
|
|
63
|
-
e.printStackTrace()
|
|
64
|
-
call.reject(e.toString() ,e)
|
|
65
|
-
}
|
|
66
|
-
} else {
|
|
67
|
-
Timber.d("SmartScanner: RESULT SCANNING FAILED")
|
|
68
|
-
call.reject("Scanning Failed.")
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
} catch (e: Exception) {
|
|
72
|
-
call.reject(e.toString() ,e)
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
1
|
+
package org.idpass.smartscanner.capacitor
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.content.Intent
|
|
5
|
+
import androidx.activity.result.ActivityResult
|
|
6
|
+
import com.getcapacitor.JSObject
|
|
7
|
+
import com.getcapacitor.Logger
|
|
8
|
+
import com.getcapacitor.Plugin
|
|
9
|
+
import com.getcapacitor.PluginCall
|
|
10
|
+
import com.getcapacitor.PluginMethod
|
|
11
|
+
import com.getcapacitor.annotation.ActivityCallback
|
|
12
|
+
import com.getcapacitor.annotation.CapacitorPlugin
|
|
13
|
+
import com.google.gson.Gson
|
|
14
|
+
import org.idpass.smartscanner.lib.SmartScannerActivity
|
|
15
|
+
import org.idpass.smartscanner.lib.scanner.config.ScannerOptions
|
|
16
|
+
import org.json.JSONException
|
|
17
|
+
import org.json.JSONObject
|
|
18
|
+
import timber.log.Timber
|
|
19
|
+
|
|
20
|
+
@CapacitorPlugin(name = "SmartScanner")
|
|
21
|
+
class SmartScannerPlugin : Plugin() {
|
|
22
|
+
|
|
23
|
+
@PluginMethod
|
|
24
|
+
fun executeScanner(call: PluginCall) {
|
|
25
|
+
try {
|
|
26
|
+
val action = call.getString("action")
|
|
27
|
+
val options: JSONObject = call.getObject("options")
|
|
28
|
+
if (action == "START_SCANNER") {
|
|
29
|
+
Timber.d("executeScanner %s", action)
|
|
30
|
+
val intent = Intent(context, SmartScannerActivity::class.java)
|
|
31
|
+
val scannerOptions = Gson().fromJson(options.toString(), ScannerOptions::class.java)
|
|
32
|
+
intent.putExtra(SmartScannerActivity.SCANNER_OPTIONS, scannerOptions)
|
|
33
|
+
startActivityForResult(call, intent, "requestScannerResult")
|
|
34
|
+
} else {
|
|
35
|
+
call.reject("\"$action\" is not a recognized action.")
|
|
36
|
+
}
|
|
37
|
+
} catch (e: Exception) {
|
|
38
|
+
call.reject(e.toString() ,e)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@ActivityCallback
|
|
43
|
+
private fun requestScannerResult(call: PluginCall, result: ActivityResult) {
|
|
44
|
+
try {
|
|
45
|
+
if (result.resultCode == Activity.RESULT_CANCELED) {
|
|
46
|
+
Timber.d("SmartScanner: RESULT CANCELLED")
|
|
47
|
+
call.reject("Scanning Cancelled.")
|
|
48
|
+
} else {
|
|
49
|
+
if (result.resultCode == Activity.RESULT_OK) {
|
|
50
|
+
val returnedResult = result.data?.getStringExtra(SmartScannerActivity.SCANNER_RESULT)
|
|
51
|
+
try {
|
|
52
|
+
if (returnedResult != null) {
|
|
53
|
+
Timber.d("SmartScanner: RESULT OK -- $returnedResult")
|
|
54
|
+
val scannerResult = JSONObject(returnedResult)
|
|
55
|
+
val ret = JSObject()
|
|
56
|
+
ret.put(SmartScannerActivity.SCANNER_RESULT, scannerResult)
|
|
57
|
+
call.resolve(ret)
|
|
58
|
+
} else {
|
|
59
|
+
Timber.d("SmartScanner: RESULT SCANNING NULL")
|
|
60
|
+
call.reject("Scanning result is null.")
|
|
61
|
+
}
|
|
62
|
+
} catch (e: JSONException) {
|
|
63
|
+
e.printStackTrace()
|
|
64
|
+
call.reject(e.toString() ,e)
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
Timber.d("SmartScanner: RESULT SCANNING FAILED")
|
|
68
|
+
call.reject("Scanning Failed.")
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
} catch (e: Exception) {
|
|
72
|
+
call.reject(e.toString() ,e)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
-
xmlns:tools="http://schemas.android.com/tools"
|
|
4
|
-
android:layout_width="match_parent"
|
|
5
|
-
android:layout_height="match_parent"
|
|
6
|
-
tools:context="com.getcapacitor.BridgeActivity">
|
|
7
|
-
|
|
8
|
-
<WebView
|
|
9
|
-
android:id="@+id/webview"
|
|
10
|
-
android:layout_width="fill_parent"
|
|
11
|
-
android:layout_height="fill_parent" />
|
|
12
|
-
|
|
13
|
-
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
xmlns:tools="http://schemas.android.com/tools"
|
|
4
|
+
android:layout_width="match_parent"
|
|
5
|
+
android:layout_height="match_parent"
|
|
6
|
+
tools:context="com.getcapacitor.BridgeActivity">
|
|
7
|
+
|
|
8
|
+
<WebView
|
|
9
|
+
android:id="@+id/webview"
|
|
10
|
+
android:layout_width="fill_parent"
|
|
11
|
+
android:layout_height="fill_parent" />
|
|
12
|
+
|
|
13
|
+
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<resources>
|
|
3
|
-
</resources>
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<resources>
|
|
3
|
+
</resources>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<resources>
|
|
2
|
-
<string name="my_string">Just a simple string</string>
|
|
3
|
-
</resources>
|
|
1
|
+
<resources>
|
|
2
|
+
<string name="my_string">Just a simple string</string>
|
|
3
|
+
</resources>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<resources>
|
|
2
|
-
|
|
3
|
-
</resources>
|
|
1
|
+
<resources>
|
|
2
|
+
|
|
3
|
+
</resources>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
package com.getcapacitor;
|
|
2
|
-
|
|
3
|
-
import org.junit.Test;
|
|
4
|
-
|
|
5
|
-
import static org.junit.Assert.assertEquals;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Example local unit test, which will execute on the development machine (host).
|
|
9
|
-
*
|
|
10
|
-
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
|
11
|
-
*/
|
|
12
|
-
public class ExampleUnitTest {
|
|
13
|
-
|
|
14
|
-
@Test
|
|
15
|
-
public void addition_isCorrect() throws Exception {
|
|
16
|
-
assertEquals(4, 2 + 2);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
1
|
+
package com.getcapacitor;
|
|
2
|
+
|
|
3
|
+
import org.junit.Test;
|
|
4
|
+
|
|
5
|
+
import static org.junit.Assert.assertEquals;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Example local unit test, which will execute on the development machine (host).
|
|
9
|
+
*
|
|
10
|
+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
|
11
|
+
*/
|
|
12
|
+
public class ExampleUnitTest {
|
|
13
|
+
|
|
14
|
+
@Test
|
|
15
|
+
public void addition_isCorrect() throws Exception {
|
|
16
|
+
assertEquals(4, 2 + 2);
|
|
17
|
+
}
|
|
18
|
+
}
|
package/ios/.npmignore
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Pods/
|
|
2
|
-
Podfile.lock
|
|
3
|
-
contents.xcworkspacedata
|
|
1
|
+
Pods/
|
|
2
|
+
Podfile.lock
|
|
3
|
+
contents.xcworkspacedata
|
|
4
4
|
xcuserdata/
|
package/ios/Plugin/Info.plist
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
-
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
|
7
|
-
<key>CFBundleExecutable</key>
|
|
8
|
-
<string>$(EXECUTABLE_NAME)</string>
|
|
9
|
-
<key>CFBundleIdentifier</key>
|
|
10
|
-
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
11
|
-
<key>CFBundleInfoDictionaryVersion</key>
|
|
12
|
-
<string>6.0</string>
|
|
13
|
-
<key>CFBundleName</key>
|
|
14
|
-
<string>$(PRODUCT_NAME)</string>
|
|
15
|
-
<key>CFBundlePackageType</key>
|
|
16
|
-
<string>FMWK</string>
|
|
17
|
-
<key>CFBundleShortVersionString</key>
|
|
18
|
-
<string>1.0</string>
|
|
19
|
-
<key>CFBundleVersion</key>
|
|
20
|
-
<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
21
|
-
<key>NSPrincipalClass</key>
|
|
22
|
-
<string></string>
|
|
23
|
-
</dict>
|
|
24
|
-
</plist>
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
+
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
|
7
|
+
<key>CFBundleExecutable</key>
|
|
8
|
+
<string>$(EXECUTABLE_NAME)</string>
|
|
9
|
+
<key>CFBundleIdentifier</key>
|
|
10
|
+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
11
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
12
|
+
<string>6.0</string>
|
|
13
|
+
<key>CFBundleName</key>
|
|
14
|
+
<string>$(PRODUCT_NAME)</string>
|
|
15
|
+
<key>CFBundlePackageType</key>
|
|
16
|
+
<string>FMWK</string>
|
|
17
|
+
<key>CFBundleShortVersionString</key>
|
|
18
|
+
<string>1.0</string>
|
|
19
|
+
<key>CFBundleVersion</key>
|
|
20
|
+
<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
21
|
+
<key>NSPrincipalClass</key>
|
|
22
|
+
<string></string>
|
|
23
|
+
</dict>
|
|
24
|
+
</plist>
|
package/ios/Plugin/Plugin.h
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
#import <UIKit/UIKit.h>
|
|
2
|
-
|
|
3
|
-
//! Project version number for Plugin.
|
|
4
|
-
FOUNDATION_EXPORT double PluginVersionNumber;
|
|
5
|
-
|
|
6
|
-
//! Project version string for Plugin.
|
|
7
|
-
FOUNDATION_EXPORT const unsigned char PluginVersionString[];
|
|
8
|
-
|
|
9
|
-
// In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
|
|
10
|
-
|
|
1
|
+
#import <UIKit/UIKit.h>
|
|
2
|
+
|
|
3
|
+
//! Project version number for Plugin.
|
|
4
|
+
FOUNDATION_EXPORT double PluginVersionNumber;
|
|
5
|
+
|
|
6
|
+
//! Project version string for Plugin.
|
|
7
|
+
FOUNDATION_EXPORT const unsigned char PluginVersionString[];
|
|
8
|
+
|
|
9
|
+
// In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
|
|
10
|
+
|
package/ios/Plugin/Plugin.m
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#import <Foundation/Foundation.h>
|
|
2
|
-
#import <Capacitor/Capacitor.h>
|
|
3
|
-
|
|
4
|
-
// Define the plugin using the CAP_PLUGIN Macro, and
|
|
5
|
-
// each method the plugin supports using the CAP_PLUGIN_METHOD macro.
|
|
6
|
-
CAP_PLUGIN(SmartScannerPlugin, "SmartScannerPlugin",
|
|
7
|
-
CAP_PLUGIN_METHOD(echo, CAPPluginReturnPromise);
|
|
8
|
-
)
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
#import <Capacitor/Capacitor.h>
|
|
3
|
+
|
|
4
|
+
// Define the plugin using the CAP_PLUGIN Macro, and
|
|
5
|
+
// each method the plugin supports using the CAP_PLUGIN_METHOD macro.
|
|
6
|
+
CAP_PLUGIN(SmartScannerPlugin, "SmartScannerPlugin",
|
|
7
|
+
CAP_PLUGIN_METHOD(echo, CAPPluginReturnPromise);
|
|
8
|
+
)
|
package/ios/Plugin/Plugin.swift
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
import Capacitor
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Please read the Capacitor iOS Plugin Development Guide
|
|
6
|
-
* here: https://capacitorjs.com/docs/plugins/ios
|
|
7
|
-
*/
|
|
8
|
-
@objc(SmartScannerPlugin)
|
|
9
|
-
public class SmartScannerPlugin: CAPPlugin {
|
|
10
|
-
|
|
11
|
-
@objc func echo(_ call: CAPPluginCall) {
|
|
12
|
-
let value = call.getString("value") ?? ""
|
|
13
|
-
call.success([
|
|
14
|
-
"value": value
|
|
15
|
-
])
|
|
16
|
-
}
|
|
17
|
-
}
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Please read the Capacitor iOS Plugin Development Guide
|
|
6
|
+
* here: https://capacitorjs.com/docs/plugins/ios
|
|
7
|
+
*/
|
|
8
|
+
@objc(SmartScannerPlugin)
|
|
9
|
+
public class SmartScannerPlugin: CAPPlugin {
|
|
10
|
+
|
|
11
|
+
@objc func echo(_ call: CAPPluginCall) {
|
|
12
|
+
let value = call.getString("value") ?? ""
|
|
13
|
+
call.success([
|
|
14
|
+
"value": value
|
|
15
|
+
])
|
|
16
|
+
}
|
|
17
|
+
}
|