feat: allow Connect from dropdown menu

This commit is contained in:
Vlad Stan 2022-07-27 15:08:39 +03:00
parent 9374433153
commit 3054248858
4 changed files with 13 additions and 8 deletions

View file

@ -84,7 +84,6 @@ async function payment(path) {
try { try {
if (!this.serialSignerRef.isConnected()) { if (!this.serialSignerRef.isConnected()) {
await this.serialSignerRef.openSerialPort() await this.serialSignerRef.openSerialPort()
return
} }
if (!this.serialSignerRef.isAuthenticated()) { if (!this.serialSignerRef.isAuthenticated()) {
await this.serialSignerRef.hwwShowPasswordDialog() await this.serialSignerRef.hwwShowPasswordDialog()

View file

@ -5,7 +5,7 @@
color="primary" color="primary"
icon="usb" icon="usb"
:text-color="selectedPort ? hww.authenticated ? 'green' : 'orange' : 'white'" :text-color="selectedPort ? hww.authenticated ? 'green' : 'orange' : 'white'"
@click="toggleSerialPortConection" @click="openSerialPort"
> >
<q-list> <q-list>
<q-item v-if="!selectedPort" clickable v-close-popup> <q-item v-if="!selectedPort" clickable v-close-popup>
@ -42,6 +42,17 @@
<q-item-label caption>Clear password for HWW.</q-item-label> <q-item-label caption>Clear password for HWW.</q-item-label>
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item
v-if="!selectedPort"
clickable
v-close-popup
@click="openSerialPort()"
>
<q-item-section>
<q-item-label>Connect</q-item-label>
<q-item-label caption>Connect Serial Port device.</q-item-label>
</q-item-section>
</q-item>
<q-item <q-item
v-if="selectedPort" v-if="selectedPort"
clickable clickable

View file

@ -36,13 +36,9 @@ async function serialSigner(path) {
}, },
methods: { methods: {
toggleSerialPortConection: async function () {
if (!this.selectedPort) {
this.openSerialPort()
}
},
openSerialPort: async function () { openSerialPort: async function () {
if (!this.checkSerialPortSupported()) return if (!this.checkSerialPortSupported()) return
if (this.selectedPort) return
console.log('### openSerialPort', this.selectedPort) console.log('### openSerialPort', this.selectedPort)
try { try {
navigator.serial.addEventListener('connect', event => { navigator.serial.addEventListener('connect', event => {

View file

@ -14,7 +14,6 @@ async function walletConfig(path) {
return satOrBtc(val, showUnit, this.config.data.sats_denominated) return satOrBtc(val, showUnit, this.config.data.sats_denominated)
}, },
updateConfig: async function () { updateConfig: async function () {
// const wallet = this.g.user.wallets[0]
try { try {
await LNbits.api.request( await LNbits.api.request(
'PUT', 'PUT',