1616using Flow . Launcher . Infrastructure . Logger ;
1717using System . IO ;
1818using Flow . Launcher . Infrastructure . UserSettings ;
19+ using Flow . Launcher . Plugin ;
1920
2021namespace Flow . Launcher . Core
2122{
@@ -28,11 +29,14 @@ public Updater(string gitHubRepository)
2829 GitHubRepository = gitHubRepository ;
2930 }
3031
31- public async Task UpdateApp ( bool silentIfLatestVersion = true )
32+ public async Task UpdateApp ( IPublicAPI api , bool silentUpdate = true )
3233 {
3334 UpdateManager updateManager ;
3435 UpdateInfo newUpdateInfo ;
3536
37+ if ( ! silentUpdate )
38+ api . ShowMsg ( "Please wait..." , "Checking for new update" ) ;
39+
3640 try
3741 {
3842 updateManager = await GitHubUpdateManager ( GitHubRepository ) ;
@@ -62,12 +66,15 @@ public async Task UpdateApp(bool silentIfLatestVersion = true)
6266
6367 if ( newReleaseVersion <= currentVersion )
6468 {
65- if ( ! silentIfLatestVersion )
69+ if ( ! silentUpdate )
6670 MessageBox . Show ( "You already have the latest Flow Launcher version" ) ;
6771 updateManager . Dispose ( ) ;
6872 return ;
6973 }
70-
74+
75+ if ( ! silentUpdate )
76+ api . ShowMsg ( "Update found" , "Updating..." ) ;
77+
7178 try
7279 {
7380 await updateManager . DownloadReleases ( newUpdateInfo . ReleasesToApply ) ;
@@ -96,11 +103,15 @@ public async Task UpdateApp(bool silentIfLatestVersion = true)
96103
97104 var newVersionTips = NewVersinoTips ( newReleaseVersion . ToString ( ) ) ;
98105
99- MessageBox . Show ( newVersionTips ) ;
100106 Log . Info ( $ "|Updater.UpdateApp|Update success:{ newVersionTips } ") ;
101107
102108 // always dispose UpdateManager
103109 updateManager . Dispose ( ) ;
110+
111+ if ( MessageBox . Show ( newVersionTips , "New Update" , MessageBoxButton . YesNo ) == MessageBoxResult . Yes )
112+ {
113+ UpdateManager . RestartApp ( Constant . ApplicationFileName ) ;
114+ }
104115 }
105116
106117 [ UsedImplicitly ]
0 commit comments