Skip to content

Commit 8180c1c

Browse files
committed
Display correct messages
Signed-off-by: Florian Grabmeier <[email protected]>
1 parent cb59b6b commit 8180c1c

File tree

2 files changed

+22
-26
lines changed

2 files changed

+22
-26
lines changed

Plugins/Flow.Launcher.Plugin.PluginsManager/Languages/en.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<system:String x:Key="plugin_pluginsmanager_update_alreadyexists">This plugin is already installed</system:String>
3131
<system:String x:Key="plugin_pluginsmanager_update_failed_title">Plugin Manifest Download Failed</system:String>
3232
<system:String x:Key="plugin_pluginsmanager_update_failed_subtitle">Please check if you can connect to github.com. This error means you may not be able to install or update plugins.</system:String>
33-
<system:String x:Key="plugin_pluginsmanager_update_all_title">Update All Plugins</system:String>
33+
<system:String x:Key="plugin_pluginsmanager_update_all_title">Update all plugins</system:String>
3434
<system:String x:Key="plugin_pluginsmanager_update_all_subtitle">Would you like to update all plugins?</system:String>
3535
<system:String x:Key="plugin_pluginsmanager_update_success_restart">Plugin {0} successfully updated. Restarting Flow, please wait...</system:String>
3636
<system:String x:Key="plugin_pluginsmanager_install_unknown_source_warning_title">Installing from an unknown source</system:String>

Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -308,25 +308,21 @@ await Http.DownloadAsync(x.PluginNewUserPlugin.UrlDownload, downloadToFilePath)
308308
Action = e =>
309309
{
310310
string message;
311-
//TODO: display all plugins to be updated in the message
312-
if (/*Settings.AutoRestartAfterChanging*/ false) // TODO: remove false
311+
if (Settings.AutoRestartAfterChanging)
313312
{
314-
message = string.Format(Context.API.GetTranslation("plugin_pluginsmanager_update_all_subtitle"), "FlowLauncher will restart after updating all plugins.",
315-
Environment.NewLine, Environment.NewLine);
313+
message = "Would you like to update all plugins?\nFlowLauncher will restart after updating all plugins.\n";
316314
}
317315
else
318316
{
319-
message = string.Format(Context.API.GetTranslation("plugin_pluginsmanager_update_all_subtitle"),
320-
Environment.NewLine);
317+
message = "Would you like to update all plugins?\nFlowLauncher will restart after updating all plugins.\n";
321318
}
319+
322320
if (MessageBox.Show(message,
323321
Context.API.GetTranslation("plugin_pluginsmanager_update_title"),
324322
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
325323
{
326-
Debug.Print("Looping through plugins to update");
327324
foreach (var plugin in resultsForUpdate)
328325
{
329-
Debug.Print($"Updating {plugin.Name}");
330326
var downloadToFilePath = Path.Combine(Path.GetTempPath(),
331327
$"{plugin.Name}-{plugin.NewVersion}.zip");
332328

@@ -342,20 +338,6 @@ await Http.DownloadAsync(plugin.PluginNewUserPlugin.UrlDownload, downloadToFileP
342338

343339
PluginManager.UpdatePlugin(plugin.PluginExistingMetadata, plugin.PluginNewUserPlugin, downloadToFilePath);
344340

345-
//TODO: fix
346-
// if (Settings.AutoRestartAfterChanging)
347-
// {
348-
// Context.API.ShowMsg(Context.API.GetTranslation("plugin_pluginsmanager_update_title"),
349-
// string.Format(Context.API.GetTranslation("plugin_pluginsmanager_update_success_restart"),
350-
// x.Name));
351-
// Context.API.RestartApp();
352-
// }
353-
// else
354-
// {
355-
// Context.API.ShowMsg(Context.API.GetTranslation("plugin_pluginsmanager_update_title"),
356-
// string.Format(Context.API.GetTranslation("plugin_pluginsmanager_update_success_no_restart"),
357-
// x.Name));
358-
// }
359341
}).ContinueWith(t =>
360342
{
361343
Log.Exception("PluginsManager", $"Update failed for {plugin.Name}",
@@ -367,10 +349,24 @@ await Http.DownloadAsync(plugin.PluginNewUserPlugin.UrlDownload, downloadToFileP
367349
plugin.Name));
368350
}, TaskContinuationOptions.OnlyOnFaulted);
369351
}
370-
Debug.Print("Finished updating all plugins");
371-
return true; // User confirmed to update all plugins
352+
353+
if (Settings.AutoRestartAfterChanging)
354+
{
355+
Context.API.ShowMsg(Context.API.GetTranslation("plugin_pluginsmanager_update_title"),
356+
string.Format(Context.API.GetTranslation("plugin_pluginsmanager_update_success_restart"),
357+
"all"));
358+
Context.API.RestartApp();
359+
}
360+
else
361+
{
362+
Context.API.ShowMsg(Context.API.GetTranslation("plugin_pluginsmanager_update_title"),
363+
string.Format(Context.API.GetTranslation("plugin_pluginsmanager_update_success_no_restart"),
364+
"all"));
365+
}
366+
367+
return true;
372368
}
373-
return false; //user cancelled
369+
return false;
374370
},
375371
ContextData = new UserPlugin()
376372
};

0 commit comments

Comments
 (0)