Skip to content

Commit e75754d

Browse files
committed
begin redistribution of backup UI
1 parent 4c68014 commit e75754d

5 files changed

Lines changed: 103 additions & 75 deletions

File tree

src/UniGetUI.Core.Settings/SettingsEngine_Names.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public enum K
3939
AlreadyWarnedAboutAdmin,
4040
ShownTelemetryBanner,
4141
CollapseNavMenuOnWideScreen,
42-
EnablePackageBackup,
42+
EnablePackageBackup_LOCAL,
43+
EnablePackageBackup_CLOUD,
4344
ChangeBackupOutputDirectory,
4445
DisableWinGetMalfunctionDetector,
4546
EnableBackupTimestamping,
@@ -127,7 +128,8 @@ public static string ResolveKey(K key)
127128
K.AlreadyWarnedAboutAdmin => "AlreadyWarnedAboutAdmin",
128129
K.ShownTelemetryBanner => "ShownTelemetryBanner",
129130
K.CollapseNavMenuOnWideScreen => "CollapseNavMenuOnWideScreen",
130-
K.EnablePackageBackup => "EnablePackageBackup",
131+
K.EnablePackageBackup_LOCAL => "EnablePackageBackup",
132+
K.EnablePackageBackup_CLOUD => "EnablePackageBackup_CLOUD",
131133
K.ChangeBackupOutputDirectory => "ChangeBackupOutputDirectory",
132134
K.DisableWinGetMalfunctionDetector => "DisableWinGetMalfunctionDetector",
133135
K.EnableBackupTimestamping => "EnableBackupTimestamping",

src/UniGetUI.Interface.Telemetry/TelemetryHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static class TelemetryHandler
4141
Settings.K.DisableAutoCheckforUpdates,
4242
Settings.K.AutomaticallyUpdatePackages,
4343
Settings.K.AskToDeleteNewDesktopShortcuts,
44-
Settings.K.EnablePackageBackup,
44+
Settings.K.EnablePackageBackup_LOCAL,
4545
Settings.K.DoCacheAdminRights,
4646
Settings.K.DoCacheAdminRightsForBatches,
4747
Settings.K.ForceLegacyBundledWinGet,

src/UniGetUI/Pages/SettingsPages/GeneralPages/Backup.xaml

Lines changed: 83 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,7 @@
2727
FontWeight="SemiBold"
2828
Text="Package backup" />
2929

30-
<widgets:CheckboxCard
31-
x:Name="EnablePackageBackupCheckBox"
32-
CornerRadius="8,8,0,0"
33-
SettingName="EnablePackageBackup"
34-
StateChanged="ShowRestartBanner"
35-
Text="Periodically perform a backup of the installed packages" />
36-
<Toolkit:SettingsCard BorderThickness="1,0,1,1" CornerRadius="0,0,8,8">
30+
<Toolkit:SettingsCard CornerRadius="8">
3731
<Toolkit:SettingsCard.Description>
3832
<StackPanel Orientation="Vertical">
3933
<widgets:TranslatedTextBlock Prefix="" Text="The backup will include the complete list of the installed packages and their installation options. Ignored updates and skipped versions will also be saved." />
@@ -44,29 +38,100 @@
4438
</Toolkit:SettingsCard.Description>
4539
</Toolkit:SettingsCard>
4640

47-
<UserControl Height="16" />
4841

42+
<widgets:TranslatedTextBlock
43+
Margin="4,32,4,8"
44+
FontSize="16"
45+
FontWeight="SemiBold"
46+
Text="Cloud package backup" />
47+
48+
<widgets:CheckboxCard
49+
x:Name="EnablePackageBackupCheckBox_CLOUD"
50+
BorderThickness="1,1,1,0"
51+
CornerRadius="8,8,0,0"
52+
SettingName="EnablePackageBackup_CLOUD"
53+
StateChanged="ShowRestartBanner"
54+
Text="Periodically perform a cloud backup of the installed packages">
55+
<widgets:CheckboxCard.Description>
56+
<widgets:TranslatedTextBlock Text="Cloud backup uses a private GitHub Gist to store a list of installed packages" />
57+
</widgets:CheckboxCard.Description>
58+
</widgets:CheckboxCard>
59+
60+
<Toolkit:SettingsCard>
61+
62+
<StackPanel
63+
VerticalAlignment="Center"
64+
Orientation="Horizontal"
65+
Spacing="8">
66+
<TextBlock
67+
x:Name="GitHubUserText"
68+
VerticalAlignment="Center"
69+
Text="Not logged in" />
70+
<Button
71+
x:Name="LoginWithGitHubButton"
72+
Click="LoginWithGitHubButton_Click"
73+
Content="Login with GitHub" />
74+
<Button
75+
x:Name="LogoutGitHubButton"
76+
Click="LogoutGitHubButton_Click"
77+
Content="Logout from GitHub"
78+
Visibility="Collapsed" />
79+
</StackPanel>
80+
</Toolkit:SettingsCard>
81+
82+
<UserControl Height="16" />
4983

