1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-14 23:33:34 +00:00

[BEEEP] Support for automatic TOTP token copy via external autofill (Android) (#2220)

* Android: Support for automatic TOTP copy via external autofill

* update iOS autofill interface

* additional tweaks
This commit is contained in:
mp-bw
2022-12-05 12:49:34 -05:00
committed by GitHub
parent bafd9ff85d
commit 6973a0b71c
11 changed files with 115 additions and 43 deletions

View File

@@ -73,12 +73,12 @@ namespace Bit.Droid.Services
public void Autofill(CipherView cipher)
{
var activity = (MainActivity)CrossCurrentActivity.Current.Activity;
var activity = CrossCurrentActivity.Current.Activity as Xamarin.Forms.Platform.Android.FormsAppCompatActivity;
if (activity == null)
{
return;
}
if (activity.Intent?.GetBooleanExtra("autofillFramework", false) ?? false)
if (activity.Intent?.GetBooleanExtra(AutofillConstants.AutofillFramework, false) ?? false)
{
if (cipher == null)
{
@@ -103,7 +103,7 @@ namespace Bit.Droid.Services
return;
}
var task = CopyTotpAsync(cipher);
var dataset = AutofillHelpers.BuildDataset(activity, parser.FieldCollection, new FilledItem(cipher));
var dataset = AutofillHelpers.BuildDataset(activity, parser.FieldCollection, new FilledItem(cipher), false);
var replyIntent = new Intent();
replyIntent.PutExtra(AutofillManager.ExtraAuthenticationResult, dataset);
activity.SetResult(Result.Ok, replyIntent);