diff --git a/src/UniGetUI.Core.Settings/SettingsEngine.cs b/src/UniGetUI.Core.Settings/SettingsEngine.cs index f74d702b7..51302d9d2 100644 --- a/src/UniGetUI.Core.Settings/SettingsEngine.cs +++ b/src/UniGetUI.Core.Settings/SettingsEngine.cs @@ -1,10 +1,15 @@ -using UniGetUI.Core.Data; +using UniGetUI.Core.Data; using UniGetUI.Core.Logging; namespace UniGetUI.Core.SettingsEngine { public static class Settings { + public static bool AreNotificationsDisabled() + { + return Get("DisableSystemTray") || Get("DisableNotifications"); + } + public static bool Get(string setting, bool invert = false) { return File.Exists(Path.Join(CoreData.UniGetUIDataDirectory, setting)) ^ invert; diff --git a/src/UniGetUI/Interface/SoftwarePages/SoftwareUpdatesPage.cs b/src/UniGetUI/Interface/SoftwarePages/SoftwareUpdatesPage.cs index e36f15d59..7b32b55fe 100644 --- a/src/UniGetUI/Interface/SoftwarePages/SoftwareUpdatesPage.cs +++ b/src/UniGetUI/Interface/SoftwarePages/SoftwareUpdatesPage.cs @@ -373,7 +373,7 @@ protected override void WhenPackagesLoaded(ReloadReason reason) ShowButtons = true; } - if (!(Settings.Get("DisableUpdatesNotifications") || Settings.Get("DisableNotifications"))) + if (!(Settings.Get("DisableUpdatesNotifications") || Settings.AreNotificationsDisabled())) { try { diff --git a/src/UniGetUI/PackageEngine/Operations/PackageOperations.cs b/src/UniGetUI/PackageEngine/Operations/PackageOperations.cs index 559c5b513..c85db5901 100644 --- a/src/UniGetUI/PackageEngine/Operations/PackageOperations.cs +++ b/src/UniGetUI/PackageEngine/Operations/PackageOperations.cs @@ -121,7 +121,7 @@ protected override async Task HandleFailure() Package.SetTag(PackageTag.Failed); - if (!Settings.Get("DisableErrorNotifications") && !Settings.Get("DisableNotifications")) + if (!(Settings.Get("DisableErrorNotifications") || Settings.AreNotificationsDisabled())) { try { @@ -160,7 +160,7 @@ protected override async Task HandleSuccess() Package.SetTag(PackageTag.AlreadyInstalled); PEInterface.InstalledPackagesLoader.AddForeign(Package); - if (!Settings.Get("DisableSuccessNotifications") && !Settings.Get("DisableNotifications")) + if (!Settings.Get("DisableSuccessNotifications") && !Settings.AreNotificationsDisabled()) { try { @@ -238,7 +238,7 @@ protected override async Task HandleFailure() Package.SetTag(PackageTag.Failed); - if (!Settings.Get("DisableErrorNotifications") && !Settings.Get("DisableNotifications")) + if (!Settings.Get("DisableErrorNotifications") && !Settings.AreNotificationsDisabled()) { try { @@ -284,7 +284,7 @@ protected override async Task HandleSuccess() PEInterface.UpgradablePackagesLoader.Remove(Package); - if (!Settings.Get("DisableSuccessNotifications") && !Settings.Get("DisableNotifications")) + if (!Settings.Get("DisableSuccessNotifications") && !Settings.AreNotificationsDisabled()) { try { @@ -366,7 +366,7 @@ protected override async Task HandleFailure() Package.SetTag(PackageTag.Failed); - if (!Settings.Get("DisableErrorNotifications") && !Settings.Get("DisableNotifications")) + if (!Settings.Get("DisableErrorNotifications") && !Settings.AreNotificationsDisabled()) { try { @@ -406,7 +406,7 @@ protected override async Task HandleSuccess() PEInterface.UpgradablePackagesLoader.Remove(Package); PEInterface.InstalledPackagesLoader.Remove(Package); - if (!Settings.Get("DisableSuccessNotifications") && !Settings.Get("DisableNotifications")) + if (!Settings.Get("DisableSuccessNotifications") && !Settings.AreNotificationsDisabled()) { try { diff --git a/src/UniGetUI/PackageEngine/Operations/SourceOperations.cs b/src/UniGetUI/PackageEngine/Operations/SourceOperations.cs index 636e9a79f..0681f2c22 100644 --- a/src/UniGetUI/PackageEngine/Operations/SourceOperations.cs +++ b/src/UniGetUI/PackageEngine/Operations/SourceOperations.cs @@ -66,7 +66,7 @@ protected override OperationVeredict GetProcessVeredict(int ReturnCode, string[] protected override async Task HandleFailure() { LineInfoText = CoreTools.Translate("Could not add source {source} to {manager}", new Dictionary { { "source", Source.Name }, { "manager", Source.Manager.Name } }); - if (!Settings.Get("DisableErrorNotifications") && !Settings.Get("DisableNotifications")) + if (!Settings.Get("DisableErrorNotifications") && !Settings.AreNotificationsDisabled()) { try { @@ -102,7 +102,7 @@ protected override async Task HandleSuccess() { OperationSucceeded?.Invoke(this, EventArgs.Empty); LineInfoText = CoreTools.Translate("The source {source} was added to {manager} successfully", new Dictionary { { "source", Source.Name }, { "manager", Source.Manager.Name } }); - if (!Settings.Get("DisableSuccessNotifications") && !Settings.Get("DisableNotifications")) + if (!Settings.Get("DisableSuccessNotifications") && !Settings.AreNotificationsDisabled()) { try { @@ -177,7 +177,7 @@ protected override OperationVeredict GetProcessVeredict(int ReturnCode, string[] protected override async Task HandleFailure() { LineInfoText = CoreTools.Translate("Could not remove source {source} from {manager}", new Dictionary { { "source", Source.Name }, { "manager", Source.Manager.Name } }); - if (!Settings.Get("DisableErrorNotifications") && !Settings.Get("DisableNotifications")) + if (!Settings.Get("DisableErrorNotifications") && !Settings.AreNotificationsDisabled()) { new ToastContentBuilder() .AddArgument("action", "OpenUniGetUI") @@ -204,7 +204,7 @@ protected override async Task HandleSuccess() { OperationSucceeded?.Invoke(this, EventArgs.Empty); LineInfoText = CoreTools.Translate("The source {source} was removed from {manager} successfully", new Dictionary { { "source", Source.Name }, { "manager", Source.Manager.Name } }); - if (!Settings.Get("DisableSuccessNotifications") && !Settings.Get("DisableNotifications")) + if (!Settings.Get("DisableSuccessNotifications") && !Settings.AreNotificationsDisabled()) { try {