dont process OnSaveRequest if prompt disabled

This commit is contained in:
Kyle Spearrin 2019-06-03 11:01:08 -04:00
parent 59620e6435
commit 999c9667c8
1 changed files with 15 additions and 3 deletions

View File

@ -22,6 +22,7 @@ namespace Bit.Droid.Autofill
{
private ICipherService _cipherService;
private ILockService _lockService;
private IStorageService _storageService;
public async override void OnFillRequest(FillRequest request, CancellationSignal cancellationSignal, FillCallback callback)
{
@ -38,10 +39,10 @@ namespace Bit.Droid.Autofill
{
return;
}
if(_lockService == null)
{
_lockService = ServiceContainer.Resolve<ILockService>("lockService");
_lockService = ServiceContainer.Resolve<ILockService>("lockService");
}
List<FilledItem> items = null;
@ -60,7 +61,7 @@ namespace Bit.Droid.Autofill
callback.OnSuccess(response);
}
public override void OnSaveRequest(SaveRequest request, SaveCallback callback)
public async override void OnSaveRequest(SaveRequest request, SaveCallback callback)
{
var structure = request.FillContexts?.LastOrDefault()?.Structure;
if(structure == null)
@ -68,6 +69,17 @@ namespace Bit.Droid.Autofill
return;
}
if(_storageService == null)
{
_storageService = ServiceContainer.Resolve<IStorageService>("storageService");
}
var disableSavePrompt = await _storageService.GetAsync<bool?>(Constants.AutofillDisableSavePromptKey);
if(disableSavePrompt.GetValueOrDefault())
{
return;
}
var parser = new Parser(structure, ApplicationContext);
parser.Parse();