1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-15 07:43:37 +00:00

implement blacklisted uris options for autofill

This commit is contained in:
Kyle Spearrin
2019-06-03 11:08:33 -04:00
parent 999c9667c8
commit e8c776fe49
2 changed files with 25 additions and 4 deletions

View File

@@ -3,6 +3,8 @@ using Android.App.Assist;
using System.Collections.Generic;
using Bit.Core;
using Android.Content;
using Bit.Core.Abstractions;
using System.Threading.Tasks;
namespace Bit.Droid.Autofill
{
@@ -77,8 +79,20 @@ namespace Bit.Droid.Autofill
}
}
public bool ShouldAutofill => !string.IsNullOrWhiteSpace(Uri) &&
!AutofillHelpers.BlacklistedUris.Contains(Uri) && FieldCollection != null && FieldCollection.Fillable;
public async Task<bool> ShouldAutofillAsync(IStorageService storageService)
{
var fillable = !string.IsNullOrWhiteSpace(Uri) && !AutofillHelpers.BlacklistedUris.Contains(Uri) &&
FieldCollection != null && FieldCollection.Fillable;
if(fillable)
{
var blacklistedUris = await storageService.GetAsync<List<string>>(Constants.AutofillBlacklistedUrisKey);
if(blacklistedUris != null && blacklistedUris.Count > 0)
{
fillable = !new HashSet<string>(blacklistedUris).Contains(Uri);
}
}
return fillable;
}
public void Parse()
{