5084
<widgets:ButtonCard
51-
x:Name="BackupNowButton"
85+
x:Name="BackupNowButton_Local"
5286
ButtonText="Backup"
53-
Click="DoBackup_Click"
54-
CornerRadius="8"
55-
IsEnabled="{x:Bind EnablePackageBackupCheckBox._checkbox.IsOn, Mode=OneWay}"
56-
Text="Perform a backup now" />
87+
Click="BackupNowButton_Local_Click"
88+
CornerRadius="8,8,0,0"
89+
IsEnabled="{x:Bind EnablePackageBackupCheckBox_CLOUD._checkbox.IsOn, Mode=OneWay}"
90+
Text="Perform a cloud backup now" />
5791

92+
<widgets:ButtonCard
93+
x:Name="RestorePackagesFromGitHubButton"
94+
BorderThickness="1,0,1,1"
95+
ButtonText="Select backup"
96+
Click="RestorePackagesFromGitHubButton_Click"
97+
CornerRadius="0,0,8,8"
98+
Text="Restore a backup from the cloud">
99+
<widgets:ButtonCard.Description>
100+
<widgets:TranslatedTextBlock Text="Begin the process to select a cloud backup and review which packages to restore" />
101+
</widgets:ButtonCard.Description>
102+
</widgets:ButtonCard>
58103

59104
<widgets:TranslatedTextBlock
60105
Margin="4,32,4,8"
106+
FontSize="16"
61107
FontWeight="SemiBold"
62-
Text="Backup location" />
108+
Text="Local package backup" />
109+
110+
<widgets:CheckboxCard
111+
x:Name="EnablePackageBackupCheckBox_LOCAL"
112+
BorderThickness="1,1,1,0"
113+
CornerRadius="8,8,0,0"
114+
SettingName="EnablePackageBackup_LOCAL"
115+
StateChanged="ShowRestartBanner"
116+
Text="Periodically perform a local backup of the installed packages" />
117+
118+
<widgets:ButtonCard
119+
x:Name="BackupNowButton_LOCAL"
120+
ButtonText="Backup"
121+
Click="BackupNowButton_LOCAL_Click_1"
122+
CornerRadius="0,0,8,8"
123+
IsEnabled="{x:Bind EnablePackageBackupCheckBox_LOCAL._checkbox.IsOn, Mode=OneWay}"
124+
Text="Perform a local backup now" />
125+
126+
<UserControl Height="16" />
127+
63128

64129
<widgets:ButtonCard
65130
x:Name="ChangeBackupDirectory"
66131
ButtonText="Select"
67132
Click="ChangeBackupDirectory_Click"
68133
CornerRadius="8"
69-
IsEnabled="{x:Bind EnablePackageBackupCheckBox._checkbox.IsOn, Mode=OneWay}"
134+
IsEnabled="{x:Bind EnablePackageBackupCheckBox_LOCAL._checkbox.IsOn, Mode=OneWay}"
70135
Text="Change backup output directory">
71136
<Toolkit:SettingsCard.Description>
72137
<StackPanel Orientation="Horizontal" Spacing="5">
@@ -80,12 +145,12 @@
80145
<widgets:TranslatedTextBlock
81146
Margin="4,32,4,8"
82147
FontWeight="SemiBold"
83-
Text="Advanced options" />
148+
Text="Local backup advanced options" />
84149

