diff --git a/.github/workflows/release.yml b/.github/workflows/publish.yml similarity index 100% rename from .github/workflows/release.yml rename to .github/workflows/publish.yml diff --git a/package.json b/package.json index 4aa7554..063774f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "solo", "private": true, - "version": "0.0.5", + "version": "0.0.10", "type": "module", "scripts": { "dev": "vite", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 2710ab4..8e916f5 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -4392,7 +4392,7 @@ dependencies = [ [[package]] name = "solo" -version = "0.0.5" +version = "0.0.10" dependencies = [ "base64 0.21.7", "httpmock", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 0903017..8d75eae 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "solo" -version = "0.0.5" +version = "0.0.10" description = "Solo Client HTTP" authors = ["Igor Vieira "] edition = "2021" diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index 9fdea57..bc85865 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -9,6 +9,10 @@ "core:window:allow-close", "core:window:allow-minimize", "core:window:allow-maximize", - "shell:allow-open" + "shell:allow-open", + "updater:default", + "updater:allow-check", + "updater:allow-download", + "updater:allow-install" ] } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index de75644..9b3c434 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2.0.0", "productName": "solo", - "version": "0.0.5", + "version": "0.0.10", "identifier": "com.solo.app", "build": { "beforeDevCommand": "bun run dev", @@ -43,7 +43,7 @@ "bundle": { "active": true, "targets": "all", - "createUpdaterArtifacts": true, + "createUpdaterArtifacts": false, "icon": [ "icons/32x32.png", "icons/128x128.png", diff --git a/src/components/UpdateChecker.tsx b/src/components/UpdateChecker.tsx index 43e2b85..268e9b1 100644 --- a/src/components/UpdateChecker.tsx +++ b/src/components/UpdateChecker.tsx @@ -4,7 +4,7 @@ import { useTheme } from "../context/ThemeContext"; import { useUpdateSettings } from "../hooks/useUpdateSettings"; import { UpdateSettingsModal } from "./UpdateSettingsModal"; import clsx from "clsx"; -import { Settings } from "lucide-react"; +import { Settings, Download, X, RefreshCw } from "lucide-react"; type UpdateState = | "checking" @@ -30,22 +30,18 @@ export const UpdateChecker = () => { const [showNotification, setShowNotification] = useState(false); const [showSettings, setShowSettings] = useState(false); const [error, setError] = useState(null); - const [changelogExpanded, setChangelogExpanded] = useState(false); + const [showTooltip, setShowTooltip] = useState(false); useEffect(() => { - // Check for updates based on user settings if (shouldCheckForUpdates()) { checkForUpdates(); } - - // Set up periodic checking if not manual if (settings.preference !== "manual") { const interval = setInterval(() => { if (shouldCheckForUpdates()) { checkForUpdates(); } - }, settings.checkInterval * 60 * 60 * 1000); // convert hours to ms - + }, settings.checkInterval * 60 * 60 * 1000); return () => clearInterval(interval); } }, [settings]); @@ -55,19 +51,11 @@ export const UpdateChecker = () => { try { const update = await check(); markUpdateCheckTime(); - if (update?.available) { setUpdateInfo(update); - - // Check if this version was already dismissed by user if (!isUpdateDismissed(update.version)) { setUpdateState("available"); - setShowNotification(true); - - // If auto mode, download automatically - if (settings.preference === "auto") { - await downloadUpdate(update); - } + setShowTooltip(true); } else { setUpdateState("none"); } @@ -75,6 +63,7 @@ export const UpdateChecker = () => { setUpdateState("none"); } } catch (err: any) { + console.error("Error checking for updates:", err); setError(err.message || "Error checking for updates"); setUpdateState("error"); } @@ -82,16 +71,12 @@ export const UpdateChecker = () => { const downloadUpdate = async (update = updateInfo) => { if (!update) return; - setUpdateState("downloading"); + setShowTooltip(false); try { await update.download(); setUpdateState("ready"); - - // If auto mode, install automatically - if (settings.preference === "auto") { - await installUpdate(update); - } + setShowNotification(true); } catch (err: any) { setError(err.message || "Error downloading update"); setUpdateState("error"); @@ -100,7 +85,6 @@ export const UpdateChecker = () => { const installUpdate = async (update = updateInfo) => { if (!update) return; - setUpdateState("installing"); try { await update.install(); @@ -110,44 +94,43 @@ export const UpdateChecker = () => { } }; - const dismissNotification = () => { + const handleTooltipAccept = () => { + downloadUpdate(); + }; + + const handleTooltipDismiss = () => { if (updateInfo) { dismissUpdate(updateInfo.version); } - setShowNotification(false); + setShowTooltip(false); + setUpdateState("none"); }; const getStateMessage = () => { switch (updateState) { case "checking": - return "Checking for updates..."; + return "Verificando atualizações..."; case "downloading": - return "Downloading update..."; + return "Baixando atualização..."; case "ready": - return "Update downloaded and ready to install"; + return "Atualização baixada e pronta para instalar"; case "installing": - return "Installing update..."; + return "Instalando atualização..."; case "error": - return `Error: ${error}`; + return `Erro: ${error}`; default: return ""; } }; - // Don't show notification if manual preference or already dismissed - if ( - !showNotification || - updateState === "none" || - settings.preference === "manual" - ) { - return ( - <> - {/* Small buttons for manual check or settings */} -
+ return ( + <> +
+
@@ -156,193 +139,167 @@ export const UpdateChecker = () => { )}
- setShowSettings(false)} - /> - - ); - } - - return ( - <> -
-
+ {/* Tooltip para nova versão disponível */} + {showTooltip && updateState === "available" && updateInfo && (
- -
-

- {updateState === "available" && "New version available"} - {updateState === "ready" && "Ready to install"} - {updateState === "error" && "Update error"} - {(updateState === "downloading" || - updateState === "installing") && - "Updating..."} -

- -

- {updateState === "available" && ( - <> - Version {updateInfo?.version} is available. - {updateInfo?.notes && ( - - )} - - )} - {(updateState === "downloading" || - updateState === "installing" || - updateState === "ready") && - getStateMessage()} - {updateState === "error" && error} -

- - {changelogExpanded && updateInfo?.notes && ( -
+
+ +
+

+ Nova versão disponível +

+

+ Versão {updateInfo.version} está disponível. Deseja baixar + agora? +

+
+ + +
+
+
- )} -
+ + +
-
- + /> +
+ )} +
+ + {/* Notificação quando atualização estiver pronta para instalar */} + {showNotification && updateState === "ready" && ( +
+
+
+
+

Pronto para instalar

+

+ A atualização foi baixada com sucesso. +

+
+ + +
+
+ )} -
- {updateState === "available" && ( - <> - - - - )} - - {updateState === "ready" && ( - <> - - - - )} - - {updateState === "error" && ( - + {/* Indicador de estado (loading, error, etc.) */} + {(updateState === "downloading" || + updateState === "installing" || + updateState === "error") && ( +
+
+ {(updateState === "downloading" || + updateState === "installing") && ( +
+ )} + {updateState === "error" && ( +
+ )} + {getStateMessage()} +
-
+ )}