diff --git a/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml b/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml index 4976573af..4fe7d4c68 100644 --- a/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml +++ b/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml @@ -49,6 +49,38 @@ AutomationId="{Binding AutomationIdSettingStatus}" /> + + + + + + + + + @@ -107,6 +139,7 @@ x:Key="listItemDataTemplateSelector" HeaderTemplate="{StaticResource headerTemplate}" RegularTemplate="{StaticResource regularTemplate}" + RegularWithDescriptionTemplate="{StaticResource regularWithDescriptionTemplate}" TimePickerTemplate="{StaticResource timePickerTemplate}" /> diff --git a/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml.cs b/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml.cs index 47a8a22c4..522f37959 100644 --- a/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml.cs +++ b/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml.cs @@ -64,7 +64,7 @@ namespace Bit.App.Pages private void RowSelected(object sender, SelectionChangedEventArgs e) { ((ExtendedCollectionView)sender).SelectedItem = null; - if (e.CurrentSelection?.FirstOrDefault() is SettingsPageListItem item) + if (e.CurrentSelection?.FirstOrDefault() is SettingsPageListItem item && item.Enabled) { _vm?.ExecuteSettingItemCommand.Execute(item); } diff --git a/src/App/Pages/Settings/SettingsPage/SettingsPageListItem.cs b/src/App/Pages/Settings/SettingsPage/SettingsPageListItem.cs index e2b2b0295..4d5708acb 100644 --- a/src/App/Pages/Settings/SettingsPage/SettingsPageListItem.cs +++ b/src/App/Pages/Settings/SettingsPage/SettingsPageListItem.cs @@ -13,8 +13,10 @@ namespace Bit.App.Pages public string Icon { get; set; } public string Name { get; set; } public string SubLabel { get; set; } + public string Description { get; set; } public TimeSpan? Time { get; set; } public bool UseFrame { get; set; } + public bool Enabled { get; set; } = true; public Func ExecuteAsync { get; set; } public bool SubLabelTextEnabled => SubLabel == AppResources.On; @@ -24,6 +26,9 @@ namespace Bit.App.Pages public Color SubLabelColor => SubLabelTextEnabled ? ThemeManager.GetResourceColor("SuccessColor") : ThemeManager.GetResourceColor("MutedColor"); + public Color NameColor => Enabled ? + ThemeManager.GetResourceColor("TextColor") : + ThemeManager.GetResourceColor("MutedColor"); public string AutomationIdSettingName { diff --git a/src/App/Pages/Settings/SettingsPage/SettingsPageListItemSelector.cs b/src/App/Pages/Settings/SettingsPage/SettingsPageListItemSelector.cs index 74dae3f2d..c7a37a5f9 100644 --- a/src/App/Pages/Settings/SettingsPage/SettingsPageListItemSelector.cs +++ b/src/App/Pages/Settings/SettingsPage/SettingsPageListItemSelector.cs @@ -7,6 +7,7 @@ namespace Bit.App.Pages public DataTemplate HeaderTemplate { get; set; } public DataTemplate RegularTemplate { get; set; } public DataTemplate TimePickerTemplate { get; set; } + public DataTemplate RegularWithDescriptionTemplate { get; set; } protected override DataTemplate OnSelectTemplate(object item, BindableObject container) { @@ -16,6 +17,10 @@ namespace Bit.App.Pages } if (item is SettingsPageListItem listItem) { + if (!string.IsNullOrEmpty(listItem.Description)) + { + return RegularWithDescriptionTemplate; + } return listItem.ShowTimeInput ? TimePickerTemplate : RegularTemplate; } return null; diff --git a/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs b/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs index 4019c43c0..9fb2c3bc3 100644 --- a/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs +++ b/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs @@ -567,6 +567,8 @@ namespace Bit.App.Pages { Name = AppResources.VaultTimeoutAction, SubLabel = _vaultTimeoutActionDisplayValue, + Description = IsVaultTimeoutActionLockAllowed ? null : AppResources.SetUpAnUnlockMethodToChangeYourVaultTimeoutAction, + Enabled = IsVaultTimeoutActionLockAllowed, ExecuteAsync = () => VaultTimeoutActionAsync() }, new SettingsPageListItem @@ -582,16 +584,19 @@ namespace Bit.App.Pages ExecuteAsync = () => ApproveLoginRequestsAsync() }, new SettingsPageListItem - { - Name = AppResources.LockNow, - ExecuteAsync = () => LockAsync() - }, - new SettingsPageListItem { Name = AppResources.TwoStepLogin, ExecuteAsync = () => TwoStepAsync() } }; + if (IsVaultTimeoutActionLockAllowed) + { + securityItems.Insert(4, new SettingsPageListItem + { + Name = AppResources.LockNow, + ExecuteAsync = () => LockAsync() + }); + } if (_approvePasswordlessLoginRequests) { manageItems.Add(new SettingsPageListItem diff --git a/src/App/Resources/AppResources.Designer.cs b/src/App/Resources/AppResources.Designer.cs index 023e47c93..7484ab877 100644 --- a/src/App/Resources/AppResources.Designer.cs +++ b/src/App/Resources/AppResources.Designer.cs @@ -418,6 +418,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to addy.io. + /// + public static string AddyIo { + get { + return ResourceManager.GetString("AddyIo", resourceCulture); + } + } + /// /// Looks up a localized string similar to Admin approval requested. /// @@ -508,15 +517,6 @@ namespace Bit.App.Resources { } } - /// - /// Looks up a localized string similar to addy.io. - /// - public static string AddyIo { - get { - return ResourceManager.GetString("AddyIo", resourceCulture); - } - } - /// /// Looks up a localized string similar to A notification has been sent to your device.. /// @@ -6002,6 +6002,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Set up an unlock method to change your vault timeout action.. + /// + public static string SetUpAnUnlockMethodToChangeYourVaultTimeoutAction { + get { + return ResourceManager.GetString("SetUpAnUnlockMethodToChangeYourVaultTimeoutAction", resourceCulture); + } + } + /// /// Looks up a localized string similar to Set up TOTP. /// @@ -6751,7 +6760,7 @@ namespace Bit.App.Resources { } /// - /// Looks up a localized string similar to Unlocking may fail due to insufficient memory. Decrease your KDF memory settings to resolve.. + /// Looks up a localized string similar to Unlocking may fail due to insufficient memory. Decrease your KDF memory settings or set up biometric unlock to resolve.. /// public static string UnlockingMayFailDueToInsufficientMemoryDecreaseYourKDFMemorySettingsToResolve { get { diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx index b983847b6..d7b4df5f9 100644 --- a/src/App/Resources/AppResources.resx +++ b/src/App/Resources/AppResources.resx @@ -2762,4 +2762,7 @@ Do you want to switch to this account? Logging in on + + Set up an unlock method to change your vault timeout action. +