Compare commits

..

2 Commits

6 changed files with 32 additions and 14 deletions

View File

@@ -445,6 +445,9 @@ namespace Kp2aAutofillParser
public static string ToCanonicalHint(string hint)
{
//avoid crash when looking up a null key
if (hint == null)
return "";
string canonicalHint;
if (!hintToCanonicalReplacement.TryGetValue(hint, out canonicalHint))
canonicalHint = hint;
@@ -841,6 +844,7 @@ namespace Kp2aAutofillParser
continue;
if (viewHints.Where(h => h != null).Select(AutofillHintsHelper.ToCanonicalHint).Intersect(_autofillHintsForLogin).Any())
{
AddFieldToHintMap(viewNode, viewHints.Where(h => h != null).Select(AutofillHintsHelper.ToCanonicalHint).ToHashSet().ToArray());
}

View File

@@ -37,7 +37,6 @@ using System.Net;
using System.Text;
using Android.Content.Res;
using Android.Database;
using Android.Gms.Common;
using Android.Gms.Tasks;
using Android.Graphics;
using Android.Graphics.Drawables;
@@ -1156,12 +1155,6 @@ namespace keepass2android
dlgView.FindViewById<Button>(Resource.Id.totp_scan).Click += async (object o, EventArgs args) =>
{
if (GoogleApiAvailability.Instance.IsGooglePlayServicesAvailable(this) != ConnectionResult.Success)
{
Toast.MakeText(this, Resource.String.qr_scanning_error_no_google_play_services, ToastLength.Long);
return;
}
GmsBarcodeScannerOptions options = new GmsBarcodeScannerOptions.Builder()
.SetBarcodeFormats(Barcode.FormatQrCode)
.Build();

View File

@@ -0,0 +1,24 @@
using Android.Content.PM;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace keepass2android
{
[Activity(Label = AppNames.AppName,
MainLauncher = false,
Theme = "@style/Kp2aTheme_BlueNoActionBar",
Exported = true)]
///For autofill, we sometimes need to pass an intent to an inline presentation which never gets fired. We use this as a dummy activity.
public class NullActivity: Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
Kp2aLog.Log("NullActivity.OnCreate - this is unexpected.");
base.OnCreate(savedInstanceState);
Finish();
}
}
}

View File

@@ -548,7 +548,6 @@
<string name="filestoragename_dropboxKP2A">Dropbox (KP2A folder)</string>
<string name="filestoragehelp_dropboxKP2A">If you do not want to give KP2A access to your full Dropbox, you may select this option. It will request only access to the folder Apps/Keepass2Android. This is especially suited when creating a new database. If you already have a database, select this option to create the folder, then place your file inside the folder (from your PC) and then select this option again for opening the file.</string>
<string name="filestoragename_gdrive">Google Drive</string>
<string name="filestoragehelp_gdrive">Please note: Google is restricting access to Google Drive from apps for more and more users. If the built-in Google Drive implementation does not work, please use System file picker instead and select Google Drive there!</string>
<string name="filestoragename_gdriveKP2A">Google Drive (KP2A files)</string>
<string name="filestoragehelp_gdriveKP2A">If you do not want to give KP2A access to your full Google Drive, you may select this option. Note that you need to create a database file first, existing files are not visible to the app. Either choose this option from the Create database screen or, if you already opened a database, by exporting the database choosing this option.</string>
<string name="filestoragename_pcloud">PCloud (KP2A folder)</string>
@@ -1246,7 +1245,6 @@
<string name="AutofillWarning_trustAsBrowser">Accept always in "%1$s"</string>
<string name="kp2a_switch_on_sendgodone">Switch back when done</string>
<string name="kp2a_switch_on_sendgodone_summary">Switch back when pressing send/go/done</string>
<string name="qr_scanning_error_no_google_play_services">QR code scanning requires Google Play Services. Please install or update Google Play Services on your device.</string>
<string name="english_ime_settings">Android keyboard settings</string>
</resources>

View File

@@ -30,10 +30,9 @@ namespace keepass2android.services.AutofillBase
{
return null;
}
//make sure we have a pendingIntent always not null
pendingIntent ??= PendingIntent.GetService(context, 0, new Intent(),
Util.AddMutabilityFlag(PendingIntentFlags.OneShot | PendingIntentFlags.UpdateCurrent, PendingIntentFlags.Mutable));
// If the pending intent is null, we need to create a dummy one to avoid a crash
pendingIntent ??= PendingIntent.GetActivity(context, 0, new Intent(context, typeof(NullActivity)), PendingIntentFlags.OneShot | PendingIntentFlags.UpdateCurrent | PendingIntentFlags.Immutable);
var slice = CreateInlinePresentationSlice(
inlinePresentationSpec,
text,

View File

@@ -405,7 +405,7 @@ namespace keepass2android.services.AutofillBase
var datasetBuilder = new Dataset.Builder(presentation);
datasetBuilder.SetAuthentication(pendingIntent?.IntentSender);
AutofillHelper.AddInlinePresentation(this, inlinePresentationSpec, text, datasetBuilder, Resource.Drawable.baseline_close_24, null);
AutofillHelper.AddInlinePresentation(this, inlinePresentationSpec, text, datasetBuilder, Resource.Drawable.baseline_close_24, pendingIntent);
foreach (var autofillId in autofillIds)
{