forked from akanyan/STARTLINER
feat: autoupdate ui
This commit is contained in:
@ -40,10 +40,30 @@ const pkgSearchTerm = ref('');
|
||||
|
||||
const isProfileDisabled = computed(() => prf.current === null);
|
||||
|
||||
const updateVisible = ref(false);
|
||||
const updateProgress = ref(-1);
|
||||
|
||||
const hasUpdatedCheck = async () => {
|
||||
const res = await invoke('has_updated');
|
||||
if (res == false) {
|
||||
updateVisible.value = true;
|
||||
setTimeout(hasUpdatedCheck, 200);
|
||||
} else {
|
||||
updateVisible.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
listen<number>('update-progress', (ev) => {
|
||||
updateProgress.value = ev.payload;
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
invoke('list_directories').then((d) => {
|
||||
general.dirs = d as Dirs;
|
||||
client.load();
|
||||
if (client.enableAutoupdates) {
|
||||
hasUpdatedCheck();
|
||||
}
|
||||
});
|
||||
|
||||
const fetch_promise = pkg.fetch(true);
|
||||
@ -135,6 +155,17 @@ listen<{ message: string; header: string }>('invoke-error', (event) => {
|
||||
/>
|
||||
</div>
|
||||
</Dialog>
|
||||
<Dialog
|
||||
modal
|
||||
:visible="updateVisible"
|
||||
:closable="false"
|
||||
:header="updateProgress < 0 ? 'Checking for updates' : 'Updating'"
|
||||
:style="{ width: '50vw' }"
|
||||
>
|
||||
<div v-if="updateProgress >= 0">
|
||||
{{ (updateProgress * 100).toFixed(0) }}%
|
||||
</div>
|
||||
</Dialog>
|
||||
|
||||
<Tabs
|
||||
lazy
|
||||
|
@ -2,7 +2,6 @@
|
||||
import { Ref, ref } from 'vue';
|
||||
import * as path from '@tauri-apps/api/path';
|
||||
import OptionCategory from './OptionCategory.vue';
|
||||
import OptionRow from './OptionRow.vue';
|
||||
import PatchEntry from './PatchEntry.vue';
|
||||
import { invoke } from '../invoke';
|
||||
import { usePrfStore } from '../stores';
|
||||
|
Reference in New Issue
Block a user