[Settings]Rework update settings in the general tab (#31078)

* changes

* fixes

* improve dev build checks

* improve dev build checks 2

* improve dev build checks 2 fix

* fix Resources.resw

* use itemsheader

* make var bool like before the changes
This commit is contained in:
Heiko
2024-01-26 15:00:11 +01:00
committed by GitHub
parent ddeb856372
commit 400a592a3e
4 changed files with 61 additions and 69 deletions

View File

@@ -59,11 +59,11 @@ If enabled, per-user installation is not allowed.
If disabled or not configured, per-user installation is allowed. If disabled or not configured, per-user installation is allowed.
</string> </string>
<string id="DisableAutomaticUpdateDownloadDescription">This policy configures whether automatic downloads of available updates are disabled or not. (On metered connections updates are never downloaded.) <string id="DisableAutomaticUpdateDownloadDescription">This policy configures whether the automatic download and installation of available updates is disabled or not. (On metered connections updates are never downloaded.)
If enabled, automatic downloads are disabled. If enabled, automatic download and installation is disabled.
If disabled or not configured, the user is in control of automatic downloads setting. If disabled or not configured, the user can control this in the settings.
</string> </string>
<string id="SuspendNewUpdateToastDescription">This policy configures whether the action center notification for new updates is suspended for 2 minor releases. (Example: if the installed version is v0.60.0, then the next notification is shown for the v0.63.* release.) <string id="SuspendNewUpdateToastDescription">This policy configures whether the action center notification for new updates is suspended for 2 minor releases. (Example: if the installed version is v0.60.0, then the next notification is shown for the v0.63.* release.)

View File

@@ -19,7 +19,7 @@
<controls:SettingsPageControl x:Uid="General" ModuleImageSource="ms-appx:///Assets/Settings/Modules/PT.png"> <controls:SettingsPageControl x:Uid="General" ModuleImageSource="ms-appx:///Assets/Settings/Modules/PT.png">
<controls:SettingsPageControl.ModuleContent> <controls:SettingsPageControl.ModuleContent>
<StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}" Orientation="Vertical"> <StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}" Orientation="Vertical">
<controls:SettingsGroup x:Uid="General_Version" Margin="0,-32,0,0"> <controls:SettingsGroup x:Uid="General_VersionAndUpdate" Margin="0,-32,0,0">
<tkcontrols:SettingsCard Header="{x:Bind ViewModel.PowerToysVersion, Mode=OneWay}" HeaderIcon="{ui:FontIcon Glyph=&#xE895;}"> <tkcontrols:SettingsCard Header="{x:Bind ViewModel.PowerToysVersion, Mode=OneWay}" HeaderIcon="{ui:FontIcon Glyph=&#xE895;}">
<tkcontrols:SettingsCard.Description> <tkcontrols:SettingsCard.Description>
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical">
@@ -175,42 +175,34 @@
</InfoBar.ActionButton> </InfoBar.ActionButton>
</InfoBar> </InfoBar>
<tkcontrols:SettingsCard <tkcontrols:SettingsExpander
x:Uid="GeneralPage_ToggleSwitch_AutoDownloadUpdates" x:Uid="General_UpdateSettings"
Margin="0,-6,0,0" Margin="0,-6,0,0"
IsEnabled="{x:Bind ViewModel.IsAutoDownloadUpdatesCardEnabled, Mode=OneWay}" HeaderIcon="{ui:FontIcon Glyph=&#xE713;}"
Visibility="{x:Bind ViewModel.IsAdmin, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}"> IsExpanded="True">
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.AutoDownloadUpdates, Mode=TwoWay}" /> <tkcontrols:SettingsExpander.ItemsHeader>
</tkcontrols:SettingsCard> <InfoBar
<InfoBar x:Uid="GPO_SomeSettingsAreManaged"
x:Uid="GPO_SettingIsManaged" IsClosable="False"
IsClosable="False" IsOpen="{x:Bind ViewModel.SomeUpdateSettingsAreGpoManaged, Mode=OneWay}"
IsOpen="{x:Bind ViewModel.ShowAutoDownloadUpdatesGpoInformation, Mode=OneWay}" IsTabStop="{x:Bind ViewModel.SomeUpdateSettingsAreGpoManaged, Mode=OneWay}"
IsTabStop="{x:Bind ViewModel.ShowAutoDownloadUpdatesGpoInformation, Mode=OneWay}" Severity="Informational" />
Severity="Informational" /> </tkcontrols:SettingsExpander.ItemsHeader>
<tkcontrols:SettingsExpander.Items>
<tkcontrols:SettingsCard x:Uid="GeneralPage_ToggleSwitch_ShowWhatsNewAfterUpdates" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.ShowWhatsNewAfterUpdatesIsGpoDisabled, Converter={StaticResource BoolNegationConverter}}"> <tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsShowNewUpdatesToastNotificationCardEnabled}">
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{Binding Mode=TwoWay, Path=ShowWhatsNewAfterUpdates}" /> <controls:CheckBoxWithDescriptionControl x:Uid="GeneralPage_ShowNewUpdatesToast" IsChecked="{Binding Mode=TwoWay, Path=ShowNewUpdatesToastNotification}" />
</tkcontrols:SettingsCard> </tkcontrols:SettingsCard>
<InfoBar <tkcontrols:SettingsCard
x:Uid="GPO_SettingIsManaged" ContentAlignment="Left"
IsClosable="False" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsAutoDownloadUpdatesCardEnabled}"
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.ShowWhatsNewAfterUpdatesIsGpoDisabled}" Visibility="{x:Bind ViewModel.IsAdmin, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}">
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.ShowWhatsNewAfterUpdatesIsGpoDisabled}" <controls:CheckBoxWithDescriptionControl x:Uid="GeneralPage_AutoDownloadAndInstallUpdates" IsChecked="{Binding Mode=TwoWay, Path=AutoDownloadUpdates}" />
Severity="Informational" /> </tkcontrols:SettingsCard>
<tkcontrols:SettingsCard ContentAlignment="Left" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsShowWhatsNewAfterUpdatesCardEnabled}">
<tkcontrols:SettingsCard <controls:CheckBoxWithDescriptionControl x:Uid="GeneralPage_ShowWhatsNewAfterUpdates" IsChecked="{Binding Mode=TwoWay, Path=ShowWhatsNewAfterUpdates}" />
x:Uid="GeneralPage_ToggleSwitch_ShowNewUpdatesToast" </tkcontrols:SettingsCard>
Margin="0,-6,0,0" </tkcontrols:SettingsExpander.Items>
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsNewUpdatesToastDisabledGpoConfigured, Converter={StaticResource BoolNegationConverter}}"> </tkcontrols:SettingsExpander>
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{Binding Mode=TwoWay, Path=ShowNewUpdatesToastNotification}" />
</tkcontrols:SettingsCard>
<InfoBar
x:Uid="GPO_SettingIsManaged"
IsClosable="False"
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsNewUpdatesToastDisabledGpoConfigured}"
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsNewUpdatesToastDisabledGpoConfigured}"
Severity="Informational" />
</controls:SettingsGroup> </controls:SettingsGroup>
<controls:SettingsGroup x:Uid="Admin_Mode"> <controls:SettingsGroup x:Uid="Admin_Mode">

