mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-23 11:45:38 +01:00
Autofill WIP
This commit is contained in:
parent
33e7ca08d8
commit
759df9bdd5
@ -298,6 +298,7 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AutofillSelectLoginActivity.cs" />
|
||||
<Compile Include="AutofillActivity.cs" />
|
||||
<Compile Include="Controls\CustomSearchBarRenderer.cs" />
|
||||
<Compile Include="Controls\CustomButtonRenderer.cs" />
|
||||
|
@ -22,19 +22,25 @@ namespace Bit.Android
|
||||
|
||||
var url = Intent.GetStringExtra("url");
|
||||
_lastQueriedUrl = url;
|
||||
//StartActivityForResult(Kp2aControl.GetQueryEntryIntent(url), 123);
|
||||
|
||||
Intent intent = new Intent(this, typeof(AutofillSelectLoginActivity));
|
||||
intent.PutExtra("url", url);
|
||||
StartActivityForResult(intent, 123);
|
||||
}
|
||||
|
||||
string _lastQueriedUrl;
|
||||
|
||||
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
|
||||
{
|
||||
var url = data.GetStringExtra("url");
|
||||
var username = data.GetStringExtra("username");
|
||||
var password = data.GetStringExtra("password");
|
||||
|
||||
base.OnActivityResult(requestCode, resultCode, data);
|
||||
|
||||
try
|
||||
{
|
||||
// TODO: lookup login
|
||||
LastReceivedCredentials = new Credentials { User = "username", Password = "12345678", Url = _lastQueriedUrl };
|
||||
LastReceivedCredentials = new Credentials { User = username, Password = password, Url = _lastQueriedUrl };
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
37
src/Android/AutofillSelectLoginActivity.cs
Normal file
37
src/Android/AutofillSelectLoginActivity.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.OS;
|
||||
|
||||
namespace Bit.Android
|
||||
{
|
||||
//[Activity(LaunchMode = global::Android.Content.PM.LaunchMode.SingleInstance)]
|
||||
public class AutofillSelectLoginActivity : Activity
|
||||
{
|
||||
protected override void OnCreate(Bundle bundle)
|
||||
{
|
||||
base.OnCreate(bundle);
|
||||
var url = Intent.GetStringExtra("url");
|
||||
|
||||
Intent data = new Intent();
|
||||
data.PutExtra("url", url);
|
||||
data.PutExtra("username", "user123");
|
||||
data.PutExtra("password", "pass123");
|
||||
|
||||
if(Parent == null)
|
||||
{
|
||||
SetResult(Result.Ok, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
Parent.SetResult(Result.Ok, data);
|
||||
}
|
||||
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
}
|
@ -25,6 +25,7 @@ namespace Bit.Android
|
||||
public override void OnAccessibilityEvent(AccessibilityEvent e)
|
||||
{
|
||||
var eventType = e.EventType;
|
||||
System.Diagnostics.Debug.WriteLine(DateTime.UtcNow.ToString() + " Event Type: " + eventType);
|
||||
var package = e.PackageName;
|
||||
switch(eventType)
|
||||
{
|
||||
@ -122,8 +123,9 @@ namespace Bit.Android
|
||||
{
|
||||
if(url1.StartsWith("androidapp://"))
|
||||
return url1 == url2;
|
||||
//return KeePassLib.Utility.UrlUtil.GetHost(url1) == KeePassLib.Utility.UrlUtil.GetHost(url2);
|
||||
return false;
|
||||
// TODO: host check
|
||||
return url1 == url2;
|
||||
//return false;
|
||||
}
|
||||
|
||||
private static bool IsPasswordField(AccessibilityNodeInfo n)
|
||||
|
@ -4,4 +4,5 @@
|
||||
android:accessibilityFeedbackType="feedbackSpoken"
|
||||
android:accessibilityFlags="flagDefault"
|
||||
android:notificationTimeout="100"
|
||||
android:canRetrieveWindowContent="true"/>
|
||||
android:canRetrieveWindowContent="true"
|
||||
android:canRequestEnhancedWebAccessibility="true"/>
|
Loading…
Reference in New Issue
Block a user