refactor: use named cloud promo scheduler function

This commit is contained in:
Benjamin Lu
2026-03-25 16:38:01 -07:00
parent b6a0ff0282
commit d96a742132

View File

@@ -11,36 +11,38 @@ const dialogService = useDialogService()
let cloudNotificationTimer: ReturnType<typeof setTimeout> | undefined
onMounted(() => {
async function scheduleCloudNotification() {
if (!isDesktop || electronAPI()?.getPlatform() !== 'darwin') return
void (async () => {
try {
await settingStore.load()
} catch (error) {
console.warn('[CloudNotification] Failed to load settings', error)
return
}
if (settingStore.get('Comfy.Desktop.CloudNotificationShown')) return
cloudNotificationTimer = setTimeout(async () => {
try {
await settingStore.load()
await settingStore.set('Comfy.Desktop.CloudNotificationShown', true)
await dialogService.showCloudNotification()
} catch (error) {
console.warn('[CloudNotification] Failed to load settings', error)
return
console.warn('[CloudNotification] Failed to show', error)
await settingStore
.set('Comfy.Desktop.CloudNotificationShown', false)
.catch((resetError) => {
console.warn(
'[CloudNotification] Failed to reset shown state',
resetError
)
})
}
}, 2000)
}
if (settingStore.get('Comfy.Desktop.CloudNotificationShown')) return
cloudNotificationTimer = setTimeout(async () => {
try {
await settingStore.set('Comfy.Desktop.CloudNotificationShown', true)
await dialogService.showCloudNotification()
} catch (error) {
console.warn('[CloudNotification] Failed to show', error)
await settingStore
.set('Comfy.Desktop.CloudNotificationShown', false)
.catch((resetError) => {
console.warn(
'[CloudNotification] Failed to reset shown state',
resetError
)
})
}
}, 2000)
})()
onMounted(() => {
void scheduleCloudNotification()
})
onUnmounted(() => {