View File

@@ -1386,10 +1386,10 @@
<data name="GeneralPage_ToggleSwitch_AlwaysRunElevated_Link.Content" xml:space="preserve"> <data name="GeneralPage_ToggleSwitch_AlwaysRunElevated_Link.Content" xml:space="preserve">
<value>Learn more about administrator mode</value> <value>Learn more about administrator mode</value>
</data> </data>
<data name="GeneralPage_ToggleSwitch_AutoDownloadUpdates.Header" xml:space="preserve"> <data name="GeneralPage_AutoDownloadAndInstallUpdates.Header" xml:space="preserve">
<value>Download updates automatically</value> <value>Download and install updates automatically</value>
</data> </data>
<data name="GeneralPage_ToggleSwitch_AutoDownloadUpdates.Description" xml:space="preserve"> <data name="GeneralPage_AutoDownloadAndInstallUpdates.Description" xml:space="preserve">
<value>Except on metered connections</value> <value>Except on metered connections</value>
</data> </data>
<data name="GeneralPage_ToggleSwitch_RunningAsAdminNote.Text" xml:space="preserve"> <data name="GeneralPage_ToggleSwitch_RunningAsAdminNote.Text" xml:space="preserve">
@@ -1449,8 +1449,8 @@
<data name="General_Repository.Text" xml:space="preserve"> <data name="General_Repository.Text" xml:space="preserve">
<value>GitHub repository</value> <value>GitHub repository</value>
</data> </data>
<data name="General_Version.Header" xml:space="preserve"> <data name="General_VersionAndUpdate.Header" xml:space="preserve">
<value>Version</value> <value>Version &amp; updates</value>
</data> </data>
<data name="General_VersionLastChecked.Text" xml:space="preserve"> <data name="General_VersionLastChecked.Text" xml:space="preserve">
<value>Last checked: </value> <value>Last checked: </value>
@@ -1467,8 +1467,8 @@
<data name="General_SettingsBackupInfo_StatusHeader.Text" xml:space="preserve"> <data name="General_SettingsBackupInfo_StatusHeader.Text" xml:space="preserve">
<value>Status:</value> <value>Status:</value>
</data> </data>
<data name="General_Version.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve"> <data name="General_VersionAndUpdate.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Version</value> <value>Version and updates</value>
</data> </data>
<data name="Admin_mode.Header" xml:space="preserve"> <data name="Admin_mode.Header" xml:space="preserve">
<value>Administrator mode</value> <value>Administrator mode</value>
@@ -3960,9 +3960,6 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="Shell_Dashboard.Content" xml:space="preserve"> <data name="Shell_Dashboard.Content" xml:space="preserve">
<value>Dashboard</value> <value>Dashboard</value>
</data> </data>
<data name="GPO_SomeSettingsAreManaged.Title" xml:space="preserve">
<value>Some settings are managed by your organization.</value>
</data>
<data name="DisabledModules.Text" xml:space="preserve"> <data name="DisabledModules.Text" xml:space="preserve">
<value>Disabled modules</value> <value>Disabled modules</value>
</data> </data>
@@ -4005,7 +4002,7 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="PowerLauncher_TextFontSizeSlider.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve"> <data name="PowerLauncher_TextFontSizeSlider.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Text size of result titles</value> <value>Text size of result titles</value>
</data> </data>
<data name="GeneralPage_ToggleSwitch_ShowWhatsNewAfterUpdates.Header" xml:space="preserve"> <data name="GeneralPage_ShowWhatsNewAfterUpdates.Header" xml:space="preserve">
<value>Show the release notes after updates</value> <value>Show the release notes after updates</value>
</data> </data>
<data name="CmdNotFound_Arm64ArchBar.Title" xml:space="preserve"> <data name="CmdNotFound_Arm64ArchBar.Title" xml:space="preserve">
@@ -4015,12 +4012,18 @@ Activate by holding the key for the character you want to add an accent to, then
<value>Do not activate when Game Mode is on</value> <value>Do not activate when Game Mode is on</value>
<comment>"Game mode" is the Windows feature to prevent notification when playing a game.</comment> <comment>"Game mode" is the Windows feature to prevent notification when playing a game.</comment>
</data> </data>
<data name="GeneralPage_ToggleSwitch_ShowNewUpdatesToast.Description" xml:space="preserve"> <data name="GeneralPage_ShowNewUpdatesToast.Description" xml:space="preserve">
<value>Notifications in the settings and the tray flyout are always shown</value> <value>Notifications in the settings and the tray flyout are always shown</value>
</data> </data>
<data name="GeneralPage_ToggleSwitch_ShowNewUpdatesToast.Header" xml:space="preserve"> <data name="GeneralPage_ShowNewUpdatesToast.Header" xml:space="preserve">
<value>Show notifications for new updates</value> <value>Show notifications for new updates</value>
</data> </data>
<data name="General_UpdateSettings.Header" xml:space="preserve">
<value>Update settings</value>
</data>
<data name="GPO_SomeSettingsAreManaged.Title" xml:space="preserve">
<value>Some settings are managed by your organization.</value>
</data>
<data name="GPO_SettingIsManaged_ToolTip.Text" xml:space="preserve"> <data name="GPO_SettingIsManaged_ToolTip.Text" xml:space="preserve">
<value>This setting is managed by your organization.</value> <value>This setting is managed by your organization.</value>
</data> </data>
@@ -4030,4 +4033,4 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="GPO_SomeThumbnailProvidersAreManaged.Title" xml:space="preserve"> <data name="GPO_SomeThumbnailProvidersAreManaged.Title" xml:space="preserve">
<value>The enabled state of some thumbnail handlers is managed by your organization.</value> <value>The enabled state of some thumbnail handlers is managed by your organization.</value>
</data> </data>
</root> </root>

