Skip to content

Commit c2ca29d

Browse files
committed
add go to update section if update exists when install
1 parent cca53c2 commit c2ca29d

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<system:String x:Key="plugin_pluginsmanager_update_noresult_subtitle">All plugins are up to date</system:String>
1616
<system:String x:Key="plugin_pluginsmanager_update_prompt">{0} by {1} {2}{3}Would you like to update this plugin? After the update Flow will automatically restart.</system:String>
1717
<system:String x:Key="plugin_pluginsmanager_update_title">Plugin Update</system:String>
18+
<system:String x:Key="plugin_pluginsmanager_update_exists">This plugin has an update, would you like to see it?</system:String>
19+
<system:String x:Key="plugin_pluginsmanager_update_alreadyexists">This plugin is already installed</system:String>
1820

1921
<!--Controls-->
2022

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,22 @@ internal void InstallOrUpdate(UserPlugin plugin)
4646
{
4747
if (PluginExists(plugin.ID))
4848
{
49-
Context.API.ShowMsg("Plugin already installed");
49+
if (Context.API.GetAllPlugins().Any(x => x.Metadata.ID == plugin.ID && x.Metadata.Version != plugin.Version))
50+
{
51+
if (MessageBox.Show(Context.API.GetTranslation("plugin_pluginsmanager_update_exists"),
52+
Context.API.GetTranslation("plugin_pluginsmanager_update_title"),
53+
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
54+
Context
55+
.API
56+
.ChangeQuery($"{Context.CurrentPluginMetadata.ActionKeywords.FirstOrDefault()} {Settings.HotkeyUpdate} {plugin.Name}");
57+
58+
Application.Current.MainWindow.Show();
59+
shouldHideWindow = false;
60+
61+
return;
62+
}
63+
64+
Context.API.ShowMsg(Context.API.GetTranslation("plugin_pluginsmanager_update_alreadyexists"));
5065
return;
5166
}
5267

0 commit comments

Comments
 (0)