feat: move disclaimer from wallet.html into vue component (#3536)
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
|
||||
window.app.component('lnbits-disclaimer', {
|
||||
template: '#lnbits-disclaimer',
|
||||
mixins: [window.windowMixin],
|
||||
computed: {
|
||||
showDisclaimer() {
|
||||
return !g.disclaimerShown && g.isUserAuthorized
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -1,6 +1,12 @@
|
||||
window.app.component('lnbits-theme', {
|
||||
mixins: [window.windowMixin],
|
||||
watch: {
|
||||
'g.disclaimerShown'(val) {
|
||||
this.$q.localStorage.setItem('lnbits.disclaimerShown', val)
|
||||
},
|
||||
'g.isFiatPriority'(val) {
|
||||
this.$q.localStorage.setItem('lnbits.isFiatPriority', val)
|
||||
},
|
||||
'g.reactionChoice'(val) {
|
||||
this.$q.localStorage.set('lnbits.reactions', val)
|
||||
},
|
||||
|
||||
@@ -25,9 +25,11 @@ window.g = Vue.reactive({
|
||||
newWalletType: 'lightning',
|
||||
updatePayments: false,
|
||||
updatePaymentsHash: '',
|
||||
locale: localStore('lnbits.lang', navigator.languages[1] ?? 'en'),
|
||||
disclaimerShown: localStore('lnbits.disclaimerShown', false),
|
||||
isFiatPriority: localStore('lnbits.isFiatPriority', false),
|
||||
mobileSimple: localStore('lnbits.mobileSimple', true),
|
||||
walletFlip: localStore('lnbits.walletFlip', false),
|
||||
locale: localStore('lnbits.lang', navigator.languages[1] ?? 'en'),
|
||||
darkChoice: localStore('lnbits.darkMode', true),
|
||||
themeChoice: localStore('lnbits.theme', WINDOW_SETTINGS.LNBITS_DEFAULT_THEME),
|
||||
borderChoice: localStore(
|
||||
@@ -66,3 +68,9 @@ addEventListener('online', event => {
|
||||
console.log('back online', event)
|
||||
this.g.offline = false
|
||||
})
|
||||
|
||||
if (navigator.serviceWorker != null) {
|
||||
navigator.serviceWorker.register('/service-worker.js').then(registration => {
|
||||
console.log('Registered events at scope: ', registration.scope)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -45,10 +45,6 @@ window.WalletPageLogic = {
|
||||
payment_hash: null
|
||||
}
|
||||
},
|
||||
disclaimerDialog: {
|
||||
show: false,
|
||||
location: window.location
|
||||
},
|
||||
icon: {
|
||||
show: false,
|
||||
data: {},
|
||||
@@ -111,7 +107,6 @@ window.WalletPageLogic = {
|
||||
},
|
||||
hasNfc: false,
|
||||
nfcReaderAbortController: null,
|
||||
isFiatPriority: false,
|
||||
formattedFiatAmount: 0,
|
||||
formattedExchange: null,
|
||||
paymentFilter: {
|
||||
@@ -201,7 +196,7 @@ window.WalletPageLogic = {
|
||||
this.receive.data.memo = null
|
||||
this.receive.data.internalMemo = null
|
||||
this.receive.data.payment_hash = null
|
||||
this.receive.unit = this.isFiatPriority
|
||||
this.receive.unit = this.g.isFiatPriority
|
||||
? this.g.wallet.currency || 'sat'
|
||||
: 'sat'
|
||||
this.receive.minMax = [0, 2100000000000000]
|
||||
@@ -777,17 +772,15 @@ window.WalletPageLogic = {
|
||||
})
|
||||
},
|
||||
swapBalancePriority() {
|
||||
this.isFiatPriority = !this.isFiatPriority
|
||||
this.receive.unit = this.isFiatPriority
|
||||
this.g.isFiatPriority = !this.g.isFiatPriority
|
||||
this.receive.unit = this.g.isFiatPriority
|
||||
? this.g.wallet.currency || 'sat'
|
||||
: 'sat'
|
||||
this.$q.localStorage.setItem('lnbits.isFiatPriority', this.isFiatPriority)
|
||||
},
|
||||
handleFiatTracking() {
|
||||
this.g.fiatTracking = !this.g.fiatTracking
|
||||
if (!this.g.fiatTracking) {
|
||||
this.$q.localStorage.setItem('lnbits.isFiatPriority', false)
|
||||
this.isFiatPriority = false
|
||||
this.g.isFiatPriority = false
|
||||
this.update.currency = ''
|
||||
this.g.wallet.currency = ''
|
||||
this.updateWallet({currency: ''})
|
||||
@@ -892,24 +885,5 @@ window.WalletPageLogic = {
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
if (!Quasar.LocalStorage.getItem('lnbits.disclaimerShown')) {
|
||||
this.disclaimerDialog.show = true
|
||||
Quasar.LocalStorage.setItem('lnbits.disclaimerShown', true)
|
||||
Quasar.LocalStorage.setItem('lnbits.reactions', 'confettiTop')
|
||||
}
|
||||
if (Quasar.LocalStorage.getItem('lnbits.isFiatPriority')) {
|
||||
this.isFiatPriority = Quasar.LocalStorage.getItem('lnbits.isFiatPriority')
|
||||
} else {
|
||||
this.isFiatPriority = false
|
||||
Quasar.LocalStorage.setItem('lnbits.isFiatPriority', false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (navigator.serviceWorker != null) {
|
||||
navigator.serviceWorker.register('/service-worker.js').then(registration => {
|
||||
console.log('Registered events at scope: ', registration.scope)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"js/components/lnbits-home-logos.js",
|
||||
"js/components/lnbits-qrcode.js",
|
||||
"js/components/lnbits-qrcode-lnurl.js",
|
||||
"js/components/lnbits-disclaimer.js",
|
||||
"js/components/lnbits-footer.js",
|
||||
"js/components/lnbits-header.js",
|
||||
"js/components/lnbits-header-wallets.js",
|
||||
|
||||
Reference in New Issue
Block a user