feat(core): add payload data to UpdaterEvent::UpdateAvailable

This commit is contained in:
Lucas Nogueira 2022-03-15 16:56:38 -03:00
parent 7cd39c70c9
commit c29ed94d43
No known key found for this signature in database
GPG Key ID: FFEA6C72E73482F1
2 changed files with 16 additions and 5 deletions

View File

@ -234,7 +234,14 @@ pub use {
#[derive(Debug, Clone)]
pub enum UpdaterEvent {
/// An update is available.
UpdateAvailable,
UpdateAvailable {
/// The update body.
body: String,
/// The update release date.
date: String,
/// The update version.
version: String,
},
/// The update is pending.
Pending,
/// The update has been applied and the app is now up to date.

View File

@ -464,14 +464,18 @@ pub(crate) fn listener<R: Runtime>(
let _ = handle.emit_all(
EVENT_UPDATE_AVAILABLE,
UpdateManifest {
body,
body: body.clone(),
date: updater.date.clone(),
version: updater.version.clone(),
},
);
let _ = handle
.create_proxy()
.send_event(EventLoopMessage::Updater(UpdaterEvent::UpdateAvailable));
let _ = handle.create_proxy().send_event(EventLoopMessage::Updater(
UpdaterEvent::UpdateAvailable {
body,
date: updater.date.clone(),
version: updater.version.clone(),
},
));
// Listen for `tauri://update-install`
handle.once_global(EVENT_INSTALL_UPDATE, move |_msg| {