From 0a08824980512b42d6fcc4957c97c4b5c6290149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Papie=C5=BC?= Date: Tue, 25 Feb 2025 16:28:09 +0100 Subject: [PATCH] fix: missing update dialog when auto update disabled (#1547) #1546 Description --- When `auto_update` is disabled, the update dialog did not appear during the initial app launch. This issue arose because the `AutoUpdateDialog` was setting up listeners for the `updates_event `after the event had already been emitted from the backend. **Solution**: I resolved this issue by moving the `initialize_periodic_updates` function to the `frontend_ready` command. This change ensures that the frontend is already prepared to handle the event appropriately. Testing --- Run the app when newer version is available and `auto_update` is disabled. You should see the update dialog: ![image](https://github.com/user-attachments/assets/0aebfc05-ea58-4272-94ee-6a499e10ad25) ## Summary by CodeRabbit This release refines how the app manages updates for a smoother experience. Key changes include: - **Refactor** - Enhanced the update process with improved error feedback to better inform users if issues arise. - **Chores** - Removed the automatic background update checks at startup, streamlining the launch process. --- src-tauri/src/commands.rs | 8 ++++++++ src-tauri/src/main.rs | 5 ----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs index d8913868f..2884e3737 100644 --- a/src-tauri/src/commands.rs +++ b/src-tauri/src/commands.rs @@ -208,6 +208,14 @@ pub async fn frontend_ready(app: tauri::AppHandle) { .emit("app_ready", setup_complete_value) .expect("Could not emit event 'app_ready'"); + if let Err(e) = state + .updates_manager + .init_periodic_updates(app.clone()) + .await + { + error!(target: LOG_TARGET, "Failed to init periodic updates: {}", e); + } + let has_missing = missing_dependencies.is_some(); let external_dependencies = missing_dependencies.clone(); if has_missing { diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index fa5619b4a..0c9b561e6 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -338,11 +338,6 @@ async fn setup_inner( return Ok(()); } - state - .updates_manager - .init_periodic_updates(app.clone()) - .await?; - let data_dir = app .path() .app_local_data_dir()