85150
<widgets:TextboxCard
86151
x:Name="ChangeBackupFileNameTextBox"
87152
CornerRadius="8,8,0,0"
88-
IsEnabled="{x:Bind EnablePackageBackupCheckBox._checkbox.IsOn, Mode=OneWay}"
153+
IsEnabled="{x:Bind EnablePackageBackupCheckBox_LOCAL._checkbox.IsOn, Mode=OneWay}"
89154
Placeholder="Leave empty for default"
90155
SettingName="ChangeBackupFileName"
91156
Text="Set a custom backup file name" />
@@ -94,58 +159,9 @@
94159
x:Name="EnableBackupTimestampingCheckBox"
95160
BorderThickness="1,0,1,1"
96161
CornerRadius="0,0,8,8"
97-
IsEnabled="{x:Bind EnablePackageBackupCheckBox._checkbox.IsOn, Mode=OneWay}"
162+
IsEnabled="{x:Bind EnablePackageBackupCheckBox_LOCAL._checkbox.IsOn, Mode=OneWay}"
98163
SettingName="EnableBackupTimestamping"
99164
Text="Add a timestamp to the backup file names" />
100-
101-
<widgets:TranslatedTextBlock
102-
Margin="4,32,4,8"
103-
FontWeight="SemiBold"
104-
Text="Cloud Backup and Restore" />
105-
106-
<StackPanel Orientation="Horizontal" Spacing="8" VerticalAlignment="Center">
107-
<TextBlock x:Name="GitHubUserText" Text="Not logged in" VerticalAlignment="Center"/>
108-
<Button x:Name="LoginWithGitHubButton" Content="Login with GitHub" Click="LoginWithGitHubButton_Click" />
109-
<Button x:Name="LogoutGitHubButton" Content="Logout from GitHub" Click="LogoutGitHubButton_Click" Visibility="Collapsed" />
110-
</StackPanel>
111-
112-
<widgets:ButtonCard
113-
x:Name="BackupToGitHubButton"
114-
ButtonText="Backup settings and packages"
115-
Click="BackupToGitHubButton_Click"
116-
CornerRadius="8,8,0,0"
117-
IsEnabled="False"
118-
Text="Backup your settings and packages to a private GitHub Gist">
119-
<widgets:ButtonCard.Description>
120-
<widgets:TranslatedTextBlock Text="Requires you to be logged in with your GitHub account." />
121-
</widgets:ButtonCard.Description>
122-
</widgets:ButtonCard>
123-
124-
<!--widgets:ButtonCard
125-
x:Name="RestoreSettingsFromGitHubButton"
126-
ButtonText="Restore settings"
127-
Click="RestoreSettingsFromGitHubButton_Click"
128-
CornerRadius="8"
129-
IsEnabled="False"
130-
Text="Restore your settings from a private GitHub Gist">
131-
<widgets:ButtonCard.Description>
132-
<widgets:TranslatedTextBlock Text="This will overwrite your current settings. A restart may be required." />
133-
</widgets:ButtonCard.Description>
134-
</widgets:ButtonCard-->
135-
136-
<widgets:ButtonCard
137-
x:Name="RestorePackagesFromGitHubButton"
138-
ButtonText="Restore packages"
139-
Click="RestorePackagesFromGitHubButton_Click"
140-
CornerRadius="0,0,8,8"
141-
BorderThickness="1,0,1,1"
142-
IsEnabled="False"
143-
Text="Restore your packages from a private GitHub Gist">
144-
<widgets:ButtonCard.Description>
145-
<widgets:TranslatedTextBlock Text="This will install the packages from the backup." />
146-
</widgets:ButtonCard.Description>
147-
</widgets:ButtonCard>
148-
149165
</StackPanel>
150166
</ScrollViewer>
151167
</Page>

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public Backup()
3535
_authService = new GitHubAuthService();
3636
_backupService = new GitHubBackupService(_authService);
3737

38-
EnablePackageBackupUI(Settings.Get(Settings.K.EnablePackageBackup));
38+
EnablePackageBackupUI(Settings.Get(Settings.K.EnablePackageBackup_LOCAL));
3939
ResetBackupDirectory.Content = CoreTools.Translate("Reset");
4040
OpenBackupDirectory.Content = CoreTools.Translate("Open");
4141
UpdateGitHubLoginStatus();
@@ -89,7 +89,7 @@ private async void UpdateBackupToGitHubButtonStatus()
8989
{
9090
UpdateGitHubLoginStatus();
9191
bool isAuthenticated = await _authService.IsAuthenticatedAsync();
92-
BackupToGitHubButton.IsEnabled = isAuthenticated;
92+
// BackupToGitHubButton.IsEnabled = isAuthenticated;
9393
RestorePackagesFromGitHubButton.IsEnabled = isAuthenticated;
9494
}
9595

@@ -144,7 +144,7 @@ private async void RestorePackagesFromGitHubButton_Click(object sender, EventArg
144144

145145
private async void BackupToGitHubButton_Click(object sender, EventArgs e)
146146
{
147-
BackupToGitHubButton.IsEnabled = false;
147+
// BackupToGitHubButton.IsEnabled = false;
148148
DialogHelper.ShowLoadingDialog(CoreTools.Translate("Backing up packages to GitHub Gist..."));
149149

150150
var packagesContent = await InstalledPackagesPage.GenerateBackupContents();
@@ -202,7 +202,7 @@ public void EnablePackageBackupUI(bool enabled)
202202
EnableBackupTimestampingCheckBox.IsEnabled = enabled;
203203
ChangeBackupFileNameTextBox.IsEnabled = enabled;
204204
ChangeBackupDirectory.IsEnabled = enabled;
205-
BackupNowButton.IsEnabled = enabled;
205+
// BackupNowButton.IsEnabled = enabled;
206206

207207
if (enabled)
208208
{
@@ -250,5 +250,15 @@ private async void DoBackup_Click(object sender, EventArgs e)
250250
await InstalledPackagesPage.BackupPackages();
251251
DialogHelper.HideLoadingDialog();
252252
}
253+
254+
private void BackupNowButton_Local_Click(object sender, EventArgs e)
255+
{
256+
257+
}
258+
259+
private void BackupNowButton_LOCAL_Click_1(object sender, EventArgs e)
260+
{
261+
262+
}
253263
}
254264
}

src/UniGetUI/Pages/SoftwarePages/InstalledPackagesPage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ protected override void WhenPackagesLoaded(ReloadReason reason)
286286
{
287287
if (!HasDoneBackup)
288288
{
289-
if (Settings.Get(Settings.K.EnablePackageBackup))
289+
if (Settings.Get(Settings.K.EnablePackageBackup_LOCAL))
290290
{
291291
_ = BackupPackages();
292292
}

0 commit comments

Comments
 (0)