Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Flow.Launcher.Core/Plugin/JsonRPCV2Models/JsonRPCPublicAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ public void ShowMsg(string title, string subTitle, string iconPath, bool useMain
_api.ShowMsg(title, subTitle, iconPath, useMainWindowAsOwner);
}

public void ShowMsg(string title, string subTitle, string iconPath, bool useMainWindowAsOwner = true, bool forceShown = false)
{
_api.ShowMsg(title, subTitle, iconPath, useMainWindowAsOwner, forceShown);
}

public void OpenSettingDialog()
{
_api.OpenSettingDialog();
Expand Down
19 changes: 14 additions & 5 deletions Flow.Launcher.Core/Plugin/PluginInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ await DownloadFileAsync(
{
PublicApi.Instance.ShowMsg(
Localize.installbtn(),
Localize.InstallSuccessNoRestart(newPlugin.Name));
Localize.InstallSuccessNoRestart(newPlugin.Name),
iconPath: "",
forceShown: true);
}
}

Expand Down Expand Up @@ -194,7 +196,9 @@ public static async Task UninstallPluginAndCheckRestartAsync(PluginMetadata oldP
{
PublicApi.Instance.ShowMsg(
Localize.uninstallbtn(),
Localize.UninstallSuccessNoRestart(oldPlugin.Name));
Localize.UninstallSuccessNoRestart(oldPlugin.Name),
iconPath: "",
forceShown: true);
}
}

Expand Down Expand Up @@ -254,7 +258,9 @@ await DownloadFileAsync(
{
PublicApi.Instance.ShowMsg(
Localize.updatebtn(),
Localize.UpdateSuccessNoRestart(newPlugin.Name));
Localize.UpdateSuccessNoRestart(newPlugin.Name),
iconPath: "",
forceShown: true);
}
}

Expand Down Expand Up @@ -298,7 +304,8 @@ where string.Compare(existingPlugin.Metadata.Version, pluginUpdateSource.Version
{
if (!silentUpdate)
{
PublicApi.Instance.ShowMsg(Localize.updateNoResultTitle(), Localize.updateNoResultSubtitle());
PublicApi.Instance.ShowMsg(Localize.updateNoResultTitle(), Localize.updateNoResultSubtitle(), iconPath: "",
forceShown: true);
}
return;
}
Expand Down Expand Up @@ -370,7 +377,9 @@ await DownloadFileAsync(
{
PublicApi.Instance.ShowMsg(
Localize.updatebtn(),
Localize.PluginsUpdateSuccessNoRestart());
Localize.PluginsUpdateSuccessNoRestart(),
iconPath: "",
forceShown: true);
}
}

Expand Down
6 changes: 2 additions & 4 deletions Flow.Launcher.Core/Plugin/PluginManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,9 @@ public static async Task InitializePluginsAsync(IResultUpdateRegister register)
if (!_initFailedPlugins.IsEmpty)
{
var failed = string.Join(",", _initFailedPlugins.Values.Select(x => x.Metadata.Name));
PublicApi.Instance.ShowMsg(
PublicApi.Instance.ShowMsgError(
Localize.failedToInitializePluginsTitle(),
Localize.failedToInitializePluginsMessage(failed),
"",
false
Localize.failedToInitializePluginsMessage(failed)
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions Flow.Launcher.Core/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public async Task UpdateAppAsync(bool silentUpdate = true)
{
if (!silentUpdate)
_api.ShowMsg(Localize.pleaseWait(),
Localize.update_flowlauncher_update_check());
Localize.update_flowlauncher_update_check(), iconPath: "", forceShown: true);

using var updateManager = await GitHubUpdateManagerAsync(GitHubRepository).ConfigureAwait(false);

Expand All @@ -64,7 +64,7 @@ public async Task UpdateAppAsync(bool silentUpdate = true)

if (!silentUpdate)
_api.ShowMsg(Localize.update_flowlauncher_update_found(),
Localize.update_flowlauncher_updating());
Localize.update_flowlauncher_updating(), iconPath: "", forceShown: true);

await updateManager.DownloadReleases(newUpdateInfo.ReleasesToApply).ConfigureAwait(false);

Expand Down
1 change: 1 addition & 0 deletions Flow.Launcher.Infrastructure/UserSettings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ public bool KeepMaxResults

public bool DontPromptUpdateMsg { get; set; }
public bool EnableUpdateLog { get; set; }
public bool EnableSuccessNotification { get; set; } = true;
Comment thread
Jack251970 marked this conversation as resolved.

public bool StartFlowLauncherOnSystemStartup { get; set; } = false;
public bool UseLogonTaskForStartup { get; set; } = false;
Expand Down
11 changes: 10 additions & 1 deletion Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@ public interface IPublicAPI
/// <param name="useMainWindowAsOwner">when true will use main windows as the owner</param>
void ShowMsg(string title, string subTitle, string iconPath, bool useMainWindowAsOwner = true);

/// <summary>
/// Show message box
/// </summary>
/// <param name="title">Message title</param>
/// <param name="subTitle">Message subtitle</param>
/// <param name="iconPath">Message icon path (relative path to your plugin folder)</param>
/// <param name="useMainWindowAsOwner">when true will use main windows as the owner</param>
/// <param name="forceShown">when true will force the message to be shown regardless of user settings of `Show more notifications`</param>
Comment thread
Jack251970 marked this conversation as resolved.
void ShowMsg(string title, string subTitle, string iconPath, bool useMainWindowAsOwner = true, bool forceShown = false);

/// <summary>
/// Show message box with button
/// </summary>
Expand All @@ -162,7 +172,6 @@ public interface IPublicAPI
/// </summary>
void OpenSettingDialog();


/// <summary>
/// Open plugin setting window for a specific plugin.
/// Reuses the existing window when that plugin's settings window is already open.
Expand Down
2 changes: 2 additions & 0 deletions Flow.Launcher/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@
<system:String x:Key="hideOnStartupToolTip">Flow Launcher search window is hidden in the tray after starting up.</system:String>
<system:String x:Key="hideNotifyIcon">Hide tray icon</system:String>
<system:String x:Key="hideNotifyIconToolTip">When the icon is hidden from the tray, the Settings menu can be opened by right-clicking on the search window.</system:String>
<system:String x:Key="enableSuccessNotification">Show more notifications</system:String>
<system:String x:Key="enableSuccessNotificationToolTip">Show more notifications after some actions (e.g. copy completed). When disabled, only error and important information notifications are shown.</system:String>
<system:String x:Key="ignoreAccents">Ignore accents when searching</system:String>
<system:String x:Key="ignoreAccentsToolTip">Treat accented and unaccented characters as equivalent.</system:String>
<system:String x:Key="promptIgnoreAccents">Would you like to turn on the option to ignore accents when searching?</system:String>
Expand Down
21 changes: 15 additions & 6 deletions Flow.Launcher/PublicAPIInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class PublicAPIInstance : IPublicAPI, IRemovable
private Updater _updater;
private Updater Updater => _updater ??= Ioc.Default.GetRequiredService<Updater>();

private readonly object _saveSettingsLock = new();
private readonly Lock _saveSettingsLock = new();

#region Constructor

Expand Down Expand Up @@ -119,21 +119,30 @@ public void SaveAppAllSettings()
public Task ReloadAllPluginData() => PluginManager.ReloadDataAsync();

public void ShowMsgError(string title, string subTitle = "") =>
ShowMsg(title, subTitle, Constant.ErrorIcon, true);
ShowMsg(title, subTitle, Constant.ErrorIcon, useMainWindowAsOwner: true, forceShown:true);

public void ShowMsgErrorWithButton(string title, string buttonText, Action buttonAction, string subTitle = "") =>
ShowMsgWithButton(title, buttonText, buttonAction, subTitle, Constant.ErrorIcon, true);
ShowMsgWithButton(title, buttonText, buttonAction, subTitle, Constant.ErrorIcon, useMainWindowAsOwner: true);

public void ShowMsg(string title, string subTitle = "", string iconPath = "") =>
ShowMsg(title, subTitle, iconPath, true);
ShowMsg(title, subTitle, iconPath, useMainWindowAsOwner:true, forceShown:false);

public void ShowMsg(string title, string subTitle, string iconPath, bool useMainWindowAsOwner = true)
public void ShowMsg(string title, string subTitle, string iconPath, bool useMainWindowAsOwner = true) =>
ShowMsg(title, subTitle, iconPath, useMainWindowAsOwner: true, forceShown: false);
Comment thread
Jack251970 marked this conversation as resolved.

public void ShowMsg(string title, string subTitle, string iconPath, bool useMainWindowAsOwner = true, bool forceShown = false)
{
if (!forceShown && !_settings.EnableSuccessNotification &&
!string.Equals(iconPath, Constant.ErrorIcon, StringComparison.OrdinalIgnoreCase))
{
return;
}

Notification.Show(title, subTitle, iconPath);
}
Comment thread
Jack251970 marked this conversation as resolved.

public void ShowMsgWithButton(string title, string buttonText, Action buttonAction, string subTitle = "", string iconPath = "") =>
ShowMsgWithButton(title, buttonText, buttonAction, subTitle, iconPath, true);
ShowMsgWithButton(title, buttonText, buttonAction, subTitle, iconPath, useMainWindowAsOwner: true);

public void ShowMsgWithButton(string title, string buttonText, Action buttonAction, string subTitle, string iconPath, bool useMainWindowAsOwner = true)
{
Expand Down
14 changes: 14 additions & 0 deletions Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,20 @@
OnContent="{DynamicResource enable}" />
</ui:SettingsCard>

<ui:SettingsCard
Margin="0 14 0 0"
Description="{DynamicResource enableSuccessNotificationToolTip}"
Header="{DynamicResource enableSuccessNotification}">
<ui:SettingsCard.HeaderIcon>
<ui:FontIcon Glyph="&#xE91C;" />
</ui:SettingsCard.HeaderIcon>

<ui:ToggleSwitch
IsOn="{Binding Settings.EnableSuccessNotification}"
OffContent="{DynamicResource disable}"
OnContent="{DynamicResource enable}" />
</ui:SettingsCard>
Comment thread
Jack251970 marked this conversation as resolved.

<ui:SettingsCard
Margin="0 14 0 0"
Description="{DynamicResource showAtTopmostToolTip}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public static async Task<string> PromptDownloadIfNotInstallAsync(string installe
}

api.ShowMsg(Localize.flowlauncher_plugin_everything_installing_title(),
Localize.flowlauncher_plugin_everything_installing_subtitle(), "", useMainWindowAsOwner: false);
Localize.flowlauncher_plugin_everything_installing_subtitle(), iconPath: "", forceShown: true);

await DroplexPackage.Drop(App.Everything1_4_1_1009).ConfigureAwait(false);

api.ShowMsg(Localize.flowlauncher_plugin_everything_installing_title(),
Localize.flowlauncher_plugin_everything_installationsuccess_subtitle(), "", useMainWindowAsOwner: false);
Localize.flowlauncher_plugin_everything_installationsuccess_subtitle(), iconPath: "", forceShown: true);
Comment thread
Jack251970 marked this conversation as resolved.

installedLocation = "C:\\Program Files\\Everything\\Everything.exe";

Expand Down
30 changes: 22 additions & 8 deletions Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ internal async Task InstallOrUpdateAsync(UserPlugin plugin)
return;
}

Context.API.ShowMsg(Context.API.GetTranslation("plugin_pluginsmanager_update_alreadyexists"));
Context.API.ShowMsgError(Context.API.GetTranslation("plugin_pluginsmanager_update_alreadyexists"));
return;
}

Expand Down Expand Up @@ -194,14 +194,18 @@ await DownloadFileAsync(
{
Context.API.ShowMsg(Context.API.GetTranslation("plugin_pluginsmanager_installing_plugin"),
string.Format(Context.API.GetTranslation("plugin_pluginsmanager_install_success_restart"),
plugin.Name));
plugin.Name),
iconPath: "",
forceShown: true);
Context.API.RestartApp();
}
else
{
Context.API.ShowMsg(Context.API.GetTranslation("plugin_pluginsmanager_installing_plugin"),
string.Format(Context.API.GetTranslation("plugin_pluginsmanager_install_success_no_restart"),
plugin.Name));
plugin.Name),
iconPath: "",
forceShown: true);
}
}

Expand Down Expand Up @@ -383,7 +387,9 @@ await DownloadFileAsync(
string.Format(
Context.API.GetTranslation(
"plugin_pluginsmanager_update_success_restart"),
x.Name));
x.Name),
iconPath: "",
forceShown: true);
Context.API.RestartApp();
}
else
Expand All @@ -393,7 +399,9 @@ await DownloadFileAsync(
string.Format(
Context.API.GetTranslation(
"plugin_pluginsmanager_update_success_no_restart"),
x.Name));
x.Name),
iconPath: "",
forceShown: true);
}
}
}
Expand Down Expand Up @@ -510,15 +518,19 @@ await DownloadFileAsync(
Context.API.ShowMsg(Context.API.GetTranslation("plugin_pluginsmanager_update_title"),
string.Format(
Context.API.GetTranslation("plugin_pluginsmanager_update_all_success_restart"),
resultsForUpdate.Count));
resultsForUpdate.Count),
iconPath: "",
forceShown: true);
Context.API.RestartApp();
}
else
{
Context.API.ShowMsg(Context.API.GetTranslation("plugin_pluginsmanager_update_title"),
string.Format(
Context.API.GetTranslation("plugin_pluginsmanager_update_all_success_no_restart"),
resultsForUpdate.Count));
resultsForUpdate.Count),
iconPath: "",
forceShown: true);
}

return true;
Expand Down Expand Up @@ -809,7 +821,9 @@ internal List<Result> RequestUninstall(string search)
string.Format(
Context.API.GetTranslation(
"plugin_pluginsmanager_uninstall_success_no_restart"),
x.Metadata.Name));
x.Metadata.Name),
iconPath: "",
forceShown: true);
}

return true;
Expand Down