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;
|
|
|
|
using Android.Views;
|
|
|
|
using Android.Widget;
|
|
|
|
using Bit.App.Models;
|
|
|
|
|
|
|
|
namespace Bit.Android
|
|
|
|
{
|
|
|
|
//[Activity(Label = "Autofill", LaunchMode = global::Android.Content.PM.LaunchMode.SingleInstance, Theme = "@style/android:Theme.Material.Light")]
|
|
|
|
public class AutofillActivity : Activity
|
|
|
|
{
|
|
|
|
protected override void OnCreate(Bundle bundle)
|
|
|
|
{
|
|
|
|
base.OnCreate(bundle);
|
|
|
|
|
|
|
|
var url = Intent.GetStringExtra("url");
|
|
|
|
_lastQueriedUrl = url;
|
2017-01-24 05:28:38 +03:00
|
|
|
|
|
|
|
Intent intent = new Intent(this, typeof(AutofillSelectLoginActivity));
|
|
|
|
intent.PutExtra("url", url);
|
|
|
|
StartActivityForResult(intent, 123);
|
2016-12-23 06:37:16 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
string _lastQueriedUrl;
|
|
|
|
|
|
|
|
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
|
|
|
|
{
|
2017-01-24 05:28:38 +03:00
|
|
|
var url = data.GetStringExtra("url");
|
|
|
|
var username = data.GetStringExtra("username");
|
|
|
|
var password = data.GetStringExtra("password");
|
|
|
|
|
2016-12-23 06:37:16 +03:00
|
|
|
base.OnActivityResult(requestCode, resultCode, data);
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2017-01-24 05:28:38 +03:00
|
|
|
LastReceivedCredentials = new Credentials { User = username, Password = password, Url = _lastQueriedUrl };
|
2016-12-23 06:37:16 +03:00
|
|
|
}
|
|
|
|
catch(Exception e)
|
|
|
|
{
|
|
|
|
//Android.Util.Log.Debug("KP2AAS", "Exception while receiving credentials: " + e.ToString());
|
|
|
|
}
|
|
|
|
finally
|
|
|
|
{
|
|
|
|
Finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static Credentials LastReceivedCredentials;
|
|
|
|
|
|
|
|
public class Credentials
|
|
|
|
{
|
|
|
|
public string User;
|
|
|
|
public string Password;
|
|
|
|
public string Url;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|