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

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,9 +18,10 @@ 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();
24
25
  if (intent != null) {
25
26
  // Toast.makeText(context, intent.getAction(), 2000).show();
26
27
  // Bundle bundle = new Bundle();
@@ -30,22 +31,22 @@ public class ScannerReceiver extends BroadcastReceiver {
30
31
  // Toast.makeText(context, intent.getStringExtra("EXTRA_BARCODE_DECODING_DATA"), 2000).show();
31
32
  // rnApp.getReactNativeHost().getReactInstanceManager()
32
33
  // .getCurrentReactContext()
33
- getReactApplicationContext()
34
+ reactContext
34
35
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
35
36
  .emit("barcode", intent.getStringExtra("EXTRA_BARCODE_DECODING_DATA"));
36
37
  }
37
38
  if (intent.getAction().equals("android.intent.ACTION_DECODE_DATA")) {
38
- getReactApplicationContext()
39
+ reactContext
39
40
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
40
41
  .emit("barcode", intent.getStringExtra("barcode_string"));
41
42
  }
42
43
  if (intent.getAction().equals("scan.rcv.message")) {
43
- getReactApplicationContext()
44
+ reactContext
44
45
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
45
46
  .emit("barcode", intent.getStringExtra("barcodeData"));
46
47
  }
47
48
  if (intent.getAction().equals("barcode")) {
48
- getReactApplicationContext()
49
+ reactContext
49
50
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
50
51
  .emit("barcode", intent.getStringExtra("barcode"));
51
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-roxit-code-scanner",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "Broadcast code scanner receiver",
5
5
  "main": "index.js",
6
6
  "scripts": {