|
@@ -230,6 +230,8 @@
|
|
|
//!
|
|
|
//! **Pending** is emitted when the download is started and **Done** when the install is complete. You can then ask to restart the application.
|
|
|
//!
|
|
|
+//! **Downloaded** is emitted when the download has finished.
|
|
|
+//!
|
|
|
//! **UpToDate** is emitted when the app already has the latest version installed and an update is not needed.
|
|
|
//!
|
|
|
//! **Error** is emitted when there is an error with the updater. We suggest to listen to this event even if the dialog is enabled.
|
|
@@ -249,6 +251,9 @@
|
|
|
//! tauri::UpdaterEvent::Pending => {
|
|
|
//! println!("update is pending!");
|
|
|
//! }
|
|
|
+//! tauri::UpdaterEvent::Downloaded => {
|
|
|
+//! println!("update has been downloaded!");
|
|
|
+//! }
|
|
|
//! tauri::UpdaterEvent::Updated => {
|
|
|
//! println!("app has been updated");
|
|
|
//! }
|
|
@@ -465,6 +470,8 @@ pub const EVENT_STATUS_PENDING: &str = "PENDING";
|
|
|
/// When you got this status, something went wrong
|
|
|
/// you can find the error message inside the `error` field.
|
|
|
pub const EVENT_STATUS_ERROR: &str = "ERROR";
|
|
|
+/// The update has been downloaded.
|
|
|
+pub const EVENT_STATUS_DOWNLOADED: &str = "DOWNLOADED";
|
|
|
/// When you receive this status, you should ask the user to restart
|
|
|
pub const EVENT_STATUS_SUCCESS: &str = "DONE";
|
|
|
/// When you receive this status, this is because the application is running last version
|
|
@@ -712,6 +719,7 @@ pub(crate) async fn download_and_install<R: Runtime>(update: core::Update<R>) ->
|
|
|
send_status_update(&update.app, UpdaterEvent::Pending);
|
|
|
|
|
|
let handle = update.app.clone();
|
|
|
+ let handle_ = handle.clone();
|
|
|
|
|
|
// Launch updater download process
|
|
|
// macOS we display the `Ready to restart dialog` asking to restart
|
|
@@ -723,6 +731,9 @@ pub(crate) async fn download_and_install<R: Runtime>(update: core::Update<R>) ->
|
|
|
move |chunk_length, content_length| {
|
|
|
send_download_progress_event(&handle, chunk_length, content_length);
|
|
|
},
|
|
|
+ move || {
|
|
|
+ send_status_update(&handle_, UpdaterEvent::Downloaded);
|
|
|
+ },
|
|
|
)
|
|
|
.await;
|
|
|
|
|
@@ -840,7 +851,7 @@ Release Notes:
|
|
|
// Windows is closing the current App and launch the downloaded MSI when ready (the process stop here)
|
|
|
// Linux we replace the AppImage by launching a new install, it start a new AppImage instance, so we're closing the previous. (the process stop here)
|
|
|
update
|
|
|
- .download_and_install(pubkey.clone(), |_, _| ())
|
|
|
+ .download_and_install(pubkey.clone(), |_, _| (), || ())
|
|
|
.await?;
|
|
|
|
|
|
// Ask user if we need to restart the application
|