Compare commits

..

1 Commits

Author SHA1 Message Date
Philipp Crocoll
acf55b1f85 trying to reproduce autospill, without success so far (refers to #2478) 2024-01-02 12:44:47 +01:00
8 changed files with 64 additions and 14 deletions

View File

@@ -72,6 +72,13 @@ namespace Kp2aAutofillParserTest
RunTestFromAutofillInput(resourceName, "com.expressvpn.vpn", null); RunTestFromAutofillInput(resourceName, "com.expressvpn.vpn", null);
} }
[Fact]
public void HandlesAutospillGracefully()
{
var resourceName = "Kp2aAutofillParserTest.autospill.json";
RunTestFromAutofillInput(resourceName, "com.vivaldi.browser", "m.facebook.com");
}
private void RunTestFromAutofillInput(string resourceName, string expectedPackageName = null, string expectedWebDomain = null) private void RunTestFromAutofillInput(string resourceName, string expectedPackageName = null, string expectedWebDomain = null)
{ {
var assembly = Assembly.GetExecutingAssembly(); var assembly = Assembly.GetExecutingAssembly();

View File

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

View File

@@ -0,0 +1,48 @@
{
"InputFields": [
{
"IdEntry": "native_username",
"ClassName": "android.widget.EditText",
"AutofillHints": null,
"IsFocused": false,
"InputType": 1,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null,
"ExpectedAssignedHints": ["username"]
},
{
"IdEntry": "native_password",
"ClassName": "android.widget.EditText",
"AutofillHints": null,
"IsFocused": false,
"InputType": 129,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null,
"ExpectedAssignedHints": []
},
{
"IdEntry": "webview_email",
"ClassName": "android.widget.EditText",
"AutofillHints": [ "email" ],
"IsFocused": true,
"InputType": 0,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null,
"ExpectedAssignedHints": [ "emailAddress" ]
},
{
"IdEntry": "webview_password",
"ClassName": "android.widget.EditText",
"AutofillHints": [
"password"
],
"IsFocused": false,
"InputType": 0,
"HtmlInfoTag": null,
"HtmlInfoTypeAttribute": null,
"ExpectedAssignedHints": [ "password" ]
}
],
"PackageId": "com.vivaldi.browser",
"WebDomain": "m.facebook.com"
}

View File

@@ -68,8 +68,5 @@
<ItemGroup> <ItemGroup>
<None Include="Resources\AboutResources.txt" /> <None Include="Resources\AboutResources.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\values\Strings.xml" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
</Project> </Project>

View File

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

View File

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

View File

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

View File

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