react-native-roxit-code-scanner 1.0.16 → 1.0.17

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.
@@ -18,35 +18,38 @@ import com.facebook.react.ReactApplication;
18
18
  import javax.annotation.Nullable;
19
19
 
20
20
  public class ScannerReceiver extends BroadcastReceiver {
21
- // ReactContext reactContext;
21
+ ReactContext reactContext;
22
22
  @Override
23
23
  public void onReceive(final Context context, final Intent intent) {
24
- ReactContext reactContext = getReactApplicationContext();
25
24
  if (intent != null) {
26
25
  // Toast.makeText(context, intent.getAction(), 2000).show();
27
26
  // Bundle bundle = new Bundle();
28
- ReactApplication rnApp = (ReactApplication) context.getApplicationContext();
27
+ ReactApplication rnApp = (ReactApplication) context.getApplicationContext();
29
28
  if (intent.getAction().equals("com.xcheng.scanner.action.BARCODE_DECODING_BROADCAST")) {
30
29
  // bundle.putString("barcode", intent.getStringExtra(Intent.EXTRA_TEXT));
31
30
  // Toast.makeText(context, intent.getStringExtra("EXTRA_BARCODE_DECODING_DATA"), 2000).show();
32
31
  // rnApp.getReactNativeHost().getReactInstanceManager()
33
32
  // .getCurrentReactContext()
34
- reactContext
33
+ rnApp.getReactNativeHost().getReactInstanceManager()
34
+ .getCurrentReactContext()
35
35
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
36
36
  .emit("barcode", intent.getStringExtra("EXTRA_BARCODE_DECODING_DATA"));
37
37
  }
38
38
  if (intent.getAction().equals("android.intent.ACTION_DECODE_DATA")) {
39
- reactContext
39
+ rnApp.getReactNativeHost().getReactInstanceManager()
40
+ .getCurrentReactContext()
40
41
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
41
42
  .emit("barcode", intent.getStringExtra("barcode_string"));
42
43
  }
43
44
  if (intent.getAction().equals("scan.rcv.message")) {
44
- reactContext
45
+ rnApp.getReactNativeHost().getReactInstanceManager()
46
+ .getCurrentReactContext()
45
47
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
46
48
  .emit("barcode", intent.getStringExtra("barcodeData"));
47
49
  }
48
50
  if (intent.getAction().equals("barcode")) {
49
- reactContext
51
+ rnApp.getReactNativeHost().getReactInstanceManager()
52
+ .getCurrentReactContext()
50
53
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
51
54
  .emit("barcode", intent.getStringExtra("barcode"));
52
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-roxit-code-scanner",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "Broadcast code scanner receiver",
5
5
  "main": "index.js",
6
6
  "scripts": {