react-native-roxit-code-scanner 1.0.15 → 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.
@@ -7,7 +7,6 @@ import android.os.Bundle;
7
7
  import android.widget.Toast;
8
8
 
9
9
  import com.facebook.react.bridge.ReactContext;
10
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
11
10
  import com.facebook.react.modules.core.DeviceEventManagerModule;
12
11
  import com.facebook.react.ReactInstanceManager;
13
12
  import com.facebook.react.ReactNativeHost;
@@ -19,9 +18,10 @@ import com.facebook.react.ReactApplication;
19
18
  import javax.annotation.Nullable;
20
19
 
21
20
  public class ScannerReceiver extends BroadcastReceiver {
22
- ReactContext reactContext;
21
+ // ReactContext reactContext;
23
22
  @Override
24
23
  public void onReceive(final Context context, final Intent intent) {
24
+ ReactContext reactContext = getReactApplicationContext();
25
25
  if (intent != null) {
26
26
  // Toast.makeText(context, intent.getAction(), 2000).show();
27
27
  // Bundle bundle = new Bundle();
@@ -31,22 +31,22 @@ public class ScannerReceiver extends BroadcastReceiver {
31
31
  // Toast.makeText(context, intent.getStringExtra("EXTRA_BARCODE_DECODING_DATA"), 2000).show();
32
32
  // rnApp.getReactNativeHost().getReactInstanceManager()
33
33
  // .getCurrentReactContext()
34
- getReactApplicationContext()
34
+ reactContext
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
- getReactApplicationContext()
39
+ reactContext
40
40
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
41
41
  .emit("barcode", intent.getStringExtra("barcode_string"));
42
42
  }
43
43
  if (intent.getAction().equals("scan.rcv.message")) {
44
- getReactApplicationContext()
44
+ reactContext
45
45
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
46
46
  .emit("barcode", intent.getStringExtra("barcodeData"));
47
47
  }
48
48
  if (intent.getAction().equals("barcode")) {
49
- getReactApplicationContext()
49
+ reactContext
50
50
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
51
51
  .emit("barcode", intent.getStringExtra("barcode"));
52
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-roxit-code-scanner",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "Broadcast code scanner receiver",
5
5
  "main": "index.js",
6
6
  "scripts": {