-
-
Notifications
You must be signed in to change notification settings - Fork 610
Add setting to disable non-error notifications & Add related API functions #4429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
b80b4a6
ab854d5
468d52a
28ac929
2ff135d
0eb5e0b
662180b
be7c922
d0a6999
9640686
a907ad1
0e701e9
dc9cb05
ba31c89
f9ac8f9
abbaf5f
8abeac9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
|
||
|
|
@@ -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); | ||
|
|
||
|
Comment on lines
+122
to
129
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you have
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: true, forceShown: false); | ||
|
Jack251970 marked this conversation as resolved.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't this use
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||
|
|
||
| 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); | ||
| } | ||
|
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) | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
| } | ||
|
|
||
|
|
@@ -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); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -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 | ||
|
|
@@ -393,7 +399,9 @@ await DownloadFileAsync( | |
| string.Format( | ||
| Context.API.GetTranslation( | ||
| "plugin_pluginsmanager_update_success_no_restart"), | ||
| x.Name)); | ||
| x.Name), | ||
| iconPath: "", | ||
| forceShown: true); | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -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); | ||
|
Comment on lines
+521
to
+533
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are a lot of
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feel free to change it. I just do not want to change this behaviour |
||
| } | ||
|
|
||
| return true; | ||
|
|
@@ -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; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.