Compare commits

..

1 Commits

8 changed files with 12 additions and 135 deletions

View File

@@ -71,12 +71,6 @@ namespace Kp2aAutofillParserTest
var resourceName = "Kp2aAutofillParserTest.com-expressvpn-vpn-android13.json";
RunTestFromAutofillInput(resourceName, "com.expressvpn.vpn", null);
}
[Fact]
public void TestIgnoresAndroidSettings()
{
var resourceName = "Kp2aAutofillParserTest.android14-settings.json";
RunTestFromAutofillInput(resourceName, "com.android.settings", null);
}
private void RunTestFromAutofillInput(string resourceName, string expectedPackageName = null, string expectedWebDomain = null)
{

View File

@@ -9,7 +9,6 @@
</PropertyGroup>
<ItemGroup>
<None Remove="android14-settings.json" />
<None Remove="chrome-android10-amazon-it.json" />
<None Remove="com-expressvpn-vpn-android13.json" />
<None Remove="com-ifs-banking-fiid3364-android13.json" />
@@ -55,9 +54,6 @@
<EmbeddedResource Include="com-servicenet-mobile-no-focus.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="android14-settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="imdb.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>

View File

@@ -1,99 +0,0 @@
{
"InputFields": [
{
"IdEntry": null,
"Hint": null,
"ClassName": "android.widget.FrameLayout",
"AutofillHints": null,
"IsFocused": false,
"InputType": 0,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null
},
{
"IdEntry": "content_parent",
"Hint": null,
"ClassName": "android.widget.LinearLayout",
"AutofillHints": null,
"IsFocused": false,
"InputType": 0,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null
},
{
"IdEntry": "content_frame",
"Hint": null,
"ClassName": "android.widget.FrameLayout",
"AutofillHints": null,
"IsFocused": false,
"InputType": 0,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null
},
{
"IdEntry": "main_content",
"Hint": null,
"ClassName": "android.widget.FrameLayout",
"AutofillHints": null,
"IsFocused": false,
"InputType": 0,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null
},
{
"IdEntry": "password_entry",
"Hint": null,
"ClassName": "android.widget.EditText",
"AutofillHints": [
"passwordAuto"
],
"IsFocused": true,
"InputType": 18,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null,
"ExpectedAssignedHints": [ "password" ]
},
{
"IdEntry": "checkbox",
"Hint": null,
"ClassName": "android.widget.CheckBox",
"AutofillHints": null,
"IsFocused": false,
"InputType": 0,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null
},
{
"IdEntry": "button_bar",
"Hint": null,
"ClassName": "android.widget.RelativeLayout",
"AutofillHints": null,
"IsFocused": false,
"InputType": 0,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null
},
{
"IdEntry": "switch_bar",
"Hint": null,
"ClassName": "android.widget.LinearLayout",
"AutofillHints": null,
"IsFocused": false,
"InputType": 0,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null
},
{
"IdEntry": "action_bar",
"Hint": null,
"ClassName": "android.view.ViewGroup",
"AutofillHints": null,
"IsFocused": false,
"InputType": 0,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null
}
],
"PackageId": "com.android.settings",
"WebDomain": null
}

View File

@@ -937,10 +937,9 @@ namespace keepass2android
iv.SetImageDrawable(Resources.GetDrawable(Resource.Drawable.ic00));
}
SupportActionBar.Title = Entry.Strings.ReadSafe(PwDefs.TitleField);
SupportActionBar.SetDisplayHomeAsUpEnabled(true);
SupportActionBar.Title = SprEngine.Compile(SupportActionBar.Title, new SprContext(Entry, App.Kp2a.CurrentDb.KpDatabase, SprCompileFlags.All));
SupportActionBar.SetDisplayHomeAsUpEnabled(true);
SupportActionBar.SetHomeButtonEnabled(true);
PopulateGroupText (Resource.Id.entry_group_name, Resource.Id.entryfield_group_container, KeyGroupFullPath);

View File

@@ -30,6 +30,7 @@ using KeePassLib;
using KeePassLib.Utility;
using System.Threading;
using System.Collections.Generic;
using KeePass.Util.Spr;
namespace keepass2android.search
{
@@ -294,7 +295,10 @@ namespace keepass2android.search
return Position.ToString(CultureInfo.InvariantCulture);
case 1: // SuggestColumnText1
string username = CurrentEntry.Strings.ReadSafe(PwDefs.UserNameField);
return CurrentEntry.Strings.ReadSafe(PwDefs.TitleField) + (string.IsNullOrWhiteSpace(username) ? "" : " ("+username+")");
username = SprEngine.Compile(username, new SprContext(CurrentEntry, App.Kp2a.CurrentDb.KpDatabase, SprCompileFlags.All));
var title = CurrentEntry.Strings.ReadSafe(PwDefs.TitleField);
title = SprEngine.Compile(title, new SprContext(CurrentEntry, App.Kp2a.CurrentDb.KpDatabase, SprCompileFlags.All));
return title + (string.IsNullOrWhiteSpace(username) ? "" : " ("+username+")");
case 2: // SuggestColumnText2
return Internationalise(_entriesWithContexts[Position].resultContext);
case 3: // SuggestColumnIcon1

View File

@@ -40,26 +40,6 @@ namespace keepass2android.services.AutofillBase
public abstract class AutofillServiceBase: AutofillService
{
private HashSet<string> _internal_blacklistedUris = null;
public HashSet<string> BlacklistedUris
{
get
{
if (_internal_blacklistedUris == null)
{
_internal_blacklistedUris = new HashSet<string>()
{
KeePass.AndroidAppScheme + "android",
KeePass.AndroidAppScheme + "com.android.settings",
KeePass.AndroidAppScheme + this.PackageName
};
}
return _internal_blacklistedUris;
}
}
protected override void AttachBaseContext(Context baseContext)
{
base.AttachBaseContext(LocaleManager.setLocale(baseContext));
@@ -406,7 +386,7 @@ namespace keepass2android.services.AutofillBase
private bool CanAutofill(StructureParser.AutofillTargetId query, bool isManual)
{
if (BlacklistedUris.Contains(query.PackageNameWithPseudoSchema))
if (query.PackageNameWithPseudoSchema == KeePass.AndroidAppScheme+"android" || query.PackageNameWithPseudoSchema == KeePass.AndroidAppScheme + this.PackageName)
return false;
if (!isManual)
{

View File

@@ -10,6 +10,7 @@ using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using KeePass.Util.Spr;
using keepass2android.services.AutofillBase;
using keepass2android.services.AutofillBase.model;
using Keepass2android.Pluginsdk;
@@ -108,6 +109,7 @@ namespace keepass2android.services.Kp2aAutofill
fieldCollection.DatasetName = pwEntry.Strings.ReadSafe(PwDefs.TitleField);
fieldCollection.DatasetName = SprEngine.Compile(fieldCollection.DatasetName, new SprContext(pwEntry, App.Kp2a.CurrentDb.KpDatabase, SprCompileFlags.All));
return fieldCollection;
}

View File

@@ -125,7 +125,8 @@ namespace keepass2android.view
}
String title = pw.Strings.ReadSafe(PwDefs.TitleField);
var str = new SpannableString(title);
title = SprEngine.Compile(title, new SprContext(_entry, db.KpDatabase, SprCompileFlags.All));
var str = new SpannableString(title);
if (isExpired)
{