1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-28 12:35:40 +01:00

bugfixes for lock block when setting timeout to immediate (#1455)

This commit is contained in:
Matt Portune 2021-07-12 10:58:17 -04:00 committed by GitHub
parent 1f57ba6c50
commit d8e68a266c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 13 deletions

View File

@ -327,6 +327,11 @@ namespace Bit.Droid
{
if (intent.Action == Intent.ActionSend && intent.Type != null)
{
if ((intent.Flags & ActivityFlags.LaunchedFromHistory) == ActivityFlags.LaunchedFromHistory)
{
// don't re-deliver intent if resuming from app switcher
return null;
}
var type = intent.Type;
if (type.Contains("text/"))
{

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using Bit.App.Models;
using Bit.App.Resources;
using Bit.App.Utilities;
using Bit.Core.Abstractions;
using Bit.Core.Enums;
using Bit.Core.Utilities;
@ -81,7 +82,10 @@ namespace Bit.App.Pages
protected override async void OnAppearing()
{
base.OnAppearing();
if (!await AppHelpers.IsVaultTimeoutImmediateAsync())
{
await _vaultTimeoutService.CheckVaultTimeoutAsync();
}
if (await _vaultTimeoutService.IsLockedAsync())
{
return;
@ -121,7 +125,6 @@ namespace Bit.App.Pages
if (_vm.IsAddFromShare && Device.RuntimePlatform == Device.Android)
{
_appOptions.CreateSend = null;
_vm.CloseMainApp();
}
return base.OnBackButtonPressed();
}

View File

@ -398,7 +398,7 @@ namespace Bit.App.Pages
if (IsAddFromShare && Device.RuntimePlatform == Device.Android)
{
CloseMainApp();
_deviceActionService.CloseMainApp();
}
else
{
@ -429,14 +429,6 @@ 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);

View File

@ -147,7 +147,10 @@ namespace Bit.App.Pages
protected override async void OnAppearing()
{
base.OnAppearing();
if (!await AppHelpers.IsVaultTimeoutImmediateAsync())
{
await _vaultTimeoutService.CheckVaultTimeoutAsync();
}
if (await _vaultTimeoutService.IsLockedAsync())
{
return;

View File

@ -7,6 +7,7 @@ using System;
using System.Linq;
using System.Threading.Tasks;
using Bit.App.Controls;
using Bit.App.Utilities;
using Xamarin.Forms;
namespace Bit.App.Pages
@ -34,7 +35,10 @@ namespace Bit.App.Pages
protected async override void OnAppearing()
{
base.OnAppearing();
if (!await AppHelpers.IsVaultTimeoutImmediateAsync())
{
await _vaultTimeoutService.CheckVaultTimeoutAsync();
}
if (await _vaultTimeoutService.IsLockedAsync())
{
return;

View File

@ -458,5 +458,17 @@ namespace Bit.App.Utilities
var storageService = ServiceContainer.Resolve<IStorageService>("storageService");
await storageService.RemoveAsync(Constants.InvalidUnlockAttempts);
}
public static async Task<bool> IsVaultTimeoutImmediateAsync()
{
var storageService = ServiceContainer.Resolve<IStorageService>("storageService");
var vaultTimeoutMinutes = await storageService.GetAsync<int?>(Constants.VaultTimeoutKey);
if (vaultTimeoutMinutes.GetValueOrDefault(-1) == 0)
{
return true;
}
return false;
}
}
}