2016-12-23 06:37:16 +03:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
using Android.App;
|
|
|
|
using Android.Content;
|
|
|
|
using Android.OS;
|
|
|
|
using Android.Runtime;
|
2017-01-28 07:13:28 +03:00
|
|
|
using Android.Views;
|
2016-12-23 06:37:16 +03:00
|
|
|
|
|
|
|
namespace Bit.Android
|
|
|
|
{
|
2017-01-28 07:13:28 +03:00
|
|
|
[Activity(Label = "bitwarden",
|
|
|
|
Icon = "@drawable/icon",
|
2017-01-24 07:32:52 +03:00
|
|
|
LaunchMode = global::Android.Content.PM.LaunchMode.SingleInstance,
|
2017-01-28 07:13:28 +03:00
|
|
|
WindowSoftInputMode = SoftInput.StateHidden)]
|
2016-12-23 06:37:16 +03:00
|
|
|
public class AutofillActivity : Activity
|
|
|
|
{
|
2017-01-24 07:32:52 +03:00
|
|
|
private string _lastQueriedUri;
|
|
|
|
public static Credentials LastCredentials;
|
|
|
|
|
2016-12-23 06:37:16 +03:00
|
|
|
protected override void OnCreate(Bundle bundle)
|
|
|
|
{
|
|
|
|
base.OnCreate(bundle);
|
2017-01-24 07:32:52 +03:00
|
|
|
_lastQueriedUri = Intent.GetStringExtra("uri");
|
2016-12-23 06:37:16 +03:00
|
|
|
|
2017-01-28 07:13:28 +03:00
|
|
|
var intent = new Intent(this, typeof(MainActivity));
|
2017-01-24 07:32:52 +03:00
|
|
|
intent.PutExtra("uri", _lastQueriedUri);
|
2017-01-24 05:28:38 +03:00
|
|
|
StartActivityForResult(intent, 123);
|
2016-12-23 06:37:16 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
|
|
|
|
{
|
|
|
|
base.OnActivityResult(requestCode, resultCode, data);
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2017-01-24 07:32:52 +03:00
|
|
|
var uri = data.GetStringExtra("uri");
|
|
|
|
var username = data.GetStringExtra("username");
|
|
|
|
var password = data.GetStringExtra("password");
|
|
|
|
|
|
|
|
LastCredentials = new Credentials
|
|
|
|
{
|
|
|
|
User = username,
|
|
|
|
Password = password,
|
|
|
|
Uri = _lastQueriedUri
|
|
|
|
};
|
2016-12-23 06:37:16 +03:00
|
|
|
}
|
2017-01-24 07:32:52 +03:00
|
|
|
catch { }
|
2016-12-23 06:37:16 +03:00
|
|
|
finally
|
|
|
|
{
|
|
|
|
Finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public class Credentials
|
|
|
|
{
|
|
|
|
public string User;
|
|
|
|
public string Password;
|
2017-01-24 07:32:52 +03:00
|
|
|
public string Uri;
|
2016-12-23 06:37:16 +03:00
|
|
|
}
|
|
|
|
}
|
2017-01-28 07:13:28 +03:00
|
|
|
}
|