@icedevml/react-native-host-card-emulation 0.8.0 → 0.8.2

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.
@@ -37,6 +37,7 @@ public class HCEService extends HostApduService implements HCEServiceCallback {
37
37
  private static final String TAG = "HCEService";
38
38
 
39
39
  private boolean isForeground;
40
+ private volatile boolean isDeactivated;
40
41
  private String backgroundSessionUUID;
41
42
  private RTNHCEAndroidModule hceModule;
42
43
  private byte[] pendingCAPDU;
@@ -118,6 +119,7 @@ public class HCEService extends HostApduService implements HCEServiceCallback {
118
119
  HeadlessJsTaskContext headlessJsTaskContext = Companion.getInstance(reactContext);
119
120
  headlessJsTaskContext.finishTask(taskId);
120
121
  taskSessionIdMap.remove(handle);
122
+ stopSelf();
121
123
  }
122
124
 
123
125
  @Override
@@ -144,6 +146,11 @@ public class HCEService extends HostApduService implements HCEServiceCallback {
144
146
  @Override
145
147
  public byte[] processCommandApdu(byte[] command, Bundle extras) {
146
148
  Log.d(TAG, "HCEService:processCommandApdu");
149
+
150
+ if (isDeactivated) {
151
+ onCreate();
152
+ }
153
+
147
154
  String capdu = BinaryUtils.ByteArrayToHexString(command).toUpperCase(Locale.ROOT);
148
155
 
149
156
  if (isForeground) {
@@ -181,6 +188,7 @@ public class HCEService extends HostApduService implements HCEServiceCallback {
181
188
  }
182
189
 
183
190
  isForeground = isAppOnForeground(getApplicationContext());
191
+ isDeactivated = false;
184
192
  pendingCAPDU = null;
185
193
  hceModule = null;
186
194
  needsResponse = false;
@@ -242,6 +250,7 @@ public class HCEService extends HostApduService implements HCEServiceCallback {
242
250
  public void onDeactivated(int reason) {
243
251
  Log.d(TAG, "HCEService:onDeactivated: " + reason);
244
252
  needsResponse = false;
253
+ isDeactivated = true;
245
254
 
246
255
  if (isForeground) {
247
256
  if (this.hceModule != null && this.hceModule.isHCEActiveConnection()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icedevml/react-native-host-card-emulation",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "Host Card Emulation (HCE) React Native Turbo Module for iOS and Android platforms.",
5
5
  "react-native": "js/index",
6
6
  "source": "js/index",