diff --git a/src/MicMute.ahk b/src/MicMute.ahk index 1345da9..91a54fc 100644 --- a/src/MicMute.ahk +++ b/src/MicMute.ahk @@ -71,7 +71,7 @@ Global A_startupTime:= A_TickCount , osd_wnd , overlay_wnd , A_log:="" -, updater_obj:= new Updater(A_ScriptDir) +, updater_obj:= new Updater(A_ScriptDir, Func("util_log")) , updater_UI:="" ; parse cli args @@ -99,10 +99,10 @@ OnExit(Func("exitMicMute")) OnMessage(WM_SETTINGCHANGE, "updateSysTheme") ; listen for window changes registerWindowHook() -; run the update checker once, 5 seconds after launching +; run the update checker once, 10 seconds after launching if(A_IsCompiled && !arg_reload && config_obj.AllowUpdateChecker=1){ cfunc:= ObjBindMethod(updater_obj, "CheckForUpdates") - SetTimer, % cfunc, -5000 + SetTimer, % cfunc, -10000 } A_startupTime:= A_TickCount - A_startupTime util_log("[Main] MicMute startup took " A_startupTime "ms") @@ -147,13 +147,11 @@ initilizeMicMute(default_profile:=""){ ;initilize tray tray_init() if(config_obj.AllowUpdateChecker==-1){ - MsgBox, 35, MicMute, Allow MicMute to connect to the internet and check for updates on startup? + MsgBox, 36, MicMute, Allow MicMute to connect to the internet and check for updates on startup? IfMsgBox, Yes config_obj.AllowUpdateChecker:= 1 IfMsgBox, No config_obj.AllowUpdateChecker:= 0 - IfMsgBox, Cancel - config_obj.AllowUpdateChecker:= -1 } ;on first launch -> immediately call editConfig() if(isFirstLaunch){ @@ -426,6 +424,9 @@ configMsg(err){ } runUpdater(){ + if(!A_IsCompiled) + return + util_log("[Main] Restarting MicMute in updater mode") FileCopy, %A_ScriptFullPath%, %A_Temp%\MicMuteUpdater.exe, 1 Run, "%A_Temp%\MicMuteUpdater.exe" "/updater=1" "/installPath=%A_ScriptDir%" ExitApp, 1 diff --git a/src/UI/Tray.ahk b/src/UI/Tray.ahk index caa2ffe..40a5dce 100644 --- a/src/UI/Tray.ahk +++ b/src/UI/Tray.ahk @@ -122,7 +122,7 @@ tray_Reload(){ } tray_checkForUpdates(){ - updater_obj.CheckForUpdates(1) + UI_showAbout("",1) } tray_noFunc(){ diff --git a/src/UI/config/UI.ahk b/src/UI/config/UI.ahk index bf68c80..77a46e1 100644 --- a/src/UI/config/UI.ahk +++ b/src/UI/config/UI.ahk @@ -778,10 +778,12 @@ UI_createAbout(){ about_obj.Gui("-Resize") } -UI_showAbout(neutron:=""){ +UI_showAbout(neutron:="", isCheckingForUpdates:=0){ util_log("[UI] Showing 'about' window") tray_defaults() - about_obj.show(Format("Center w{:i} h{:i}",500*UI_scale,300*UI_scale),"About MicMute") + if(isCheckingForUpdates) + UI_checkForUpdates(neutron) + about_obj.show(Format("Center w{:i} h{:i}", 500*UI_scale, 300*UI_scale), "About MicMute") about_obj.doc.focus() } @@ -791,12 +793,34 @@ UI_exitAbout(neutron){ UI_createAbout() } +UI_checkForUpdates(neutron:=""){ + refreshButton:= about_obj.doc.getElementById("refresh_button") + refreshButton.classList.add("is-loading") + latestVersion:= updater_obj.getLatestVersion() + if(latestVersion){ + about_obj.doc.getElementById("latest_version").innerText:= latestVersion + refreshButton.classList.add("push-right") + if(latestVersion > A_Version){ + about_obj.doc.getElementById("update_button").classList.remove("is-hidden") + } + } + refreshButton.classList.remove("is-loading") + refreshButton.blur() +} + +UI_launchUpdater(neutron:=""){ + MsgBox, 65, MicMute, % "This will restart MicMute in updater mode" + IfMsgBox, OK + runUpdater() + about_obj.doc.getElementById("update_button").blur() +} + UI_launchURL(neutron:="", url:=""){ Run, %url%, %A_Desktop% } -UI_launchReleasePage(neutron:=""){ - url:= "https://github.com/SaifAqqad/AHK_MicMute/releases/tag/" . A_Version +UI_launchReleasePage(neutron:="", version:=""){ + url:= "https://github.com/SaifAqqad/AHK_MicMute/releases/tag/" . (version? version : A_Version) Run, %url%, %A_Desktop% } diff --git a/src/UI/config/UpdaterUI.ahk b/src/UI/config/UpdaterUI.ahk index 7703211..ce3c5ba 100644 --- a/src/UI/config/UpdaterUI.ahk +++ b/src/UI/config/UpdaterUI.ahk @@ -22,7 +22,7 @@ class UpdaterUI extends NeutronWindow{ show(){ this.setUIState("pre-update") this.resetDetail() - this.appendDetail("Current version: " A_Version "") + this.appendDetail("Installed version: " A_Version "") this.appendDetail("Latest version: " updater_obj.getLatestVersion() "") this.appendDetail("Installation method: " updater_obj.installationMethod "") base.Gui("+LabelUpdaterUI_ +MinSize780x510 -Resize") diff --git a/src/UI/config/css/dark.css b/src/UI/config/css/dark.css index db830e9..5bedffe 100644 --- a/src/UI/config/css/dark.css +++ b/src/UI/config/css/dark.css @@ -9,7 +9,8 @@ body { scrollbar-shadow-color: #4E4E4E; } -.title-bar-header { +.title-bar-header , +.modal-card-head{ color: #d9d9d9 !important; background: #272727 !important; } diff --git a/src/UI/config/html/about.html b/src/UI/config/html/about.html index 7ef6177..a4a615a 100644 --- a/src/UI/config/html/about.html +++ b/src/UI/config/html/about.html @@ -1,92 +1,145 @@ -
- - - - - -