View File

@@ -120,6 +120,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
break; break;
} }
_isDevBuild = Helper.GetProductVersion() == "v0.0.1";
_startup = GeneralSettingsConfig.Startup; _startup = GeneralSettingsConfig.Startup;
_showNewUpdatesToastNotification = GeneralSettingsConfig.ShowNewUpdatesToastNotification; _showNewUpdatesToastNotification = GeneralSettingsConfig.ShowNewUpdatesToastNotification;
_autoDownloadUpdates = GeneralSettingsConfig.AutoDownloadUpdates; _autoDownloadUpdates = GeneralSettingsConfig.AutoDownloadUpdates;
@@ -151,6 +153,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
} }
} }
private static bool _isDevBuild;
private bool _startup; private bool _startup;
private bool _isElevated; private bool _isElevated;
private bool _runElevated; private bool _runElevated;
@@ -298,12 +301,13 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
} }
} }
// Are we running a dev build? (Please note that we verify this in the code that gets the newest version from GitHub too.) public bool SomeUpdateSettingsAreGpoManaged
public static bool AutoUpdatesDisabledOnDevBuild
{ {
get get
{ {
return Helper.GetProductVersion() == "v0.0.1"; return _newUpdatesToastIsGpoDisabled ||
(_isAdmin && _autoDownloadUpdatesIsGpoDisabled) ||
_showWhatsNewAfterUpdatesIsGpoDisabled;
} }
} }
@@ -325,9 +329,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
} }
} }
public bool IsNewUpdatesToastDisabledGpoConfigured public bool IsShowNewUpdatesToastNotificationCardEnabled
{ {
get => _newUpdatesToastIsGpoDisabled; get => !_isDevBuild && !_newUpdatesToastIsGpoDisabled;
} }
public bool AutoDownloadUpdates public bool AutoDownloadUpdates
@@ -350,14 +354,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
public bool IsAutoDownloadUpdatesCardEnabled public bool IsAutoDownloadUpdatesCardEnabled
{ {
get => !AutoUpdatesDisabledOnDevBuild && !_autoDownloadUpdatesIsGpoDisabled; get => !_isDevBuild && !_autoDownloadUpdatesIsGpoDisabled;
}
// The settings card is hidden for users who are not a member of the Administrators group and in this case the GPO info should be hidden too.
// We hide it, because we don't want a normal user to enable the setting. He can't install the updates.
public bool ShowAutoDownloadUpdatesGpoInformation
{
get => _isAdmin && _autoDownloadUpdatesIsGpoDisabled;
} }
public bool ShowWhatsNewAfterUpdates public bool ShowWhatsNewAfterUpdates
@@ -378,9 +375,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
} }
} }
public bool ShowWhatsNewAfterUpdatesIsGpoDisabled public bool IsShowWhatsNewAfterUpdatesCardEnabled
{ {
get => _showWhatsNewAfterUpdatesIsGpoDisabled; get => !_isDevBuild && !_showWhatsNewAfterUpdatesIsGpoDisabled;
} }
public bool EnableExperimentation public bool EnableExperimentation
@@ -744,7 +741,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{ {
get get
{ {
return !AutoUpdatesDisabledOnDevBuild && !IsNewVersionDownloading; return !_isDevBuild && !IsNewVersionDownloading;
} }
} }