mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-23 11:45:38 +01:00
autofill cleanup
This commit is contained in:
parent
2c662c428c
commit
e4012e4f87
@ -201,12 +201,6 @@
|
|||||||
<HintPath>..\..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Animated.Vector.Drawable.dll</HintPath>
|
<HintPath>..\..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Animated.Vector.Drawable.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xamarin.Android.Support.Constraint.Layout, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\..\packages\Xamarin.Android.Support.Constraint.Layout.1.0.2.2\lib\MonoAndroid70\Xamarin.Android.Support.Constraint.Layout.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Xamarin.Android.Support.Constraint.Layout.Solver, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\..\packages\Xamarin.Android.Support.Constraint.Layout.Solver.1.0.2.2\lib\MonoAndroid70\Xamarin.Android.Support.Constraint.Layout.Solver.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Xamarin.Android.Support.Design, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Xamarin.Android.Support.Design, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\Xamarin.Android.Support.Design.23.3.0\lib\MonoAndroid43\Xamarin.Android.Support.Design.dll</HintPath>
|
<HintPath>..\..\packages\Xamarin.Android.Support.Design.23.3.0\lib\MonoAndroid43\Xamarin.Android.Support.Design.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
@ -293,7 +287,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AutofillActivity.cs" />
|
<Compile Include="AutofillActivity.cs" />
|
||||||
<Compile Include="AutofillCredentials.cs" />
|
<Compile Include="AutofillCredentials.cs" />
|
||||||
<Compile Include="Autofill\AuthActivity.cs" />
|
|
||||||
<Compile Include="Autofill\Field.cs" />
|
<Compile Include="Autofill\Field.cs" />
|
||||||
<Compile Include="Autofill\FieldCollection.cs" />
|
<Compile Include="Autofill\FieldCollection.cs" />
|
||||||
<Compile Include="Autofill\AutofillService.cs" />
|
<Compile Include="Autofill\AutofillService.cs" />
|
||||||
@ -359,9 +352,6 @@
|
|||||||
<AndroidResource Include="Resources\layout\autofill_listitem.axml">
|
<AndroidResource Include="Resources\layout\autofill_listitem.axml">
|
||||||
<SubType>AndroidResource</SubType>
|
<SubType>AndroidResource</SubType>
|
||||||
</AndroidResource>
|
</AndroidResource>
|
||||||
<AndroidResource Include="Resources\layout\autofill_authactivity.axml">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</AndroidResource>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Properties\AndroidManifest.xml" />
|
<None Include="Properties\AndroidManifest.xml" />
|
||||||
|
@ -1,110 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using Android.App;
|
|
||||||
using Android.Content;
|
|
||||||
using Android.OS;
|
|
||||||
using Android.Widget;
|
|
||||||
using Android.Support.V7.App;
|
|
||||||
using Android.Views.Autofill;
|
|
||||||
using Android.App.Assist;
|
|
||||||
using XLabs.Ioc;
|
|
||||||
using Bit.App.Abstractions;
|
|
||||||
using Bit.App.Resources;
|
|
||||||
|
|
||||||
namespace Bit.Android.Autofill
|
|
||||||
{
|
|
||||||
[Activity(Label = "AuthActivity")]
|
|
||||||
public class AuthActivity : AppCompatActivity
|
|
||||||
{
|
|
||||||
private EditText _masterPassword;
|
|
||||||
private Intent _replyIntent = null;
|
|
||||||
|
|
||||||
protected override void OnCreate(Bundle state)
|
|
||||||
{
|
|
||||||
base.OnCreate(state);
|
|
||||||
SetContentView(Resource.Layout.autofill_authactivity);
|
|
||||||
var masterLoginLabel = FindViewById(Resource.Id.master_login_header) as TextView;
|
|
||||||
masterLoginLabel.Text = AppResources.VerifyMasterPassword;
|
|
||||||
|
|
||||||
|
|
||||||
var masterPasswordLabel = FindViewById(Resource.Id.password_label) as TextView;
|
|
||||||
masterPasswordLabel.Text = AppResources.MasterPassword;
|
|
||||||
|
|
||||||
_masterPassword = FindViewById(Resource.Id.master_password) as EditText;
|
|
||||||
|
|
||||||
var loginButton = FindViewById(Resource.Id.login) as TextView;
|
|
||||||
loginButton.Text = AppResources.LogIn;
|
|
||||||
loginButton.Click += (sender, e) => {
|
|
||||||
Login();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
var cancelButton = FindViewById(Resource.Id.cancel) as TextView;
|
|
||||||
cancelButton.Text = AppResources.Cancel;
|
|
||||||
cancelButton.Click += (sender, e) => {
|
|
||||||
_replyIntent = null;
|
|
||||||
Finish();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Finish()
|
|
||||||
{
|
|
||||||
if(_replyIntent != null)
|
|
||||||
{
|
|
||||||
SetResult(Result.Ok, _replyIntent);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetResult(Result.Canceled);
|
|
||||||
}
|
|
||||||
|
|
||||||
base.Finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Login()
|
|
||||||
{
|
|
||||||
var password = _masterPassword.Text;
|
|
||||||
if(true) // Check password
|
|
||||||
{
|
|
||||||
Success();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Toast.MakeText(this, "Password incorrect", ToastLength.Short).Show();
|
|
||||||
_replyIntent = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void Success()
|
|
||||||
{
|
|
||||||
var structure = Intent.GetParcelableExtra(AutofillManager.ExtraAssistStructure) as AssistStructure;
|
|
||||||
if(structure == null)
|
|
||||||
{
|
|
||||||
_replyIntent = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var parser = new Parser(structure);
|
|
||||||
parser.Parse();
|
|
||||||
if(!parser.FieldCollection.Fields.Any() || string.IsNullOrWhiteSpace(parser.Uri))
|
|
||||||
{
|
|
||||||
_replyIntent = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var items = await AutofillHelpers.GetFillItemsAsync(Resolver.Resolve<ICipherService>(), parser.Uri);
|
|
||||||
if(!items.Any())
|
|
||||||
{
|
|
||||||
_replyIntent = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var response = AutofillHelpers.BuildFillResponse(this, parser.FieldCollection, items);
|
|
||||||
_replyIntent = new Intent();
|
|
||||||
_replyIntent.PutExtra(AutofillManager.ExtraAuthenticationResult, response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -63,8 +63,8 @@ namespace Bit.Android.Autofill
|
|||||||
public static FillResponse BuildAuthResponse(Context context, FieldCollection fields, string uri)
|
public static FillResponse BuildAuthResponse(Context context, FieldCollection fields, string uri)
|
||||||
{
|
{
|
||||||
var responseBuilder = new FillResponse.Builder();
|
var responseBuilder = new FillResponse.Builder();
|
||||||
var view = BuildListView(context.PackageName, "Autofill with bitwarden",
|
var view = BuildListView(context.PackageName, "Auto-fill with bitwarden",
|
||||||
"Vault locked", Resource.Drawable.icon);
|
"Vault is locked", Resource.Drawable.icon);
|
||||||
var intent = new Intent(context, typeof(MainActivity));
|
var intent = new Intent(context, typeof(MainActivity));
|
||||||
intent.PutExtra("autofillFramework", true);
|
intent.PutExtra("autofillFramework", true);
|
||||||
intent.PutExtra("autofillFrameworkUri", uri);
|
intent.PutExtra("autofillFrameworkUri", uri);
|
||||||
|
1379
src/Android/Resources/Resource.Designer.cs
generated
1379
src/Android/Resources/Resource.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@ -1,71 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/authLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:importantForAutofill="noExcludeDescendants"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="16dp">
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/master_login_header"
|
|
||||||
style="@style/TextAppearance.AppCompat.Large"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/password_label"
|
|
||||||
style="@style/TextAppearance.AppCompat.Body1"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:layout_marginTop="32dp"
|
|
||||||
android:labelFor="@+id/master_password"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/master_password"
|
|
||||||
app:layout_constraintHorizontal_chainStyle="packed"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/master_login_header" />
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/master_password"
|
|
||||||
android:layout_width="250sp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:inputType="textPassword"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/password_label"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/password_label"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/password_label" />
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/cancel"
|
|
||||||
style="@style/Widget.AppCompat.Button.Borderless"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:textColor="@android:color/holo_blue_dark"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/login"
|
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
|
||||||
app:layout_constraintHorizontal_chainStyle="packed"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/master_password" />
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/login"
|
|
||||||
style="@style/Widget.AppCompat.Button.Borderless"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:textColor="@android:color/holo_blue_dark"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/cancel"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/cancel" />
|
|
||||||
</android.support.constraint.ConstraintLayout>
|
|
@ -14,6 +14,9 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
|
android:maxWidth="25dp"
|
||||||
|
android:maxHeight="25dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
android:src="@drawable/login" />
|
android:src="@drawable/login" />
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -71,8 +71,6 @@
|
|||||||
<package id="Xam.Plugin.Connectivity" version="3.0.2" targetFramework="monoandroid71" />
|
<package id="Xam.Plugin.Connectivity" version="3.0.2" targetFramework="monoandroid71" />
|
||||||
<package id="Xam.Plugins.Settings" version="3.0.1" targetFramework="monoandroid71" />
|
<package id="Xam.Plugins.Settings" version="3.0.1" targetFramework="monoandroid71" />
|
||||||
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" />
|
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" />
|
||||||
<package id="Xamarin.Android.Support.Constraint.Layout" version="1.0.2.2" targetFramework="monoandroid80" />
|
|
||||||
<package id="Xamarin.Android.Support.Constraint.Layout.Solver" version="1.0.2.2" targetFramework="monoandroid80" />
|
|
||||||
<package id="Xamarin.Android.Support.Design" version="23.3.0" targetFramework="monoandroid60" />
|
<package id="Xamarin.Android.Support.Design" version="23.3.0" targetFramework="monoandroid60" />
|
||||||
<package id="Xamarin.Android.Support.v4" version="23.3.0" targetFramework="monoandroid60" />
|
<package id="Xamarin.Android.Support.v4" version="23.3.0" targetFramework="monoandroid60" />
|
||||||
<package id="Xamarin.Android.Support.v7.AppCompat" version="23.3.0" targetFramework="monoandroid60" />
|
<package id="Xamarin.Android.Support.v7.AppCompat" version="23.3.0" targetFramework="monoandroid60" />
|
||||||
|
Loading…
Reference in New Issue
Block a user