mirror of
https://github.com/bitwarden/mobile.git
synced 2025-01-11 19:31:50 +01:00
Fix for password unlock for autofill and share-to-send on Android (#1453)
This commit is contained in:
parent
9298d57f22
commit
ff19578807
@ -57,6 +57,7 @@ namespace Bit.Droid.Autofill
|
||||
}
|
||||
|
||||
List<FilledItem> items = null;
|
||||
await _vaultTimeoutService.CheckVaultTimeoutAsync();
|
||||
var locked = await _vaultTimeoutService.IsLockedAsync();
|
||||
if (!locked)
|
||||
{
|
||||
|
@ -16,6 +16,7 @@ namespace Bit.App.Pages
|
||||
public partial class SendAddEditPage : BaseContentPage
|
||||
{
|
||||
private readonly IBroadcasterService _broadcasterService;
|
||||
private readonly IVaultTimeoutService _vaultTimeoutService;
|
||||
|
||||
private AppOptions _appOptions;
|
||||
private SendAddEditPageViewModel _vm;
|
||||
@ -26,6 +27,7 @@ namespace Bit.App.Pages
|
||||
SendType? type = null)
|
||||
{
|
||||
_broadcasterService = ServiceContainer.Resolve<IBroadcasterService>("broadcasterService");
|
||||
_vaultTimeoutService = ServiceContainer.Resolve<IVaultTimeoutService>("vaultTimeoutService");
|
||||
_appOptions = appOptions;
|
||||
InitializeComponent();
|
||||
_vm = BindingContext as SendAddEditPageViewModel;
|
||||
@ -79,6 +81,11 @@ namespace Bit.App.Pages
|
||||
protected override async void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
await _vaultTimeoutService.CheckVaultTimeoutAsync();
|
||||
if (await _vaultTimeoutService.IsLockedAsync())
|
||||
{
|
||||
return;
|
||||
}
|
||||
await _vm.InitAsync();
|
||||
_broadcasterService.Subscribe(nameof(SendAddEditPage), message =>
|
||||
{
|
||||
@ -109,6 +116,16 @@ namespace Bit.App.Pages
|
||||
});
|
||||
}
|
||||
|
||||
protected override bool OnBackButtonPressed()
|
||||
{
|
||||
if (_vm.IsAddFromShare && Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
_appOptions.CreateSend = null;
|
||||
_vm.CloseMainApp();
|
||||
}
|
||||
return base.OnBackButtonPressed();
|
||||
}
|
||||
|
||||
protected override void OnDisappearing()
|
||||
{
|
||||
base.OnDisappearing();
|
||||
|
@ -398,7 +398,7 @@ namespace Bit.App.Pages
|
||||
|
||||
if (IsAddFromShare && Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
_deviceActionService.CloseMainApp();
|
||||
CloseMainApp();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -429,6 +429,14 @@ namespace Bit.App.Pages
|
||||
return false;
|
||||
}
|
||||
|
||||
public void CloseMainApp()
|
||||
{
|
||||
if (Device.RuntimePlatform == Device.Android)
|
||||
{
|
||||
_deviceActionService.CloseMainApp();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<bool> RemovePasswordAsync()
|
||||
{
|
||||
return await AppHelpers.RemoveSendPasswordAsync(SendId);
|
||||
|
@ -20,6 +20,7 @@ namespace Bit.App.Pages
|
||||
private readonly AppOptions _appOptions;
|
||||
private readonly IStorageService _storageService;
|
||||
private readonly IDeviceActionService _deviceActionService;
|
||||
private readonly IVaultTimeoutService _vaultTimeoutService;
|
||||
|
||||
private AddEditPageViewModel _vm;
|
||||
private bool _fromAutofill;
|
||||
@ -38,6 +39,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
_storageService = ServiceContainer.Resolve<IStorageService>("storageService");
|
||||
_deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService");
|
||||
_vaultTimeoutService = ServiceContainer.Resolve<IVaultTimeoutService>("vaultTimeoutService");
|
||||
_appOptions = appOptions;
|
||||
_fromAutofill = fromAutofill;
|
||||
FromAutofillFramework = _appOptions?.FromAutofillFramework ?? false;
|
||||
@ -145,6 +147,11 @@ namespace Bit.App.Pages
|
||||
protected override async void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
await _vaultTimeoutService.CheckVaultTimeoutAsync();
|
||||
if (await _vaultTimeoutService.IsLockedAsync())
|
||||
{
|
||||
return;
|
||||
}
|
||||
await LoadOnAppearedAsync(_scrollView, true, async () =>
|
||||
{
|
||||
var success = await _vm.LoadAsync(_appOptions);
|
||||
|
@ -15,6 +15,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
private readonly AppOptions _appOptions;
|
||||
private readonly IPlatformUtilsService _platformUtilsService;
|
||||
private readonly IVaultTimeoutService _vaultTimeoutService;
|
||||
|
||||
private AutofillCiphersPageViewModel _vm;
|
||||
|
||||
@ -27,11 +28,17 @@ namespace Bit.App.Pages
|
||||
_vm.Init(appOptions);
|
||||
|
||||
_platformUtilsService = ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService");
|
||||
_vaultTimeoutService = ServiceContainer.Resolve<IVaultTimeoutService>("vaultTimeoutService");
|
||||
}
|
||||
|
||||
protected async override void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
await _vaultTimeoutService.CheckVaultTimeoutAsync();
|
||||
if (await _vaultTimeoutService.IsLockedAsync())
|
||||
{
|
||||
return;
|
||||
}
|
||||
await LoadOnAppearedAsync(_mainLayout, false, async () =>
|
||||
{
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user