community-cordova-plugin-nfc 1.7.0 → 1.7.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "community-cordova-plugin-nfc",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Community Cordova NFC Plugin - Read and write NDEF messages, advanced tag analysis, raw memory access",
5
5
  "main": "./types/index.d.ts",
6
6
  "types": "./types/index.d.ts",
package/plugin.xml CHANGED
@@ -7,7 +7,7 @@
7
7
  xmlns="http://apache.org/cordova/ns/plugins/1.0"
8
8
  xmlns:android="http://schemas.android.com/apk/res/android"
9
9
  id="community-cordova-plugin-nfc"
10
- version="1.7.0">
10
+ version="1.7.1">
11
11
 
12
12
  <name>NFC</name>
13
13
  <description>Community Cordova NFC Plugin - Read and write NDEF messages, advanced tag analysis, raw memory access</description>
@@ -435,6 +435,13 @@ public class NfcPlugin extends CordovaPlugin {
435
435
  callbackContext.error(e.getMessage());
436
436
  } catch (IOException e) {
437
437
  callbackContext.error(e.getMessage());
438
+ } catch (Exception e) {
439
+ // Catch-all: this runs on a thread-pool runnable, so ANY uncaught exception
440
+ // crashes the app. Covers stale-tag SecurityException variants that don't contain
441
+ // "out of date", IllegalStateException, NPE, etc. — surface as a JS error instead.
442
+ Log.e(TAG, "Unexpected error writing NDEF message", e);
443
+ String msg = e.getMessage();
444
+ callbackContext.error(msg != null ? msg : "Failed to write tag. Please tap the tag again.");
438
445
  }
439
446
  });
440
447
  }
@@ -610,6 +617,10 @@ public class NfcPlugin extends CordovaPlugin {
610
617
  } catch (Exception fallbackEx) {
611
618
  Log.e(TAG, "Fallback enableForegroundDispatch also failed: " + fallbackEx.getMessage());
612
619
  }
620
+ } catch (Exception e) {
621
+ // Catch-all: runs on the UI thread runnable, so any uncaught exception (e.g.
622
+ // SecurityException, NPE from a null PendingIntent/adapter) would crash the app.
623
+ Log.e(TAG, "Unexpected error starting NFC foreground dispatch: " + e.getMessage());
613
624
  }
614
625
  }
615
626
  });