feat: add manual check for updates (#701)

* feat: add check for update

* feat: add Check for Updates

* docs: update notes

* build: build bundle test

* docs: update notes

* chore: recovering files
This commit is contained in:
BiggerRain
2025-06-19 20:58:54 +08:00
committed by GitHub
parent a431ead22a
commit 6837286061
20 changed files with 193 additions and 71 deletions

View File

@@ -1,14 +1,11 @@
import { useCallback, useEffect } from "react";
import { useEffect } from "react";
import SearchChat from "@/components/SearchChat";
import platformAdapter from "@/utils/platformAdapter";
import { useAppStore } from "@/stores/appStore";
import { useSyncStore } from "@/hooks/useSyncStore";
import UpdateApp from "@/components/UpdateApp";
import { useAppearanceStore } from "@/stores/appearanceStore";
function MainApp() {
const addError = useAppStore((state) => state.addError);
const setIsTauri = useAppStore((state) => state.setIsTauri);
useEffect(() => {
@@ -17,28 +14,10 @@ function MainApp() {
useSyncStore();
const snapshotUpdate = useAppearanceStore((state) => state.snapshotUpdate);
const checkUpdate = useCallback(async () => {
return platformAdapter.checkUpdate();
}, []);
const relaunchApp = useCallback(async () => {
return platformAdapter.relaunchApp();
}, []);
useEffect(() => {
if (!snapshotUpdate) return;
checkUpdate().catch((error) => {
addError("Update failed:" + error, "error");
});
}, [snapshotUpdate]);
return (
<>
<SearchChat isTauri={true} hasModules={["search", "chat"]} />
<UpdateApp checkUpdate={checkUpdate} relaunchApp={relaunchApp} />
<UpdateApp />
</>
);
}