@capgo/capacitor-nfc
Advanced tools
@@ -304,3 +304,5 @@ package app.capgo.nfc; | ||
| } | ||
| ndef.close(); | ||
| if (ndef.isConnected()) { | ||
| ndef.close(); | ||
| } | ||
| } else if (allowFormat) { | ||
@@ -307,0 +309,0 @@ NdefFormatable formatable = NdefFormatable.get(tag); |
@@ -7,3 +7,3 @@ import Capacitor | ||
| public class NfcPlugin: CAPPlugin, CAPBridgedPlugin { | ||
| private let pluginVersion: String = "8.1.5" | ||
| private let pluginVersion: String = "8.1.6" | ||
@@ -531,2 +531,8 @@ public let identifier = "NfcPlugin" | ||
| if let readError { | ||
| if !self.invalidateAfterFirstRead && status == .readWrite { | ||
| self.currentTag = tag | ||
| let event = self.buildEvent(tag: tag, status: status, capacity: capacity, message: nil) | ||
| self.notify(event: event) | ||
| return | ||
| } | ||
| session.invalidate(errorMessage: "Failed to read NDEF message: \(readError.localizedDescription)") | ||
@@ -711,3 +717,3 @@ return | ||
| // Tag supports NDEF, try to read it | ||
| tag.readNDEF { [weak self] message, _ in | ||
| tag.readNDEF { [weak self] message, readError in | ||
| guard let self else { | ||
@@ -723,4 +729,6 @@ return | ||
| self.emitTagEvent(tag: tag, status: status, capacity: capacity, message: nil, session: session) | ||
| } else if readError != nil && self.invalidateAfterFirstRead { | ||
| session.invalidate(errorMessage: "Failed to read NDEF message: \(readError!.localizedDescription)") | ||
| } else { | ||
| // Successfully read NDEF | ||
| // Successfully read NDEF (or keep session open for writes after a read error) | ||
| self.currentTag = tag | ||
@@ -727,0 +735,0 @@ let event = self.buildEvent(tag: tag, status: status, capacity: capacity, message: message) |
+1
-1
| { | ||
| "name": "@capgo/capacitor-nfc", | ||
| "version": "8.1.5", | ||
| "version": "8.1.6", | ||
| "description": "Native NFC tag discovery, reading and writing for Capacitor apps on iOS and Android.", | ||
@@ -5,0 +5,0 @@ "main": "dist/plugin.cjs.js", |
154424
0.46%1733
0.12%