@scrumble-nl/react-native-honeywell-scanner 1.0.66 → 1.0.67

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.
@@ -75,38 +75,29 @@ public class HoneywellScannerModule extends ReactContextBaseJavaModule implement
75
75
  sendEvent(BARCODE_READ_FAIL, params);
76
76
  }
77
77
 
78
+ public void onDeviceChange(BarcodeReaderInfo barcodeReaderInfo) {
79
+ WritableMap params = Arguments.createMap();
80
+ params.putString("data", barcodeReaderInfo.getName());
81
+ sendEvent(DEVICE_CHANGE, params);
82
+ }
83
+
78
84
  /*******************************/
79
85
  /** Methods Available from JS **/
80
86
  /*******************************/
81
87
 
82
88
  @ReactMethod
83
- public void startReader(final Promise promise) {
89
+ public void startReader() {
84
90
  AidcManager.create(reactContext, new CreatedCallback() {
85
91
  @Override
86
92
  public void onCreated(AidcManager aidcManager) {
87
93
  manager = aidcManager;
88
94
 
89
95
  if (manager != null) {
90
- promise.resolve(true);
91
-
92
- manager.addBarcodeDeviceListener(new BarcodeDeviceListener() {
93
- @Override
94
- public void onBarcodeDeviceConnectionEvent(BarcodeDeviceConnectionEvent event) {
95
- if (event.getConnectionStatus() == manager.BARCODE_DEVICE_CONNECTED) {
96
- BarcodeReaderInfo readerInfo = event.getBarcodeReaderInfo();
97
-
98
- WritableMap params = Arguments.createMap();
99
- params.putString("data", readerInfo.getName());
100
- sendEvent(DEVICE_CHANGE, params);
101
- }
96
+ manager.addBarcodeDeviceListener(BarcodeDeviceListener listener) {
97
+ listener.onBarcodeDeviceConnectionEvent(BarcodeDeviceConnectionEvent event) {
98
+ onDeviceChange(event.getBarcodeReaderInfo());
102
99
  }
103
- });
104
-
105
-
106
- // manager.addBarcodeDeviceListener(BarcodeDeviceListener listener) {
107
- // listener.onBarcodeDeviceConnectionEvent(BarcodeDeviceConnectionEvent event) {
108
- // }
109
- // }
100
+ }
110
101
  }
111
102
  }
112
103
  });
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-v2",
4
- "version": "1.0.66",
4
+ "version": "1.0.67",
5
5
  "description": "Bridge to use the Honeywell scanner",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",