Skip to content

Commit

Permalink
wip: fix flow
Browse files Browse the repository at this point in the history
  • Loading branch information
shanimal08 committed Dec 5, 2024
1 parent 08e7f1d commit 32cd3f5
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 41 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tari-universe",
"private": true,
"version": "0.8.4",
"version": "0.8.0",
"type": "module",
"scripts": {
"dev": "vite dev --mode development",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "Tari Universe"
edition = "2021"
name = "tari-universe"
repository = "https://github.com/tari-project/universe"
version = "0.8.4"
version = "0.8.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
38 changes: 20 additions & 18 deletions src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{
"identifier": "default",
"windows": ["main"],
"permissions": [
"core:path:default",
"core:event:default",
"core:window:default",
"core:app:default",
"core:resources:default",
"core:menu:default",
"core:tray:default",
"core:window:allow-close",
"core:window:allow-destroy",
"core:window:allow-minimize",
"core:window:allow-unminimize",
"shell:allow-open",
"sentry:default"
]
}
"identifier": "default",
"windows": ["main"],
"permissions": [
"core:path:default",
"core:event:default",
"core:window:default",
"core:app:default",
"core:resources:default",
"core:menu:default",
"core:tray:default",
"core:window:allow-close",
"core:window:allow-destroy",
"core:window:allow-minimize",
"core:window:allow-unminimize",
"shell:allow-open",
"sentry:default",
"process:allow-restart",
"process:default"
]
}
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.8.4",
"version": "0.8.0",
"productName": "Tari Universe (Alpha)",
"mainBinaryName": "Tari Universe (Alpha)",
"identifier": "com.tari.universe.alpha",
Expand Down
43 changes: 24 additions & 19 deletions src/hooks/app/useUpdateStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useUIStore } from '@app/store/useUIStore';

export const useHandleUpdate = () => {
const setIsAfterAutoUpdate = useAppStateStore((s) => s.setIsAfterAutoUpdate);
const setError = useAppStateStore((s) => s.setError);
const auto_update = useAppConfigStore((s) => s.auto_update);
const [updateData, setUpdateData] = useState<Update>();
const [isLoading, setIsLoading] = useState(false);
Expand All @@ -25,25 +26,29 @@ export const useHandleUpdate = () => {
setIsLoading(true);
console.info('Installing latest version of Tari Universe');

await updateData.download(async (event) => {
switch (event.event) {
case 'Started':
setContentLength(event.data.contentLength || 0);
break;
case 'Progress':
setDownloaded((c) => c + event.data.chunkLength);
break;
case 'Finished':
console.info('download finished');
setIsLoading(false);
updateData.install().then(async () => {
handleClose();
await relaunch();
});
break;
}
});
}, [handleClose, updateData]);
updateData
.downloadAndInstall(async (event) => {
switch (event.event) {
case 'Started':
setContentLength(event.data.contentLength || 0);
break;
case 'Progress':
setDownloaded((c) => c + event.data.chunkLength);
break;
case 'Finished':
console.info('download finished');
break;
}
})
.then(async () => {
handleClose();
await relaunch();
})
.catch((e) => {
console.error(e);
setError(e);
});
}, [handleClose, setError, updateData]);

const fetchUpdate = useCallback(async () => {
const update = await check();
Expand Down

0 comments on commit 32cd3f5

Please sign in to comment.