mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-26 11:21:16 +01:00
Show alert after force checking updates
This commit is contained in:
@@ -733,7 +733,7 @@ async fn check_for_updates(
|
||||
app_handle: AppHandle<Wry>,
|
||||
db_instance: State<'_, Mutex<Pool<Sqlite>>>,
|
||||
yaak_updater: State<'_, Mutex<YaakUpdater>>,
|
||||
) -> Result<(), String> {
|
||||
) -> Result<bool, String> {
|
||||
let pool = &*db_instance.lock().await;
|
||||
let update_mode = get_update_mode(pool).await;
|
||||
yaak_updater
|
||||
|
||||
@@ -29,7 +29,7 @@ impl YaakUpdater {
|
||||
&mut self,
|
||||
app_handle: &AppHandle<Wry>,
|
||||
mode: UpdateMode,
|
||||
) -> Result<(), updater::Error> {
|
||||
) -> Result<bool, updater::Error> {
|
||||
self.last_update_check = SystemTime::now();
|
||||
|
||||
let update_mode = get_update_mode_str(mode);
|
||||
@@ -37,7 +37,7 @@ impl YaakUpdater {
|
||||
info!("Checking for updates mode={} enabled={}", update_mode, enabled);
|
||||
|
||||
if !enabled {
|
||||
return Ok(());
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
match app_handle
|
||||
@@ -81,9 +81,9 @@ impl YaakUpdater {
|
||||
});
|
||||
},
|
||||
);
|
||||
Ok(())
|
||||
Ok(true)
|
||||
}
|
||||
Err(updater::Error::UpToDate) => Ok(()),
|
||||
Err(updater::Error::UpToDate) => Ok(false),
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
@@ -91,9 +91,10 @@ impl YaakUpdater {
|
||||
&mut self,
|
||||
app_handle: &AppHandle<Wry>,
|
||||
mode: UpdateMode,
|
||||
) -> Result<(), updater::Error> {
|
||||
if self.last_update_check.elapsed().unwrap().as_secs() < MAX_UPDATE_CHECK_SECONDS {
|
||||
return Ok(());
|
||||
) -> Result<bool, updater::Error> {
|
||||
let ignore_check = self.last_update_check.elapsed().unwrap().as_secs() < MAX_UPDATE_CHECK_SECONDS;
|
||||
if ignore_check {
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
self.force_check(app_handle, mode).await
|
||||
|
||||
Reference in New Issue
Block a user