[Updates] Toast notification for new updates: Add setting (#30794)

* code changes from #30606

* Update admx revision
This commit is contained in:
Heiko
2024-01-19 16:18:05 +01:00
committed by GitHub
parent f971f3d968
commit d7c7711518
13 changed files with 100 additions and 5 deletions

View File

@@ -198,6 +198,19 @@
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.ShowWhatsNewAfterUpdatesIsGpoDisabled}"
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.ShowWhatsNewAfterUpdatesIsGpoDisabled}"
Severity="Informational" />
<tkcontrols:SettingsCard
x:Uid="GeneralPage_ToggleSwitch_ShowNewUpdatesToast"
Margin="0,-6,0,0"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsNewUpdatesToastDisabledGpoConfigured, Converter={StaticResource BoolNegationConverter}}">
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{Binding Mode=TwoWay, Path=ShowNewUpdatesToastNotification}" />
</tkcontrols:SettingsCard>
<InfoBar
x:Uid="GPO_IsSettingForced"
IsClosable="False"
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsNewUpdatesToastDisabledGpoConfigured}"
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsNewUpdatesToastDisabledGpoConfigured}"
Severity="Informational" />
</controls:SettingsGroup>
<controls:SettingsGroup x:Uid="Admin_Mode">

View File

@@ -4017,4 +4017,10 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="CmdNotFound_Arm64ArchBar.Title" xml:space="preserve">
<value>Command Not Found is not supported on the ARM64 architecture currently. We are actively working on a solution.</value>
</data>
</root>
<data name="GeneralPage_ToggleSwitch_ShowNewUpdatesToast.Description" xml:space="preserve">
<value>Notifications in the settings and the tray flyout are always shown</value>
</data>
<data name="GeneralPage_ToggleSwitch_ShowNewUpdatesToast.Header" xml:space="preserve">
<value>Show notifications for new updates</value>
</data>
</root>

View File

@@ -121,6 +121,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
_startup = GeneralSettingsConfig.Startup;
_showNewUpdatesToastNotification = GeneralSettingsConfig.ShowNewUpdatesToastNotification;
_autoDownloadUpdates = GeneralSettingsConfig.AutoDownloadUpdates;
_showWhatsNewAfterUpdates = GeneralSettingsConfig.ShowWhatsNewAfterUpdates;
_enableExperimentation = GeneralSettingsConfig.EnableExperimentation;
@@ -139,8 +140,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
_newAvailableVersionLink = UpdatingSettingsConfig.ReleasePageLink;
_updateCheckedDate = UpdatingSettingsConfig.LastCheckedDateLocalized;
_experimentationIsGpoDisallowed = GPOWrapper.GetAllowExperimentationValue() == GpoRuleConfigured.Disabled;
_newUpdatesToastIsGpoDisabled = GPOWrapper.GetDisableNewUpdateToastValue() == GpoRuleConfigured.Enabled;
_autoDownloadUpdatesIsGpoDisabled = GPOWrapper.GetDisableAutomaticUpdateDownloadValue() == GpoRuleConfigured.Enabled;
_experimentationIsGpoDisallowed = GPOWrapper.GetAllowExperimentationValue() == GpoRuleConfigured.Disabled;
_showWhatsNewAfterUpdatesIsGpoDisabled = GPOWrapper.GetDisableShowWhatsNewAfterUpdatesValue() == GpoRuleConfigured.Enabled;
if (dispatcherAction != null)
@@ -156,6 +158,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private bool _enableWarningsElevatedApps;
private int _themeIndex;
private bool _showNewUpdatesToastNotification;
private bool _newUpdatesToastIsGpoDisabled;
private bool _autoDownloadUpdates;
private bool _autoDownloadUpdatesIsGpoDisabled;
private bool _showWhatsNewAfterUpdates;
@@ -303,6 +307,29 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
public bool ShowNewUpdatesToastNotification
{
get
{
return _showNewUpdatesToastNotification && !_newUpdatesToastIsGpoDisabled;
}
set
{
if (_showNewUpdatesToastNotification != value)
{
_showNewUpdatesToastNotification = value;
GeneralSettingsConfig.ShowNewUpdatesToastNotification = value;
NotifyPropertyChanged();
}
}
}
public bool IsNewUpdatesToastDisabledGpoConfigured
{
get => _newUpdatesToastIsGpoDisabled;
}
public bool AutoDownloadUpdates
{
get