Skip to content

Commit e436e42

Browse files
committed
fix: address preview deeplink review feedback
1 parent 77e6e48 commit e436e42

1 file changed

Lines changed: 26 additions & 26 deletions

File tree

src/pages/scan.vue

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,32 @@ const downloadHost = computed(() => {
7777
return new URL(scannedUrl.value).host
7878
})
7979
80+
async function getPreviousChannel() {
81+
try {
82+
const result = await CapacitorUpdater.getChannel()
83+
return { channel: result.channel }
84+
}
85+
catch (error) {
86+
console.warn('Could not read current update channel before preview:', error)
87+
return null
88+
}
89+
}
90+
91+
async function restorePreviousChannel(previousChannel: Awaited<ReturnType<typeof getPreviousChannel>>) {
92+
if (!previousChannel)
93+
return
94+
95+
try {
96+
if (previousChannel.channel)
97+
await CapacitorUpdater.setChannel({ channel: previousChannel.channel, triggerAutoUpdate: false })
98+
else
99+
await CapacitorUpdater.unsetChannel({ triggerAutoUpdate: false })
100+
}
101+
catch (error) {
102+
console.warn('Could not restore previous update channel after preview failure:', error)
103+
}
104+
}
105+
80106
onMounted(async () => {
81107
displayStore.NavTitle = 'Scan update'
82108
displayStore.defaultBack = '/apps'
@@ -107,32 +133,6 @@ async function removeDownloadListener() {
107133
downloadListener = null
108134
}
109135
110-
async function getPreviousChannel() {
111-
try {
112-
const result = await CapacitorUpdater.getChannel()
113-
return { channel: result.channel }
114-
}
115-
catch (error) {
116-
console.warn('Could not read current update channel before preview:', error)
117-
return null
118-
}
119-
}
120-
121-
async function restorePreviousChannel(previousChannel: Awaited<ReturnType<typeof getPreviousChannel>>) {
122-
if (!previousChannel)
123-
return
124-
125-
try {
126-
if (previousChannel.channel)
127-
await CapacitorUpdater.setChannel({ channel: previousChannel.channel, triggerAutoUpdate: false })
128-
else
129-
await CapacitorUpdater.unsetChannel({ triggerAutoUpdate: false })
130-
}
131-
catch (error) {
132-
console.warn('Could not restore previous update channel after preview failure:', error)
133-
}
134-
}
135-
136136
async function startScanner() {
137137
try {
138138
isScanning.value = true

0 commit comments

Comments
 (0)