mirror of
https://github.com/priyanshujain/margin.git
synced 2026-10-02 19:17:03 +00:00
feat(updater): show in-app progress during app update
Replace native update dialogs with an in-app modal that shows a live download progress bar and installing state, so updates no longer feel abrupt. Drives the plugin's downloadAndInstall progress events through a zustand store.
This commit is contained in:
1 parent
7ea33b5bfb
commit
866a971729
5 files changed
+254
-16
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import { create } from "zustand";
|
||||
import type { Update } from "@tauri-apps/plugin-updater";
|
||||
|
||||
export type UpdatePhase =
|
||||
| "idle"
|
||||
| "checking"
|
||||
| "available"
|
||||
| "downloading"
|
||||
| "installing"
|
||||
| "uptodate"
|
||||
| "error";
|
||||
|
||||
interface UpdaterState {
|
||||
phase: UpdatePhase;
|
||||
version: string;
|
||||
notes: string;
|
||||
downloaded: number;
|
||||
total: number;
|
||||
error: string;
|
||||
update: Update | null;
|
||||
set: (partial: Partial<UpdaterState>) => void;
|
||||
reset: () => void;
|
||||
}
|
||||
|
||||
const initial = {
|
||||
phase: "idle" as UpdatePhase,
|
||||
version: "",
|
||||
notes: "",
|
||||
downloaded: 0,
|
||||
total: 0,
|
||||
error: "",
|
||||
update: null as Update | null,
|
||||
};
|
||||
|
||||
export const useUpdater = create<UpdaterState>((set) => ({
|
||||
...initial,
|
||||
set: (partial) => set(partial),
|
||||
reset: () => set(initial),
|
||||
}));
|
||||
Reference in new issue
Block a user