mirror of
https://github.com/infinilabs/coco-app.git
synced 2026-08-29 10:09:30 +02:00
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:
@@ -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 />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user