Skip to content

Commit 7147bbd

Browse files
Fixes auto-update feature for all the platforms
Signed-off-by: Cole Gentry <peapod2007@gmail.com>
1 parent 5691c76 commit 7147bbd

8 files changed

Lines changed: 686 additions & 22 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ultralog"
3-
version = "1.3.0"
3+
version = "1.4.0"
44
edition = "2021"
55
description = "A high-performance ECU log viewer written in Rust"
66
authors = ["Cole Gentry"]
@@ -48,6 +48,9 @@ memmap2 = "0.9" # Memory-mapped file loading for large files
4848
# Auto-update
4949
ureq = { version = "3.0", features = ["json"] } # Minimal HTTP client
5050
semver = "1.0" # Version comparison
51+
zip = "2.2" # ZIP extraction for Windows updates
52+
flate2 = "1.0" # Gzip decompression for Linux updates
53+
tar = "0.4" # Tar archive extraction for Linux updates
5154

5255
# Image loading (for app icon and PNG export)
5356
image = { version = "0.25", default-features = false, features = ["png"] }

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A high-performance, cross-platform ECU log viewer written in Rust.
66

77
![CI](https://github.com/SomethingNew71/UltraLog/actions/workflows/ci.yml/badge.svg)
88
![License](https://img.shields.io/badge/license-MIT-blue.svg)
9-
![Version](https://img.shields.io/badge/version-1.3.0-green.svg)
9+
![Version](https://img.shields.io/badge/version-1.4.0-green.svg)
1010

1111
---
1212

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@
710710
<strong>Free and open source</strong> — no subscriptions, no licenses, just download and go.
711711
</p>
712712
<div class="hero-badges">
713-
<span class="version-badge">v1.3.0</span>
713+
<span class="version-badge">v1.4.0</span>
714714
<a href="https://github.com/SomethingNew71/UltraLog" class="opensource-badge" target="_blank">
715715
<i class="fa-brands fa-github"></i> Open Source
716716
</a>

src/app.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ pub struct UltraLogApp {
105105
pub(crate) auto_check_updates: bool,
106106
/// Whether the startup check has been performed
107107
startup_check_done: bool,
108+
/// Set to true when the app should exit for an update to be applied
109+
pub(crate) should_exit_for_update: bool,
108110
}
109111

110112
impl Default for UltraLogApp {
@@ -145,6 +147,7 @@ impl Default for UltraLogApp {
145147
show_update_dialog: false,
146148
auto_check_updates: true, // Enabled by default
147149
startup_check_done: false,
150+
should_exit_for_update: false,
148151
}
149152
}
150153
}
@@ -1085,6 +1088,12 @@ impl UltraLogApp {
10851088

10861089
impl eframe::App for UltraLogApp {
10871090
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
1091+
// Exit if update installation requires it (updater script is waiting)
1092+
if self.should_exit_for_update {
1093+
ctx.send_viewport_cmd(egui::ViewportCommand::Close);
1094+
return;
1095+
}
1096+
10881097
// Check for updates on startup (runs once)
10891098
self.check_startup_update();
10901099

src/ui/update_dialog.rs

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use eframe::egui;
66

77
use crate::app::UltraLogApp;
8-
use crate::updater::{UpdateInfo, UpdateState};
8+
use crate::updater::{InstallResult, UpdateInfo, UpdateState};
99

1010
impl UltraLogApp {
1111
/// Render the update available dialog window
@@ -164,38 +164,46 @@ impl UltraLogApp {
164164

165165
ui.add_space(15.0);
166166

167-
ui.label("Click Install to open the update file.");
167+
ui.label("Click Install to apply the update.");
168168

169169
#[cfg(target_os = "windows")]
170170
ui.label(
171-
egui::RichText::new("Extract the ZIP and replace the application.")
171+
egui::RichText::new("The application will close and restart automatically.")
172172
.color(egui::Color32::GRAY),
173173
);
174174

175175
#[cfg(target_os = "macos")]
176176
ui.label(
177-
egui::RichText::new("Open the DMG and drag the app to Applications.")
177+
egui::RichText::new("The DMG will open - drag UltraLog to Applications.")
178178
.color(egui::Color32::GRAY),
179179
);
180180

181181
#[cfg(target_os = "linux")]
182182
ui.label(
183-
egui::RichText::new("Extract the archive and replace the binary.")
183+
egui::RichText::new("The application will close and restart automatically.")
184184
.color(egui::Color32::GRAY),
185185
);
186186

187187
ui.add_space(15.0);
188188

189189
ui.horizontal(|ui| {
190190
if ui.button("Install Now").clicked() {
191-
if let Err(e) = crate::updater::install_update(path) {
192-
self.show_toast_error(&e);
193-
} else {
194-
self.show_toast_success(
195-
"Update file opened. Follow the installer instructions.",
196-
);
197-
*should_close = true;
198-
self.update_state = UpdateState::Idle;
191+
match crate::updater::install_update(path) {
192+
InstallResult::ReadyToRestart { message } => {
193+
self.show_toast_success(&message);
194+
*should_close = true;
195+
self.update_state = UpdateState::Idle;
196+
// Request app exit so the updater script can run
197+
self.should_exit_for_update = true;
198+
}
199+
InstallResult::ManualInstallRequired { message } => {
200+
self.show_toast_success(&message);
201+
*should_close = true;
202+
self.update_state = UpdateState::Idle;
203+
}
204+
InstallResult::Error(e) => {
205+
self.show_toast_error(&e);
206+
}
199207
}
200208
}
201209

0 commit comments

Comments
 (0)