-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(selfupdate): deported updater to an extern library
it also now give the choice to the user if update should be applied or not
- Loading branch information
Showing
10 changed files
with
103 additions
and
217 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,62 @@ | ||
<script lang="ts" setup> | ||
import { onMounted, ref } from 'vue'; | ||
import Message from 'primevue/message'; | ||
import Button from 'primevue/button'; | ||
import {GetCurrentVersion} from '../../wailsjs/go/version/VersionManager' | ||
import {CheckLatest, Update} from '../../wailsjs/go/selfupdater/Updater'; | ||
import { BrowserOpenURL} from '../../wailsjs/runtime/runtime'; | ||
const version = ref<string|null>(null) | ||
const displayUpdateInfo = ref(false) | ||
const successfulUpdate = ref<boolean | null>(null) | ||
function performUpdate() { | ||
Update().then( _ => { | ||
successfulUpdate.value= true | ||
}).catch(err => { | ||
successfulUpdate.value = false | ||
}) | ||
} | ||
function openURL(e: Event) { | ||
e.preventDefault(); | ||
BrowserOpenURL(e.target) | ||
} | ||
onMounted(() => { | ||
CheckLatest().then(isLatest => { | ||
displayUpdateInfo.value = !isLatest | ||
}) | ||
GetCurrentVersion().then(v => { | ||
version.value=v | ||
}) | ||
}) | ||
</script> | ||
<template> | ||
<div class="flex flex-column m-8"> | ||
<router-link to="/game" class="m-2"><Button label="Start Game" rounded severity="success" @click="$emit('startGame')" /></router-link> | ||
<router-link to="/scores" class="m-2"><Button label="See Scores" rounded severity="info" @click="$emit('startGame')" /></router-link> | ||
</div> | ||
<div class="flex flex-column align-items-center"> | ||
<div class="flex flex-column m-8"> | ||
<router-link to="/game" class="m-2"><Button label="Start Game" rounded severity="success" @click="$emit('startGame')" /></router-link> | ||
<router-link to="/scores" class="m-2"><Button label="See Scores" rounded severity="info" @click="$emit('startGame')" /></router-link> | ||
</div> | ||
|
||
<div> | ||
v{{ version }} | ||
<div> | ||
v{{ version }} | ||
</div> | ||
<div class="fixed bottom-0" v-if="displayUpdateInfo"> | ||
<Message severity="warn"> | ||
<div class=" p-1 flex flex-column justify-content-start align-content-start align-items-start"> | ||
<span>An update is available.</span> | ||
<span>You can either let this app download it (experimental) by clicking the 'selfupdate' button</span> | ||
<span>or you can download it yourself <a @click="openURL($event)" href="https://github.com/mJehanno/op-game/releases">here</a>.</span> | ||
<span>Quick reminder that on windows, your antivirus might block the download.</span> | ||
</div> | ||
<div class="m-1"> | ||
<Button label="Self-Update" @click="performUpdate"/> | ||
</div> | ||
</Message> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL | ||
// This file is automatically generated. DO NOT EDIT | ||
|
||
export function CheckAndUpdate():Promise<void>; | ||
|
||
export function CheckLatest():Promise<boolean>; | ||
|
||
export function Update():Promise<void>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// @ts-check | ||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL | ||
// This file is automatically generated. DO NOT EDIT | ||
|
||
export function CheckAndUpdate() { | ||
return window['go']['selfupdater']['Updater']['CheckAndUpdate'](); | ||
} | ||
|
||
export function CheckLatest() { | ||
return window['go']['selfupdater']['Updater']['CheckLatest'](); | ||
} | ||
|
||
export function Update() { | ||
return window['go']['selfupdater']['Updater']['Update'](); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.