Skip to content

Commit c3d9a01

Browse files
authored
Merge pull request #3346 from mrixner/package-manager-notifications
Disable Package Manager Notifications
2 parents 3e6aa7e + 1c16c4f commit c3d9a01

24 files changed

Lines changed: 92 additions & 219 deletions

File tree

src/UniGetUI.Core.Tools/Tools.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
using System.Collections;
22
using System.Diagnostics;
3-
using System.Globalization;
43
using System.Net;
5-
using System.Net.NetworkInformation;
64
using System.Security.Cryptography;
75
using System.Security.Principal;
86
using System.Text;

src/UniGetUI.PackageEngine.Managers.Dotnet/DotNet.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
using System.Diagnostics;
22
using System.Runtime.InteropServices;
3-
using System.Text.Json.Nodes;
43
using System.Text.RegularExpressions;
5-
using UniGetUI.Core.Logging;
64
using UniGetUI.Core.Tools;
75
using UniGetUI.Interface.Enums;
86
using UniGetUI.PackageEngine.Classes.Manager;
9-
using UniGetUI.PackageEngine.Classes.Manager.Classes;
107
using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers;
118
using UniGetUI.PackageEngine.Enums;
129
using UniGetUI.PackageEngine.ManagerClasses.Classes;

src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGet.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Web;
44
using UniGetUI.Core.Classes;
55
using UniGetUI.Core.Data;
6-
using UniGetUI.Core.Logging;
76
using UniGetUI.Core.Tools;
87
using UniGetUI.PackageEngine.Enums;
98
using UniGetUI.PackageEngine.Interfaces;

src/UniGetUI.PackageEngine.Operations/PackageOperations.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private bool RequiresAdminRights()
5656
{
5757
return Package.OverridenOptions.RunAsAdministrator is true
5858
|| Options.RunAsAdministrator
59-
|| (Settings.Get("AlwaysElevate" + Package.Manager.Name) && Package.OverridenOptions.RunAsAdministrator != false);
59+
|| (Settings.GetDictionaryItem<string, bool>("AlwaysElevate", Package.Manager.Name) && Package.OverridenOptions.RunAsAdministrator != false);
6060
}
6161

6262
protected override void ApplyRetryAction(string retryMode)

src/UniGetUI/App.xaml.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Text.RegularExpressions;
33
using Windows.ApplicationModel.Activation;
44
using CommunityToolkit.WinUI.Helpers;
5-
using H.NotifyIcon;
65
using Microsoft.UI.Dispatching;
76
using Microsoft.UI.Xaml;
87
using Microsoft.UI.Xaml.Controls;
@@ -19,7 +18,6 @@
1918
using UniGetUI.Interface.Telemetry;
2019
using UniGetUI.PackageEngine.Interfaces;
2120
using LaunchActivatedEventArgs = Microsoft.UI.Xaml.LaunchActivatedEventArgs;
22-
using UniGetUI.Pages.SettingsPages;
2321

