Skip to content

Commit 110ae4a

Browse files
committed
v1.2.5
- Added update dialog after manual check for updates when an update is found
1 parent 81a26ea commit 110ae4a

9 files changed

Lines changed: 35 additions & 3 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "claude-code-usage-monitor"
3-
version = "1.2.3"
3+
version = "1.2.5"
44
edition = "2021"
55
license = "MIT"
66
description = "Windows taskbar widget for monitoring Claude Code usage and rate limits"

src/localization/english.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ pub(super) const STRINGS: Strings = Strings {
2424
update_failed: "Unable to update automatically",
2525
applying_update: "Applying update...",
2626
update_to: "Update to",
27+
update_available: "Update available",
28+
update_prompt_now: "Version {version} is available. Do you want to update now?",
2729
exit: "Exit",
2830
session_window: "5h",
2931
weekly_window: "7d",

src/localization/french.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ pub(super) const STRINGS: Strings = Strings {
2424
update_failed: "Impossible d'effectuer la mise à jour automatiquement",
2525
applying_update: "Application de la mise à jour...",
2626
update_to: "Mettre à jour vers",
27+
update_available: "Mise à jour disponible",
28+
update_prompt_now: "La version {version} est disponible. Voulez-vous mettre à jour maintenant ?",
2729
exit: "Quitter",
2830
session_window: "5h",
2931
weekly_window: "7d",

src/localization/german.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ pub(super) const STRINGS: Strings = Strings {
2424
update_failed: "Automatisches Update war nicht möglich",
2525
applying_update: "Update wird installiert...",
2626
update_to: "Aktualisieren auf",
27+
update_available: "Update verfügbar",
28+
update_prompt_now: "Version {version} ist verfügbar. Möchten Sie jetzt aktualisieren?",
2729
exit: "Beenden",
2830
session_window: "5h",
2931
weekly_window: "7d",

src/localization/japanese.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ pub(super) const STRINGS: Strings = Strings {
2424
update_failed: "自動更新を完了できませんでした",
2525
applying_update: "更新を適用しています...",
2626
update_to: "更新先",
27+
update_available: "更新が利用可能です",
28+
update_prompt_now: "バージョン {version} が利用可能です。今すぐ更新しますか?",
2729
exit: "終了",
2830
session_window: "5h",
2931
weekly_window: "7d",

src/localization/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ pub struct Strings {
108108
pub update_failed: &'static str,
109109
pub applying_update: &'static str,
110110
pub update_to: &'static str,
111+
pub update_available: &'static str,
112+
pub update_prompt_now: &'static str,
111113
pub exit: &'static str,
112114
pub session_window: &'static str,
113115
pub weekly_window: &'static str,

src/localization/spanish.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ pub(super) const STRINGS: Strings = Strings {
2424
update_failed: "No se pudo actualizar automáticamente",
2525
applying_update: "Aplicando actualización...",
2626
update_to: "Actualizar a",
27+
update_available: "Actualización disponible",
28+
update_prompt_now: "La versión {version} está disponible. ¿Quieres actualizar ahora?",
2729
exit: "Salir",
2830
session_window: "5h",
2931
weekly_window: "7d",

src/window.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,23 @@ fn show_error_message(hwnd: HWND, title: &str, message: &str) {
253253
}
254254
}
255255

256+
fn show_update_prompt(hwnd: HWND, strings: Strings, release: &ReleaseDescriptor) -> bool {
257+
let message = strings
258+
.update_prompt_now
259+
.replace("{version}", &release.latest_version);
260+
261+
unsafe {
262+
let title_wide = native_interop::wide_str(strings.update_available);
263+
let message_wide = native_interop::wide_str(&message);
264+
MessageBoxW(
265+
hwnd,
266+
PCWSTR::from_raw(message_wide.as_ptr()),
267+
PCWSTR::from_raw(title_wide.as_ptr()),
268+
MB_YESNO | MB_ICONQUESTION,
269+
) == IDYES
270+
}
271+
}
272+
256273
fn apply_language_to_state(state: &mut AppState, language_override: Option<LanguageId>) {
257274
state.language_override = language_override;
258275
state.language = localization::resolve_language(language_override);
@@ -347,9 +364,12 @@ fn begin_update_check(hwnd: HWND) {
347364
{
348365
let mut state = lock_state();
349366
if let Some(s) = state.as_mut() {
350-
s.update_status = UpdateStatus::Available(release);
367+
s.update_status = UpdateStatus::Available(release.clone());
351368
}
352369
}
370+
if show_update_prompt(hwnd, strings, &release) {
371+
begin_update_apply(hwnd, release);
372+
}
353373
unsafe {
354374
let _ = PostMessageW(hwnd, WM_APP_UPDATE_CHECK_COMPLETE, WPARAM(0), LPARAM(0));
355375
}

0 commit comments

Comments
 (0)