mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-18 11:08:08 -04:00
feat(gui, tauri, ci): Auto updater (#105)
This commit is contained in:
parent
90584a211d
commit
6c433041b7
10 changed files with 925 additions and 75 deletions
|
@ -18,6 +18,7 @@ import App from "./components/App";
|
|||
import { initEventListeners } from "./rpc";
|
||||
import { persistor, store } from "./store/storeRenderer";
|
||||
import { Box } from "@material-ui/core";
|
||||
import { checkForAppUpdates } from "./updater";
|
||||
|
||||
const container = document.getElementById("root");
|
||||
const root = createRoot(container!);
|
||||
|
@ -67,3 +68,4 @@ async function fetchInitialData() {
|
|||
|
||||
fetchInitialData();
|
||||
initEventListeners();
|
||||
checkForAppUpdates();
|
||||
|
|
27
src-gui/src/renderer/updater.ts
Normal file
27
src-gui/src/renderer/updater.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import { check } from "@tauri-apps/plugin-updater";
|
||||
import { ask, message } from "@tauri-apps/plugin-dialog";
|
||||
import { relaunch } from "@tauri-apps/plugin-process";
|
||||
|
||||
export async function checkForAppUpdates() {
|
||||
const update = await check();
|
||||
|
||||
if (update?.available) {
|
||||
const yes = await ask(
|
||||
`
|
||||
Update to ${update.version} is available!
|
||||
Release notes: ${update.body}
|
||||
`,
|
||||
{
|
||||
title: "Update Now!",
|
||||
kind: "info",
|
||||
okLabel: "Update",
|
||||
cancelLabel: "Cancel",
|
||||
}
|
||||
);
|
||||
|
||||
if (yes) {
|
||||
await update.downloadAndInstall();
|
||||
await relaunch();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue