Skip to content
Open
Show file tree
Hide file tree
Changes from 6 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
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
3 changes: 2 additions & 1 deletion Flow.Launcher.Infrastructure/UserSettings/Settings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text.Json.Serialization;
using System.Windows;
Expand Down Expand Up @@ -462,6 +462,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.
Outdated
Comment thread
Jack251970 marked this conversation as resolved.
Outdated
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>
Comment thread
Jack251970 marked this conversation as resolved.
Outdated
<system:String x:Key="querySearchPrecision">Query Search Precision</system:String>
<system:String x:Key="querySearchPrecisionToolTip">Changes minimum match score required for results.</system:String>
<system:String x:Key="SearchPrecisionNone">None</system:String>
Expand Down
23 changes: 16 additions & 7 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,24 +119,33 @@ 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, 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);
Comment thread
Jack251970 marked this conversation as resolved.
Outdated

public void ShowMsg(string title, string subTitle = "", string iconPath = "") =>
ShowMsg(title, subTitle, iconPath, true);
ShowMsg(title, subTitle, iconPath);
Comment thread
Jack251970 marked this conversation as resolved.
Outdated

Comment on lines +122 to 129

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have useMainWindowAsOwner default as true in the method, you don't need to pass it again right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, this is for the issue of function overloading? And I think it is more clear to provide this parameter here

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:useMainWindowAsOwner);
Comment thread
Jack251970 marked this conversation as resolved.
Outdated

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);
Comment thread
Jack251970 marked this conversation as resolved.
Outdated

public void ShowMsgWithButton(string title, string buttonText, Action buttonAction, string subTitle, string iconPath, bool useMainWindowAsOwner = true)
{
{
Notification.ShowWithButton(title, buttonText, buttonAction, subTitle, iconPath);
}

Expand Down
10 changes: 10 additions & 0 deletions Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@
OnContent="{DynamicResource enable}" />
</ui:SettingsCard>

<ui:SettingsCard
Margin="0 4 0 0"
Description="{DynamicResource enableSuccessNotificationToolTip}"
Header="{DynamicResource enableSuccessNotification}">
<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);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This no longer sets useMainWindowAsOwner and uses the default value (true) set by the new method, is this change in behaviour correct?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed


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.
Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This no longer sets useMainWindowAsOwner and uses the default value (true) set by the new method, is this change in behaviour correct?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed


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

Expand Down
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
Loading