react-native-nfc-manager 4.0.0-beta.4 → 4.0.0-beta.5
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.
|
@@ -45,7 +45,7 @@ class NfcManager extends NativeNfcManagerSpec implements ActivityEventListener,
|
|
|
45
45
|
private static final String LOG_TAG = "ReactNativeNfcManager";
|
|
46
46
|
private final List<IntentFilter> intentFilters = new ArrayList<>();
|
|
47
47
|
private final ArrayList<String[]> techLists = new ArrayList<>();
|
|
48
|
-
private final
|
|
48
|
+
private final ReactApplicationContext context;
|
|
49
49
|
private Boolean isForegroundEnabled = false;
|
|
50
50
|
private Boolean isResumed = false;
|
|
51
51
|
private WriteNdefRequest writeNdefRequest = null;
|
|
@@ -1007,7 +1007,7 @@ class NfcManager extends NativeNfcManagerSpec implements ActivityEventListener,
|
|
|
1007
1007
|
Log.d(LOG_TAG, "start");
|
|
1008
1008
|
|
|
1009
1009
|
IntentFilter filter = new IntentFilter(NfcAdapter.ACTION_ADAPTER_STATE_CHANGED);
|
|
1010
|
-
Activity currentActivity = getCurrentActivity();
|
|
1010
|
+
Activity currentActivity = context.getCurrentActivity();
|
|
1011
1011
|
if (currentActivity == null) {
|
|
1012
1012
|
callback.invoke(ERR_GET_ACTIVITY_FAIL);
|
|
1013
1013
|
return;
|
|
@@ -1027,7 +1027,7 @@ class NfcManager extends NativeNfcManagerSpec implements ActivityEventListener,
|
|
|
1027
1027
|
@ReactMethod
|
|
1028
1028
|
public void isSupported(String tech, Callback callback){
|
|
1029
1029
|
Log.d(LOG_TAG, "isSupported");
|
|
1030
|
-
Activity currentActivity = getCurrentActivity();
|
|
1030
|
+
Activity currentActivity = context.getCurrentActivity();
|
|
1031
1031
|
if (currentActivity == null) {
|
|
1032
1032
|
callback.invoke(ERR_GET_ACTIVITY_FAIL);
|
|
1033
1033
|
return;
|
|
@@ -1065,7 +1065,7 @@ class NfcManager extends NativeNfcManagerSpec implements ActivityEventListener,
|
|
|
1065
1065
|
@ReactMethod
|
|
1066
1066
|
public void goToNfcSetting(Callback callback) {
|
|
1067
1067
|
Log.d(LOG_TAG, "goToNfcSetting");
|
|
1068
|
-
Activity currentActivity = getCurrentActivity();
|
|
1068
|
+
Activity currentActivity = context.getCurrentActivity();
|
|
1069
1069
|
if (currentActivity == null) {
|
|
1070
1070
|
callback.invoke(ERR_GET_ACTIVITY_FAIL);
|
|
1071
1071
|
return;
|
|
@@ -1081,7 +1081,7 @@ class NfcManager extends NativeNfcManagerSpec implements ActivityEventListener,
|
|
|
1081
1081
|
|
|
1082
1082
|
@ReactMethod
|
|
1083
1083
|
public void getLaunchTagEvent(Callback callback) {
|
|
1084
|
-
Activity currentActivity = getCurrentActivity();
|
|
1084
|
+
Activity currentActivity = context.getCurrentActivity();
|
|
1085
1085
|
if (currentActivity == null) {
|
|
1086
1086
|
callback.invoke(ERR_GET_ACTIVITY_FAIL);
|
|
1087
1087
|
return;
|
|
@@ -1297,7 +1297,7 @@ class NfcManager extends NativeNfcManagerSpec implements ActivityEventListener,
|
|
|
1297
1297
|
private void enableDisableForegroundDispatch(boolean enable) {
|
|
1298
1298
|
Log.i(LOG_TAG, "enableForegroundDispatch, enable = " + enable);
|
|
1299
1299
|
NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(context);
|
|
1300
|
-
Activity currentActivity = getCurrentActivity();
|
|
1300
|
+
Activity currentActivity = context.getCurrentActivity();
|
|
1301
1301
|
final NfcManager manager = this;
|
|
1302
1302
|
if (nfcAdapter != null && currentActivity != null && !currentActivity.isFinishing()) {
|
|
1303
1303
|
try {
|
|
@@ -1354,7 +1354,7 @@ class NfcManager extends NativeNfcManagerSpec implements ActivityEventListener,
|
|
|
1354
1354
|
}
|
|
1355
1355
|
|
|
1356
1356
|
private PendingIntent getPendingIntent() {
|
|
1357
|
-
Activity activity = getCurrentActivity();
|
|
1357
|
+
Activity activity = context.getCurrentActivity();
|
|
1358
1358
|
assert activity != null;
|
|
1359
1359
|
Intent intent = new Intent(activity, activity.getClass());
|
|
1360
1360
|
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|