mirror of
https://github.com/bitwarden/mobile
synced 2025-12-16 16:23:29 +00:00
Merge branch 'master' into feature/maui-migration
Fixed conflicts # Conflicts: # src/App/Resources/AppResources.cs.Designer.cs # src/App/Resources/AppResources.da.Designer.cs # src/App/Resources/AppResources.de.Designer.cs # src/App/Resources/AppResources.es.Designer.cs # src/App/Resources/AppResources.fi.Designer.cs # src/App/Resources/AppResources.fr.Designer.cs # src/App/Resources/AppResources.hi.Designer.cs # src/App/Resources/AppResources.hr.Designer.cs # src/App/Resources/AppResources.hu.Designer.cs # src/App/Resources/AppResources.id.Designer.cs # src/App/Resources/AppResources.it.Designer.cs # src/App/Resources/AppResources.ja.Designer.cs # src/App/Resources/AppResources.nl.Designer.cs # src/App/Resources/AppResources.pl.Designer.cs # src/App/Resources/AppResources.pt-BR.Designer.cs # src/App/Resources/AppResources.pt-PT.Designer.cs # src/App/Resources/AppResources.ro.Designer.cs # src/App/Resources/AppResources.ru.Designer.cs # src/App/Resources/AppResources.sk.Designer.cs # src/App/Resources/AppResources.sv.Designer.cs # src/App/Resources/AppResources.th.Designer.cs # src/App/Resources/AppResources.tr.Designer.cs # src/App/Resources/AppResources.uk.Designer.cs # src/App/Resources/AppResources.vi.Designer.cs # src/App/Resources/AppResources.zh-Hans.Designer.cs # src/App/Resources/AppResources.zh-Hant.Designer.cs # src/Core/Controls/Settings/BaseSettingControlView.cs # src/Core/Pages/Accounts/EnvironmentPageViewModel.cs # src/Core/Pages/Accounts/HomePage.xaml.cs # src/Core/Pages/Accounts/HomePageViewModel.cs # src/Core/Pages/Accounts/SetPasswordPageViewModel.cs # src/Core/Pages/Settings/SecuritySettingsPageViewModel.cs # src/Core/Pages/TabsPage.cs # src/Core/Services/StateMigrationService.cs # src/Core/Utilities/BoolToColorConverter.cs
This commit is contained in:
@@ -70,7 +70,7 @@ namespace Bit.App.Pages
|
||||
_logger,
|
||||
OnVaultTimeoutActionChangingAsync,
|
||||
AppResources.SessionTimeoutAction,
|
||||
() => _inited && !HasVaultTimeoutActionPolicy,
|
||||
() => _inited && !HasVaultTimeoutActionPolicy && IsVaultTimeoutActionLockAllowed,
|
||||
ex => HandleException(ex));
|
||||
|
||||
ToggleUseThisDeviceToApproveLoginRequestsCommand = CreateDefaultAsyncRelayCommand(ToggleUseThisDeviceToApproveLoginRequestsAsync, () => _inited, allowsMultipleExecutions: false);
|
||||
@@ -123,6 +123,7 @@ namespace Bit.App.Pages
|
||||
get => _canUnlockWithBiometrics;
|
||||
set
|
||||
{
|
||||
TriggerVaultTimeoutActionLockAllowedPropertyChanged();
|
||||
if (SetProperty(ref _canUnlockWithBiometrics, value))
|
||||
{
|
||||
((ICommand)ToggleCanUnlockWithBiometricsCommand).Execute(null);
|
||||
@@ -135,6 +136,7 @@ namespace Bit.App.Pages
|
||||
get => _canUnlockWithPin;
|
||||
set
|
||||
{
|
||||
TriggerVaultTimeoutActionLockAllowedPropertyChanged();
|
||||
if (SetProperty(ref _canUnlockWithPin, value))
|
||||
{
|
||||
((ICommand)ToggleCanUnlockWithPinCommand).Execute(null);
|
||||
@@ -142,6 +144,10 @@ namespace Bit.App.Pages
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsVaultTimeoutActionLockAllowed => _hasMasterPassword || _canUnlockWithBiometrics || _canUnlockWithPin;
|
||||
|
||||
public string SetUpUnlockMethodLabel => IsVaultTimeoutActionLockAllowed ? null : AppResources.SetUpAnUnlockOptionToChangeYourVaultTimeoutAction;
|
||||
|
||||
public TimeSpan? CustomVaultTimeoutTime
|
||||
{
|
||||
get => _customVaultTimeoutTime;
|
||||
@@ -158,6 +164,7 @@ namespace Bit.App.Pages
|
||||
MainThread.BeginInvokeOnMainThread(() => SetProperty(ref _customVaultTimeoutTime, oldValue));
|
||||
});
|
||||
}
|
||||
TriggerVaultTimeoutActionLockAllowedPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,8 +204,6 @@ namespace Bit.App.Pages
|
||||
|
||||
public bool ShowChangeMasterPassword { get; private set; }
|
||||
|
||||
private bool IsVaultTimeoutActionLockAllowed => _hasMasterPassword || _canUnlockWithBiometrics || _canUnlockWithPin;
|
||||
|
||||
private int? CurrentVaultTimeout => GetRawVaultTimeoutFrom(VaultTimeoutPickerViewModel.SelectedKey);
|
||||
|
||||
private bool IncludeLinksWithSubscriptionInfo => DeviceInfo.Platform != DevicePlatform.iOS;
|
||||
@@ -247,6 +252,7 @@ namespace Bit.App.Pages
|
||||
TriggerPropertyChanged(nameof(VaultTimeoutPolicyDescription));
|
||||
TriggerPropertyChanged(nameof(ShowChangeMasterPassword));
|
||||
TriggerUpdateCustomVaultTimeoutPicker();
|
||||
TriggerVaultTimeoutActionLockAllowedPropertyChanged();
|
||||
ToggleUseThisDeviceToApproveLoginRequestsCommand.NotifyCanExecuteChanged();
|
||||
ToggleCanUnlockWithBiometricsCommand.NotifyCanExecuteChanged();
|
||||
ToggleCanUnlockWithPinCommand.NotifyCanExecuteChanged();
|
||||
@@ -299,6 +305,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
_customVaultTimeoutTime = TimeSpan.FromMinutes(vaultTimeout);
|
||||
}
|
||||
TriggerVaultTimeoutActionLockAllowedPropertyChanged();
|
||||
}
|
||||
|
||||
private async Task InitVaultTimeoutActionPickerAsync()
|
||||
@@ -318,6 +325,7 @@ namespace Bit.App.Pages
|
||||
}
|
||||
|
||||
VaultTimeoutActionPickerViewModel.Init(options, timeoutAction, IsVaultTimeoutActionLockAllowed ? VaultTimeoutAction.Lock : VaultTimeoutAction.Logout);
|
||||
TriggerVaultTimeoutActionLockAllowedPropertyChanged();
|
||||
}
|
||||
|
||||
private async Task ToggleUseThisDeviceToApproveLoginRequestsAsync()
|
||||
@@ -354,6 +362,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
if (!_canUnlockWithBiometrics)
|
||||
{
|
||||
MainThread.BeginInvokeOnMainThread(() => TriggerPropertyChanged(nameof(CanUnlockWithBiometrics)));
|
||||
await UpdateVaultTimeoutActionIfNeededAsync();
|
||||
await _biometricsService.SetCanUnlockWithBiometricsAsync(CanUnlockWithBiometrics);
|
||||
return;
|
||||
@@ -369,11 +378,12 @@ namespace Bit.App.Pages
|
||||
}
|
||||
|
||||
await _biometricsService.SetCanUnlockWithBiometricsAsync(CanUnlockWithBiometrics);
|
||||
await InitVaultTimeoutActionPickerAsync();
|
||||
}
|
||||
|
||||
public async Task ToggleCanUnlockWithPinAsync()
|
||||
{
|
||||
if (!CanUnlockWithPin)
|
||||
if (!_canUnlockWithPin)
|
||||
{
|
||||
await _vaultTimeoutService.ClearAsync();
|
||||
await UpdateVaultTimeoutActionIfNeededAsync();
|
||||
@@ -397,10 +407,12 @@ namespace Bit.App.Pages
|
||||
AppResources.No);
|
||||
|
||||
await _userPinService.SetupPinAsync(newPin, requireMasterPasswordOnRestart);
|
||||
await InitVaultTimeoutActionPickerAsync();
|
||||
}
|
||||
|
||||
private async Task UpdateVaultTimeoutActionIfNeededAsync()
|
||||
{
|
||||
TriggerVaultTimeoutActionLockAllowedPropertyChanged();
|
||||
if (IsVaultTimeoutActionLockAllowed)
|
||||
{
|
||||
return;
|
||||
@@ -461,6 +473,16 @@ namespace Bit.App.Pages
|
||||
TriggerPropertyChanged(nameof(CustomVaultTimeoutTime));
|
||||
}
|
||||
|
||||
private void TriggerVaultTimeoutActionLockAllowedPropertyChanged()
|
||||
{
|
||||
MainThread.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
TriggerPropertyChanged(nameof(IsVaultTimeoutActionLockAllowed));
|
||||
TriggerPropertyChanged(nameof(SetUpUnlockMethodLabel));
|
||||
VaultTimeoutActionPickerViewModel.SelectOptionCommand.NotifyCanExecuteChanged();
|
||||
});
|
||||
}
|
||||
|
||||
private int? GetRawVaultTimeoutFrom(int vaultTimeoutPickerKey)
|
||||
{
|
||||
if (vaultTimeoutPickerKey == NEVER_SESSION_TIMEOUT_VALUE)
|
||||
@@ -495,7 +517,7 @@ namespace Bit.App.Pages
|
||||
|
||||
await _vaultTimeoutService.SetVaultTimeoutOptionsAsync(CurrentVaultTimeout, timeoutActionKey);
|
||||
_messagingService.Send(AppHelpers.VAULT_TIMEOUT_ACTION_CHANGED_MESSAGE_COMMAND);
|
||||
|
||||
TriggerVaultTimeoutActionLockAllowedPropertyChanged();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user