feat(app): update settings in general settings

This commit is contained in:
adamelmore
2026-01-27 08:30:23 -06:00
parent 173faca3c6
commit 2f5a238b51
4 changed files with 148 additions and 20 deletions

View File

@@ -332,6 +332,7 @@ export default function Layout(props: ParentProps) {
if (!platform.checkUpdate || !platform.update || !platform.restart) return
let toastId: number | undefined
let interval: ReturnType<typeof setInterval> | undefined
async function pollUpdate() {
const { updateAvailable, version } = await platform.checkUpdate!()
@@ -358,9 +359,25 @@ export default function Layout(props: ParentProps) {
}
}
pollUpdate()
const interval = setInterval(pollUpdate, 10 * 60 * 1000)
onCleanup(() => clearInterval(interval))
createEffect(() => {
if (!settings.ready()) return
if (!settings.updates.startup()) {
if (interval === undefined) return
clearInterval(interval)
interval = undefined
return
}
if (interval !== undefined) return
void pollUpdate()
interval = setInterval(pollUpdate, 10 * 60 * 1000)
})
onCleanup(() => {
if (interval === undefined) return
clearInterval(interval)
})
})
onMount(() => {