react-native-roxit-code-scanner 1.0.9 → 1.0.11

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.
@@ -28,30 +28,24 @@ public class ScannerReceiver extends BroadcastReceiver {
28
28
  if (intent.getAction().equals("com.xcheng.scanner.action.BARCODE_DECODING_BROADCAST")) {
29
29
  // bundle.putString("barcode", intent.getStringExtra(Intent.EXTRA_TEXT));
30
30
  // Toast.makeText(context, intent.getStringExtra("EXTRA_BARCODE_DECODING_DATA"), 2000).show();
31
- while (rnApp.getReactNativeHost().getReactInstanceManager().getCurrentReactContext() == null);
32
- rnApp.getReactNativeHost().getReactInstanceManager()
33
- .getCurrentReactContext()
31
+ // rnApp.getReactNativeHost().getReactInstanceManager()
32
+ // .getCurrentReactContext()
33
+ context
34
34
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
35
35
  .emit("barcode", intent.getStringExtra("EXTRA_BARCODE_DECODING_DATA"));
36
36
  }
37
37
  if (intent.getAction().equals("android.intent.ACTION_DECODE_DATA")) {
38
- while (rnApp.getReactNativeHost().getReactInstanceManager().getCurrentReactContext() == null);
39
- rnApp.getReactNativeHost().getReactInstanceManager()
40
- .getCurrentReactContext()
38
+ context
41
39
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
42
40
  .emit("barcode", intent.getStringExtra("barcode_string"));
43
41
  }
44
42
  if (intent.getAction().equals("scan.rcv.message")) {
45
- while (rnApp.getReactNativeHost().getReactInstanceManager().getCurrentReactContext() == null);
46
- rnApp.getReactNativeHost().getReactInstanceManager()
47
- .getCurrentReactContext()
43
+ context
48
44
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
49
45
  .emit("barcode", intent.getStringExtra("barcodeData"));
50
46
  }
51
47
  if (intent.getAction().equals("barcode")) {
52
- while (rnApp.getReactNativeHost().getReactInstanceManager().getCurrentReactContext() == null);
53
- rnApp.getReactNativeHost().getReactInstanceManager()
54
- .getCurrentReactContext()
48
+ context
55
49
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
56
50
  .emit("barcode", intent.getStringExtra("barcode"));
57
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-roxit-code-scanner",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "Broadcast code scanner receiver",
5
5
  "main": "index.js",
6
6
  "scripts": {