feat: hoppscotch agent and agent interceptor (#4396)
Co-authored-by: CuriousCorrelation <CuriousCorrelation@gmail.com> Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
This commit is contained in:
34
packages/hoppscotch-agent/src-tauri/src/updater.rs
Normal file
34
packages/hoppscotch-agent/src-tauri/src/updater.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
#[cfg(desktop)]
|
||||
pub async fn check_and_install_updates(app: tauri::AppHandle, updater: tauri_plugin_updater::Updater) {
|
||||
use tauri::Manager;
|
||||
use tauri_plugin_dialog::MessageDialogKind;
|
||||
use tauri_plugin_dialog::DialogExt;
|
||||
|
||||
|
||||
let update = updater.check().await;
|
||||
|
||||
if let Ok(Some(update)) = update {
|
||||
let do_update = app.dialog()
|
||||
.message(
|
||||
format!(
|
||||
"Update to {} is available!{}",
|
||||
update.version,
|
||||
update.body
|
||||
.clone()
|
||||
.map(|body| format!("\n\nRelease Notes: {}", body))
|
||||
.unwrap_or("".into())
|
||||
)
|
||||
)
|
||||
.title("Update Available")
|
||||
.kind(MessageDialogKind::Info)
|
||||
.ok_button_label("Update")
|
||||
.cancel_button_label("Cancel")
|
||||
.blocking_show();
|
||||
|
||||
if do_update {
|
||||
let _ = update.download_and_install(|_, _| {}, || {}).await;
|
||||
|
||||
tauri::process::restart(&app.env());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user