File tree Expand file tree Collapse file tree 2 files changed +22
-4
lines changed
Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' tauri ' : ' patch'
3+ ---
4+
5+ Emit ` UPTODATE ` update status to javascript when the updater server returns status code ` 204 `
Original file line number Diff line number Diff line change @@ -298,13 +298,14 @@ impl<R: Runtime> UpdateBuilder<R> {
298298 /// Ok(())
299299 /// });
300300 /// ```
301+ ///
302+ /// If ther server responds with status code `204`, this method will return [`Error::UpToDate`]
301303 pub async fn check ( self ) -> Result < UpdateResponse < R > > {
302304 let handle = self . inner . app . clone ( ) ;
303- let events = self . events ;
304305 // check updates
305306 match self . inner . build ( ) . await {
306307 Ok ( update) => {
307- if events {
308+ if self . events {
308309 // send notification if we need to update
309310 if update. should_update {
310311 let body = update. body . clone ( ) . unwrap_or_else ( || String :: from ( "" ) ) ;
@@ -341,7 +342,13 @@ impl<R: Runtime> UpdateBuilder<R> {
341342 }
342343 Err ( e) => {
343344 if self . events {
344- send_status_update ( & handle, UpdaterEvent :: Error ( e. to_string ( ) ) ) ;
345+ send_status_update (
346+ & handle,
347+ match e {
348+ Error :: UpToDate => UpdaterEvent :: AlreadyUpToDate ,
349+ _ => UpdaterEvent :: Error ( e. to_string ( ) ) ,
350+ } ,
351+ ) ;
345352 }
346353 Err ( e)
347354 }
@@ -428,7 +435,13 @@ pub(crate) async fn check_update_with_dialog<R: Runtime>(handle: AppHandle<R>) {
428435 }
429436 }
430437 Err ( e) => {
431- send_status_update ( & handle, UpdaterEvent :: Error ( e. to_string ( ) ) ) ;
438+ send_status_update (
439+ & handle,
440+ match e {
441+ Error :: UpToDate => UpdaterEvent :: AlreadyUpToDate ,
442+ _ => UpdaterEvent :: Error ( e. to_string ( ) ) ,
443+ } ,
444+ ) ;
432445 }
433446 }
434447 }
You can’t perform that action at this time.
0 commit comments