2422
namespace UniGetUI
2523
{

src/UniGetUI/Controls/SettingsWidgets/SettingsPageButton.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using CommunityToolkit.WinUI.Controls;
22
using Microsoft.UI.Xaml;
3-
using Microsoft.UI.Xaml.Controls;
43
using UniGetUI.Core.Tools;
54
using UniGetUI.Interface.Enums;
65

src/UniGetUI/Controls/TranslatedTextBlock.xaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Microsoft.UI.Xaml;
22
using Microsoft.UI.Xaml.Controls;
3-
using Microsoft.UI.Xaml.Media;
43
using UniGetUI.Core.Logging;
54
using UniGetUI.Core.Tools;
65

src/UniGetUI/MainWindow.xaml.cs

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System.Diagnostics;
21
using System.Runtime.InteropServices;
32
using System.Text.RegularExpressions;
43
using System.Web;
@@ -118,8 +117,8 @@ public MainWindow()
118117

119118
_ = AutoUpdater.UpdateCheckLoop(this, UpdatesBanner);
120119

121-
if (!Settings.Get("TransferredOldSettings"))
122-
TransferOldSettingsFormats();
120+
121+
TransferOldSettingsFormats();
123122

124123
Activated += (_, e) =>
125124
{
@@ -177,38 +176,55 @@ private void ClearSubtitle()
177176

178177
private static void TransferOldSettingsFormats()
179178
{
180-
foreach (IPackageManager Manager in PEInterface.Managers)
179+
if (!Settings.Get("TransferredOldSettings"))
181180
{
182-
string SettingName = "Disable" + Manager.Name;
183-
if (Settings.Get(SettingName))
181+
foreach (IPackageManager Manager in PEInterface.Managers)
184182
{
185-
Settings.SetDictionaryItem("DisabledManagers", Manager.Name, true);
186-
Settings.Set(SettingName, false);
183+
string SettingName = "Disable" + Manager.Name;
184+
if (Settings.Get(SettingName))
185+
{
186+
Settings.SetDictionaryItem("DisabledManagers", Manager.Name, true);
187+
Settings.Set(SettingName, false);
188+
}
187189
}
188-
}
189190

190-
// Dependency checks don't need to be transferred, because the worst case scenario is the user has to click the "don't show again" again
191+
// Dependency checks don't need to be transferred, because the worst case scenario is the user has to click the "don't show again" again
191192

192-
foreach (string Page in new[]{ "Discover", "Installed", "Bundles", "Updates"})
193-
{
194-
if (Settings.Get($"HideToggleFilters{Page}Page"))
193+
foreach (string Page in new[]{ "Discover", "Installed", "Bundles", "Updates"})
195194
{
196-
Settings.SetDictionaryItem("HideToggleFilters", Page, true);
197-
Settings.Set($"HideToggleFilters{Page}Page", false);
198-
}
195+
if (Settings.Get($"HideToggleFilters{Page}Page"))
196+
{
197+
Settings.SetDictionaryItem("HideToggleFilters", Page, true);
198+
Settings.Set($"HideToggleFilters{Page}Page", false);
199+
}
199200

200-
if (Settings.Get($"DisableInstantSearch{Page}Tab"))
201-
{
202-
Settings.SetDictionaryItem("DisableInstantSearch", Page, true);
203-
Settings.Set($"DisableInstantSearch{Page}Tab", false);
201+
if (Settings.Get($"DisableInstantSearch{Page}Tab"))
202+
{
203+
Settings.SetDictionaryItem("DisableInstantSearch", Page, true);
204+
Settings.Set($"DisableInstantSearch{Page}Tab", false);
205+
}
206+
207+
if (!int.TryParse(Settings.GetValue($"SidepanelWidth{Page}Page"), out int sidepanelWidth)) sidepanelWidth = 250;
208+
Settings.SetDictionaryItem("SidepanelWidths", Page, sidepanelWidth);
209+
Settings.Set($"SidepanelWidth{Page}Page", false);
204210
}
205211

206-
if (!int.TryParse(Settings.GetValue($"SidepanelWidth{Page}Page"), out int sidepanelWidth)) sidepanelWidth = 250;
207-
Settings.SetDictionaryItem("SidepanelWidths", Page, sidepanelWidth);
208-
Settings.Set($"SidepanelWidth{Page}Page", false);
212+
Settings.Set("TransferredOldSettings", true);
209213
}
210214

211-
Settings.Set("TransferredOldSettings", true);
215+
if (!Settings.Get("TransferredOldSettingsv2"))
216+
{
217+
foreach (IPackageManager Manager in PEInterface.Managers)
218+
{
219+
string SettingName = "AlwaysElevate" + Manager.Name;
220+
if (Settings.Get(SettingName))
221+
{
222+
Settings.SetDictionaryItem("AlwaysElevate", Manager.Name, true);
223+
Settings.Set(SettingName, false);
224+
}
225+
}
226+
Settings.Set("TransferredOldSettingsv2", true);
227+
}
212228
}
213229

214230
public void HandleNotificationActivation(AppNotificationActivatedEventArgs args)

src/UniGetUI/Pages/DialogPages/DesktopShortcuts.xaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using Microsoft.UI.Xaml;
66
using Microsoft.UI.Xaml.Controls;
77
using Microsoft.UI.Xaml.Input;
8-
using UniGetUI.Core.Tools;
98
using UniGetUI.PackageEngine.Classes.Packages.Classes;
109
using UniGetUI.Pages.DialogPages;
1110

src/UniGetUI/Pages/SettingsPages/GeneralPages/Administrator.xaml.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
5-
using System.Runtime.InteropServices.WindowsRuntime;
6-
using Windows.Foundation;
7-
using Windows.Foundation.Collections;
8-
using Microsoft.UI.Xaml;
91
using Microsoft.UI.Xaml.Controls;
10-
using Microsoft.UI.Xaml.Controls.Primitives;
11-
using Microsoft.UI.Xaml.Data;
12-
using Microsoft.UI.Xaml.Input;
13-
using Microsoft.UI.Xaml.Media;
14-
using Microsoft.UI.Xaml.Navigation;
152
using UniGetUI.Core.Tools;
163

174
// To learn more about WinUI, the WinUI project structure,

0 commit comments

Comments
 (0)