Auto-show What's New dialog on first launch after update
Track last_seen_version in session state. Show the What's New dialog automatically when the version changes, but not on very first run (where the welcome wizard is shown instead).
This commit is contained in:
@@ -188,6 +188,7 @@ pub struct SessionState {
|
||||
pub metadata_mode: Option<String>,
|
||||
pub watermark_enabled: Option<bool>,
|
||||
pub rename_enabled: Option<bool>,
|
||||
pub last_seen_version: Option<String>,
|
||||
}
|
||||
|
||||
pub struct SessionStore {
|
||||
|
||||
@@ -409,6 +409,32 @@ fn build_ui(app: &adw::Application) {
|
||||
window.present();
|
||||
|
||||
crate::welcome::show_welcome_if_first_launch(&window);
|
||||
|
||||
// Auto-show What's New dialog on first launch after update
|
||||
{
|
||||
let current_version = env!("CARGO_PKG_VERSION").to_string();
|
||||
let session = pixstrip_core::storage::SessionStore::new();
|
||||
let sess = session.load().unwrap_or_default();
|
||||
let last_seen = sess.last_seen_version.clone().unwrap_or_default();
|
||||
|
||||
if last_seen != current_version {
|
||||
// Update stored version immediately
|
||||
let mut updated_sess = sess;
|
||||
updated_sess.last_seen_version = Some(current_version.clone());
|
||||
let _ = session.save(&updated_sess);
|
||||
|
||||
// Only show dialog if this is not the very first run
|
||||
// (welcome wizard handles first run)
|
||||
let config_store = pixstrip_core::storage::ConfigStore::new();
|
||||
let config = config_store.load().unwrap_or_default();
|
||||
if config.first_run_complete && !last_seen.is_empty() {
|
||||
let w = window.clone();
|
||||
glib::idle_add_local_once(move || {
|
||||
show_whats_new_dialog(&w);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn build_menu() -> gtk::gio::Menu {
|
||||
|
||||
Reference in New Issue
Block a user