mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-04-22 11:56:22 +02:00
chore: linting
This commit is contained in:
@@ -121,51 +121,48 @@ impl AutoUpdater {
|
||||
|
||||
Ok(notifications)
|
||||
}
|
||||
|
||||
pub async fn check_for_updates_with_progress(
|
||||
&self,
|
||||
app_handle: &tauri::AppHandle,
|
||||
) {
|
||||
// Check for browser updates and trigger auto-downloads
|
||||
match self.check_for_updates().await {
|
||||
Ok(update_notifications) => {
|
||||
if !update_notifications.is_empty() {
|
||||
|
||||
pub async fn check_for_updates_with_progress(&self, app_handle: &tauri::AppHandle) {
|
||||
// Check for browser updates and trigger auto-downloads
|
||||
match self.check_for_updates().await {
|
||||
Ok(update_notifications) => {
|
||||
if !update_notifications.is_empty() {
|
||||
println!(
|
||||
"Found {} browser updates to auto-download",
|
||||
update_notifications.len()
|
||||
);
|
||||
|
||||
// Trigger automatic downloads for each update
|
||||
for notification in update_notifications {
|
||||
println!(
|
||||
"Found {} browser updates to auto-download",
|
||||
update_notifications.len()
|
||||
"Auto-downloading {} version {}",
|
||||
notification.browser, notification.new_version
|
||||
);
|
||||
|
||||
// Trigger automatic downloads for each update
|
||||
for notification in update_notifications {
|
||||
println!(
|
||||
"Auto-downloading {} version {}",
|
||||
notification.browser, notification.new_version
|
||||
// Emit a custom event to trigger auto-download
|
||||
let auto_update_event = serde_json::json!({
|
||||
"browser": notification.browser,
|
||||
"new_version": notification.new_version,
|
||||
"notification_id": notification.id,
|
||||
"affected_profiles": notification.affected_profiles
|
||||
});
|
||||
|
||||
if let Err(e) = app_handle.emit("browser-auto-update-available", &auto_update_event) {
|
||||
eprintln!(
|
||||
"Failed to emit auto-update event for {}: {e}",
|
||||
notification.browser
|
||||
);
|
||||
|
||||
// Emit a custom event to trigger auto-download
|
||||
let auto_update_event = serde_json::json!({
|
||||
"browser": notification.browser,
|
||||
"new_version": notification.new_version,
|
||||
"notification_id": notification.id,
|
||||
"affected_profiles": notification.affected_profiles
|
||||
});
|
||||
|
||||
if let Err(e) = app_handle.emit("browser-auto-update-available", &auto_update_event) {
|
||||
eprintln!(
|
||||
"Failed to emit auto-update event for {}: {e}",
|
||||
notification.browser
|
||||
);
|
||||
} else {
|
||||
println!("Emitted auto-update event for {}", notification.browser);
|
||||
}
|
||||
} else {
|
||||
println!("Emitted auto-update event for {}", notification.browser);
|
||||
}
|
||||
} else {
|
||||
println!("No browser updates needed");
|
||||
}
|
||||
} else {
|
||||
println!("No browser updates needed");
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Failed to check for browser updates: {e}");
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Failed to check for browser updates: {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,9 +472,7 @@ pub async fn complete_browser_update_with_auto_update(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn check_for_updates_with_progress(
|
||||
app_handle: tauri::AppHandle,
|
||||
) {
|
||||
pub async fn check_for_updates_with_progress(app_handle: tauri::AppHandle) {
|
||||
let updater = AutoUpdater::new();
|
||||
updater.check_for_updates_with_progress(&app_handle).await;
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ pub fn run() {
|
||||
});
|
||||
|
||||
let app_handle_auto_updater = app.handle().clone();
|
||||
|
||||
|
||||
// Start the auto-update check task separately
|
||||
tauri::async_runtime::spawn(async move {
|
||||
auto_updater::check_for_updates_with_progress(app_handle_auto_updater).await;
|
||||
|
||||
@@ -385,7 +385,10 @@ impl VersionUpdater {
|
||||
tokio::time::sleep(Duration::from_millis(200)).await;
|
||||
}
|
||||
|
||||
self.auto_updater.check_for_updates_with_progress(app_handle).await;
|
||||
self
|
||||
.auto_updater
|
||||
.check_for_updates_with_progress(app_handle)
|
||||
.await;
|
||||
|
||||
// Emit completion event
|
||||
let progress = VersionUpdateProgress {
|
||||
|
||||
Reference in New Issue
Block a user