iOS NFC support

This commit is contained in:
minibits-cash
2025-12-22 14:42:40 +01:00
parent a064391ee1
commit e03e6285a4
7 changed files with 514 additions and 341 deletions
+1 -1
View File
@@ -1 +1 @@
019b406e-e983-7898-8d39-07cb52784ef8
019b4070-f889-7238-85b0-d02966f5a2f8
+488 -331
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+6
View File
@@ -41,6 +41,12 @@
<string/>
<key>NSUserNotificationUsageDescription</key>
<string>This app uses notifications to keep you updated with incoming transactions.</string>
<key>NFCReaderUsageDescription</key>
<string>This app uses NFC to pay on supported POS</string>
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>D2760000850101</string>
</array>
<key>RCTNewArchEnabled</key>
<true/>
<key>UIAppFonts</key>
@@ -4,5 +4,10 @@
<dict>
<key>aps-environment</key>
<string>production</string>
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
<string>NDEF</string>
<string>TAG</string>
</array>
</dict>
</plist>
+4 -4
View File
@@ -83,17 +83,17 @@ import { SerializedDLEQ } from '@cashu/cashu-ts'
): Proof[] {
let proofs = Array.from(self.proofs.values())
.filter(p => !p.isSpent)
proofs = proofs.filter(p => p.mintUrl === mintUrl)
// Default: only non-pending proofs. Explicit true returns only pending.
const includePending = options.isPending ?? false
proofs = proofs.filter(p => p.isPending === includePending)
const selectPending = options.isPending ?? false
proofs = proofs.filter(p => p.isPending === selectPending)
if (options.keysetIds?.length) {
proofs = proofs.filter(p => options.keysetIds!.includes(p.id))
}
proofs = proofs.filter(p => p.mintUrl === mintUrl)
if (options.unit) {
proofs = proofs.filter(p => p.unit === options.unit)
}
+5
View File
@@ -708,6 +708,7 @@ export const NfcPayScreen = observer(function NfcPayScreen({ route }: Props) {
setIsPaid(true)
expandHeader()
setNfcInfo(transaction.memo || 'Lightning payment settled.')
}
} else {
// Fallback (shouldn't happen)
@@ -722,6 +723,8 @@ export const NfcPayScreen = observer(function NfcPayScreen({ route }: Props) {
} catch (e: any) {
log.error(e.message, {error: String(e)})
handleError(e)
} finally {
await NfcManager.cancelTechnologyRequest().catch(() => {})
}
}
@@ -785,6 +788,8 @@ export const NfcPayScreen = observer(function NfcPayScreen({ route }: Props) {
} catch(e: any) {
log.error(e.message, {error: String(e)})
handleError(e)
} finally {
await NfcManager.cancelTechnologyRequest().catch(() => {})
}
}