From 5dd6c0d2f41a17ab1432f911a6431ecec1ae342d Mon Sep 17 00:00:00 2001 From: Lee Salminen Date: Mon, 29 Aug 2022 08:39:02 -0600 Subject: [PATCH] Revert "make scan nfc button work" This reverts commit a8ac90da5c79a76b16cc07c9bbf3cd6474700f4d. --- .../extensions/boltcards/static/js/index.js | 63 ------------------- .../boltcards/templates/boltcards/index.html | 3 +- 2 files changed, 1 insertion(+), 65 deletions(-) diff --git a/lnbits/extensions/boltcards/static/js/index.js b/lnbits/extensions/boltcards/static/js/index.js index 315ed59f..e6c052ac 100644 --- a/lnbits/extensions/boltcards/static/js/index.js +++ b/lnbits/extensions/boltcards/static/js/index.js @@ -230,69 +230,6 @@ new Vue({ ? '33333333333333333333333333333333' : genRanHex(32) }, - readNfcTag: function () { - try { - const self = this - - if (typeof NDEFReader == 'undefined') { - throw { - toString: function () { - return 'NFC not supported on this device or browser.' - } - } - } - - const ndef = new NDEFReader() - - const readerAbortController = new AbortController() - readerAbortController.signal.onabort = event => { - console.log('All NFC Read operations have been aborted.') - } - - this.nfcTagReading = true - this.$q.notify({ - message: 'Tap your NFC tag to read its UID' - }) - - return ndef.scan({signal: readerAbortController.signal}).then(() => { - ndef.onreadingerror = () => { - self.nfcTagReading = false - - this.$q.notify({ - type: 'negative', - message: 'There was an error reading this NFC tag.' - }) - - readerAbortController.abort() - } - - ndef.onreading = ({message, serialNumber}) => { - self.nfcTagReading = false - - self.cardDialog.data.uid = serialNumber - .replaceAll(':', '') - .toUpperCase() - - this.$q.notify({ - type: 'positive', - message: 'NFC tag read successfully.' - }) - - setTimeout(() => { - readerAbortController.abort() - }, 1000) - } - }) - } catch (error) { - this.nfcTagReading = false - this.$q.notify({ - type: 'negative', - message: error - ? error.toString() - : 'An unexpected error has occurred.' - }) - } - }, closeFormDialog: function () { this.cardDialog.data = {} }, diff --git a/lnbits/extensions/boltcards/templates/boltcards/index.html b/lnbits/extensions/boltcards/templates/boltcards/index.html index eb29e543..0561cc01 100644 --- a/lnbits/extensions/boltcards/templates/boltcards/index.html +++ b/lnbits/extensions/boltcards/templates/boltcards/index.html @@ -278,8 +278,7 @@ color="grey" icon="nfc" :disable="nfcTagReading" - @click="readNfcTag" - >Tap card to scan UIDTap card to scan UID (coming soon)