From 999c9667c83ff234eb9e93c70a60615a94c504ec Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 3 Jun 2019 11:01:08 -0400 Subject: [PATCH] dont process OnSaveRequest if prompt disabled --- src/Android/Autofill/AutofillService.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Android/Autofill/AutofillService.cs b/src/Android/Autofill/AutofillService.cs index 90e8009b6..4eae82719 100644 --- a/src/Android/Autofill/AutofillService.cs +++ b/src/Android/Autofill/AutofillService.cs @@ -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("lockService"); + _lockService = ServiceContainer.Resolve("lockService"); } List 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("storageService"); + } + + var disableSavePrompt = await _storageService.GetAsync(Constants.AutofillDisableSavePromptKey); + if(disableSavePrompt.GetValueOrDefault()) + { + return; + } + var parser = new Parser(structure, ApplicationContext); parser.Parse();