@scrumble-nl/react-native-honeywell-scanner 1.3.10 → 1.4.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/android/build.gradle +42 -38
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/{reactlibrary → scrumble/honeywellscannerinterface}/HoneywellScannerModule.java +3 -8
- package/android/src/main/java/com/{reactlibrary → scrumble/honeywellscannerinterface}/HoneywellScannerPackage.java +1 -1
- package/dist/index.d.ts +28 -2
- package/dist/index.js +32 -17
- package/package.json +8 -4
package/android/build.gradle
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
// android/build.gradle
|
|
2
2
|
|
|
3
|
-
// based on:
|
|
4
|
-
//
|
|
5
|
-
// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle
|
|
6
|
-
// original location:
|
|
7
|
-
// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/build.gradle
|
|
8
|
-
//
|
|
9
|
-
// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/app/build.gradle
|
|
10
|
-
// original location:
|
|
11
|
-
// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle
|
|
12
|
-
|
|
13
|
-
def DEFAULT_COMPILE_SDK_VERSION = 30
|
|
14
|
-
def DEFAULT_BUILD_TOOLS_VERSION = "30.0.2"
|
|
15
|
-
def DEFAULT_MIN_SDK_VERSION = 21
|
|
16
|
-
def DEFAULT_TARGET_SDK_VERSION = 30
|
|
17
|
-
def DEFAULT_NDK_VERSION = "21.4.7075529"
|
|
18
|
-
|
|
19
3
|
def safeExtGet(prop, fallback) {
|
|
20
4
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
21
5
|
}
|
|
22
6
|
|
|
23
|
-
|
|
24
|
-
|
|
7
|
+
def myAttribute = Attribute.of("com.android.build.api.attributes.BuildTypeAttr", String)
|
|
8
|
+
|
|
9
|
+
dependencies.attributesSchema {
|
|
10
|
+
// registers this attribute to the attributes attributes
|
|
11
|
+
attribute(myAttribute)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
configurations {
|
|
15
|
+
implementation {
|
|
16
|
+
attributes {
|
|
17
|
+
attribute(myAttribute, "release")
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
25
21
|
|
|
26
22
|
buildscript {
|
|
27
23
|
// The Android Gradle plugin is only required when opening the android folder stand-alone.
|
|
@@ -31,19 +27,23 @@ buildscript {
|
|
|
31
27
|
if (project == rootProject) {
|
|
32
28
|
repositories {
|
|
33
29
|
google()
|
|
34
|
-
|
|
30
|
+
mavenCentral()
|
|
35
31
|
}
|
|
36
32
|
dependencies {
|
|
37
|
-
classpath 'com.android.tools.build:gradle:4.
|
|
33
|
+
classpath 'com.android.tools.build:gradle:4.1.1'
|
|
38
34
|
}
|
|
39
35
|
}
|
|
40
36
|
}
|
|
41
37
|
|
|
42
38
|
apply plugin: 'com.android.library'
|
|
43
|
-
apply plugin: 'maven'
|
|
39
|
+
apply plugin: 'maven-publish'
|
|
40
|
+
|
|
41
|
+
def DEFAULT_COMPILE_SDK_VERSION = 31
|
|
42
|
+
def DEFAULT_BUILD_TOOLS_VERSION = "31.0.0"
|
|
43
|
+
def DEFAULT_MIN_SDK_VERSION = 21
|
|
44
|
+
def DEFAULT_TARGET_SDK_VERSION = 31
|
|
44
45
|
|
|
45
46
|
android {
|
|
46
|
-
ndkVersion safeExtGet('ndkVersion', DEFAULT_NDK_VERSION)
|
|
47
47
|
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
|
|
48
48
|
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
|
|
49
49
|
defaultConfig {
|
|
@@ -58,22 +58,28 @@ android {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
repositories {
|
|
61
|
-
// ref: https://www.baeldung.com/maven-local-repository
|
|
62
|
-
mavenLocal()
|
|
63
61
|
maven {
|
|
64
62
|
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
65
|
-
url
|
|
63
|
+
url("$rootDir/../node_modules/react-native/android")
|
|
66
64
|
}
|
|
67
65
|
maven {
|
|
68
66
|
// Android JSC is installed from npm
|
|
69
|
-
url
|
|
67
|
+
url("$rootDir/../node_modules/jsc-android/dist")
|
|
68
|
+
}
|
|
69
|
+
mavenCentral {
|
|
70
|
+
// We don't want to fetch react-native from Maven Central as there are
|
|
71
|
+
// older versions over there.
|
|
72
|
+
content {
|
|
73
|
+
excludeGroup "com.facebook.react"
|
|
74
|
+
}
|
|
70
75
|
}
|
|
71
76
|
google()
|
|
72
|
-
|
|
77
|
+
maven { url 'https://www.jitpack.io' }
|
|
78
|
+
mavenCentral()
|
|
73
79
|
}
|
|
74
80
|
|
|
75
81
|
dependencies {
|
|
76
|
-
|
|
82
|
+
implementation fileTree(dir: "libs", include: ["*.jar"])
|
|
77
83
|
//noinspection GradleDynamicVersion
|
|
78
84
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
79
85
|
}
|
|
@@ -85,7 +91,7 @@ def configureReactNativePom(def pom) {
|
|
|
85
91
|
name packageJson.title
|
|
86
92
|
artifactId packageJson.name
|
|
87
93
|
version = packageJson.version
|
|
88
|
-
group = "com.
|
|
94
|
+
group = "com.scrumble.honeywellscannerinterface"
|
|
89
95
|
description packageJson.description
|
|
90
96
|
url packageJson.repository
|
|
91
97
|
|
|
@@ -111,7 +117,8 @@ afterEvaluate { project ->
|
|
|
111
117
|
task androidJavadoc(type: Javadoc) {
|
|
112
118
|
source = android.sourceSets.main.java.srcDirs
|
|
113
119
|
classpath += files(android.bootClasspath)
|
|
114
|
-
|
|
120
|
+
project.getConfigurations().getByName('implementation').setCanBeResolved(true)
|
|
121
|
+
classpath += files(project.getConfigurations().getByName('implementation').asList())
|
|
115
122
|
include '**/*.java'
|
|
116
123
|
}
|
|
117
124
|
|
|
@@ -128,8 +135,6 @@ afterEvaluate { project ->
|
|
|
128
135
|
|
|
129
136
|
android.libraryVariants.all { variant ->
|
|
130
137
|
def name = variant.name.capitalize()
|
|
131
|
-
def javaCompileTask = variant.javaCompileProvider.get()
|
|
132
|
-
|
|
133
138
|
task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {
|
|
134
139
|
from javaCompileTask.destinationDir
|
|
135
140
|
}
|
|
@@ -140,12 +145,11 @@ afterEvaluate { project ->
|
|
|
140
145
|
archives androidJavadocJar
|
|
141
146
|
}
|
|
142
147
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
configureReactNativePom pom
|
|
148
|
+
publishing {
|
|
149
|
+
publications {
|
|
150
|
+
maven(MavenPublication) {
|
|
151
|
+
artifact androidSourcesJar
|
|
152
|
+
}
|
|
149
153
|
}
|
|
150
154
|
}
|
|
151
155
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#Wed Jan 15 14:51:07 MSK 2020
|
|
2
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
|
2
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
|
3
3
|
distributionBase=GRADLE_USER_HOME
|
|
4
4
|
distributionPath=wrapper/dists
|
|
5
5
|
zipStorePath=wrapper/dists
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.scrumble.honeywellscannerinterface;
|
|
2
2
|
|
|
3
3
|
import android.os.Build;
|
|
4
4
|
import android.util.Log;
|
|
5
|
-
import android.os.Bundle;
|
|
6
|
-
import android.app.AlertDialog;
|
|
7
|
-
import android.content.DialogInterface;
|
|
8
|
-
import android.widget.Toast;
|
|
9
5
|
|
|
10
6
|
import com.facebook.react.bridge.*;
|
|
11
7
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
12
8
|
import com.honeywell.aidc.*;
|
|
13
9
|
import com.honeywell.aidc.AidcManager.CreatedCallback;
|
|
14
|
-
import com.honeywell.aidc.AidcManager.*;
|
|
15
10
|
|
|
16
11
|
import javax.annotation.Nullable;
|
|
17
12
|
|
|
@@ -19,12 +14,12 @@ import java.util.HashMap;
|
|
|
19
14
|
import java.util.Map;
|
|
20
15
|
import java.util.List;
|
|
21
16
|
|
|
22
|
-
import static com.
|
|
17
|
+
import static com.scrumble.honeywellscannerinterface.HoneywellScannerPackage.HoneyWellTAG;
|
|
23
18
|
|
|
24
19
|
public class HoneywellScannerModule extends ReactContextBaseJavaModule implements BarcodeReader.BarcodeListener {
|
|
25
20
|
|
|
26
21
|
// Debugging
|
|
27
|
-
private static final boolean D =
|
|
22
|
+
private static final boolean D = false;
|
|
28
23
|
|
|
29
24
|
private final ReactApplicationContext reactContext;
|
|
30
25
|
private AidcManager manager;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Listen for available events
|
|
3
|
+
* @param {String} eventName Name of event one of barcodeReadSuccess, barcodeReadFail
|
|
4
|
+
* @param {Function} handler Event handler
|
|
5
|
+
*/
|
|
6
|
+
interface Scanner {
|
|
7
|
+
registerListener: (event: (event: {
|
|
8
|
+
data: string;
|
|
9
|
+
}) => void) => void;
|
|
10
|
+
clearEventListeners: () => void;
|
|
11
|
+
onBarcodeReadFail?: (event: (event: {
|
|
12
|
+
data: string;
|
|
13
|
+
}) => void) => void;
|
|
14
|
+
}
|
|
15
|
+
declare class Honeywell implements Scanner {
|
|
16
|
+
subscriptionBarcodeReadSuccess: any;
|
|
17
|
+
subscriptionBarcodeReadFail: any;
|
|
18
|
+
constructor();
|
|
19
|
+
registerListener: (event: (event: {
|
|
20
|
+
data: string;
|
|
21
|
+
}) => void) => void;
|
|
22
|
+
clearEventListeners: () => void;
|
|
23
|
+
onBarcodeReadFail: (event: (event: {
|
|
24
|
+
data: string;
|
|
25
|
+
}) => void) => void;
|
|
26
|
+
}
|
|
27
|
+
declare const _default: Honeywell;
|
|
28
|
+
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -3,20 +3,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const react_native_1 = require("react-native");
|
|
4
4
|
const { HoneywellScanner } = react_native_1.NativeModules;
|
|
5
5
|
const barcodeReaderEmitter = new react_native_1.NativeEventEmitter(HoneywellScanner);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
6
|
+
class Honeywell {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.registerListener = (event) => {
|
|
9
|
+
console.log('register event 1: ', event);
|
|
10
|
+
HoneywellScanner.startReader().then(() => {
|
|
11
|
+
var _a;
|
|
12
|
+
console.log('register event 2: ', event);
|
|
13
|
+
(_a = this.subscriptionBarcodeReadSuccess) === null || _a === void 0 ? void 0 : _a.remove();
|
|
14
|
+
this.subscriptionBarcodeReadSuccess = null;
|
|
15
|
+
this.subscriptionBarcodeReadSuccess = barcodeReaderEmitter.addListener(HoneywellScanner.BARCODE_READ_SUCCESS, event);
|
|
16
|
+
console.log('success', this.subscriptionBarcodeReadSuccess);
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
this.clearEventListeners = () => {
|
|
20
|
+
console.log('clear 1');
|
|
21
|
+
HoneywellScanner.stopReader().then(() => {
|
|
22
|
+
var _a;
|
|
23
|
+
console.log('clear 2');
|
|
24
|
+
(_a = this.subscriptionBarcodeReadSuccess) === null || _a === void 0 ? void 0 : _a.remove();
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
this.onBarcodeReadFail = (event) => {
|
|
28
|
+
var _a;
|
|
29
|
+
(_a = this.subscriptionBarcodeReadFail) === null || _a === void 0 ? void 0 : _a.remove();
|
|
30
|
+
this.subscriptionBarcodeReadFail = null;
|
|
31
|
+
this.subscriptionBarcodeReadFail = barcodeReaderEmitter.addListener(HoneywellScanner.BARCODE_READ_FAIL, event);
|
|
32
|
+
};
|
|
33
|
+
this.subscriptionBarcodeReadSuccess = null;
|
|
34
|
+
this.subscriptionBarcodeReadFail = null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = new Honeywell();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrumble-nl/react-native-honeywell-scanner",
|
|
3
3
|
"title": "React Native Honeywell Scanner",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"description": "Bridge to use the Honeywell scanner",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -25,8 +25,12 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"licenseFilename": "LICENSE",
|
|
27
27
|
"readmeFilename": "README.md",
|
|
28
|
-
"
|
|
29
|
-
"react": "
|
|
30
|
-
"react-native": "
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"react": "18.*",
|
|
30
|
+
"react-native": "0.*"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"react": "^18.*",
|
|
34
|
+
"react-native": "0.*"
|
|
31
35
|
}
|
|
32
36
|
}
|