improve app stability and refactor to get better logs
This commit is contained in:
@@ -476,8 +476,16 @@ namespace Kp2aAutofillParser
|
||||
|
||||
foreach (var field in autofillFields.HintMap.Values.Distinct())
|
||||
{
|
||||
if (field == null || field.AutofillHints == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
foreach (var hint in field.AutofillHints)
|
||||
{
|
||||
if (hint == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (GetPartitionIndex(hint) == partitionIndex)
|
||||
{
|
||||
filteredCollection.Add(field);
|
||||
|
||||
@@ -15,7 +15,14 @@ namespace KeePass.Util
|
||||
string errorMessage = e.Message;
|
||||
if (e is Java.Lang.Exception javaException)
|
||||
{
|
||||
errorMessage = javaException.LocalizedMessage ?? javaException.Message ?? errorMessage;
|
||||
try
|
||||
{
|
||||
errorMessage = javaException.LocalizedMessage ?? javaException.Message ?? errorMessage;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return errorMessage;
|
||||
|
||||
@@ -14,7 +14,7 @@ using keepass2android;
|
||||
|
||||
namespace keepass2android
|
||||
{
|
||||
[Activity(Label = AppNames.AppName)]
|
||||
[Activity(Label = AppNames.AppName, Theme = "@style/Kp2aTheme_BlueNoActionBar")]
|
||||
public class AppKilledInfo : Activity, IDialogInterfaceOnDismissListener
|
||||
{
|
||||
protected override void OnCreate(Bundle bundle)
|
||||
|
||||
@@ -894,9 +894,14 @@ namespace keepass2android
|
||||
RegisterInfoTextDisplay(
|
||||
"DbReadOnly"); //this ensures that we don't show the general info texts too soon
|
||||
|
||||
FindViewById<TextView>(Resource.Id.dbreadonly_infotext_text).Text =
|
||||
(GetString(Resource.String.FileReadOnlyMessagePre) + " " +
|
||||
App.Kp2a.GetResourceString(reason.Result));
|
||||
var infotext_view = FindViewById<TextView>(Resource.Id.dbreadonly_infotext_text);
|
||||
if (infotext_view != null)
|
||||
{
|
||||
infotext_view.Text =
|
||||
(GetString(Resource.String.FileReadOnlyMessagePre) + " " +
|
||||
App.Kp2a.GetResourceString(reason.Result));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
UpdateBottomBarElementVisibility(Resource.Id.dbreadonly_infotext, canShow);
|
||||
|
||||
@@ -1245,7 +1245,7 @@ namespace keepass2android
|
||||
{
|
||||
var db = TryFindDatabaseForElement(element);
|
||||
if (db == null)
|
||||
throw new Exception("Database element not found!");
|
||||
throw new Exception($"Database element {element.Uuid} not found in any of {OpenDatabases.Count()} databases!");
|
||||
return db;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ using Android.Content.Res;
|
||||
using Android.Preferences;
|
||||
using Google.Android.Material.Dialog;
|
||||
using keepass2android;
|
||||
using PluginTOTP;
|
||||
|
||||
namespace keepass2android
|
||||
{
|
||||
@@ -638,19 +639,7 @@ namespace keepass2android
|
||||
|
||||
if (CopyTotpToClipboard && isTotpEntry)
|
||||
{
|
||||
Dictionary<string, string> entryFields = pwEntryOutput.OutputStrings.ToDictionary(pair => StrUtil.SafeXmlString(pair.Key), pair => pair.Value.ReadString());
|
||||
var totpData= totpPluginAdapter.GetTotpData(entryFields, activity, true);
|
||||
if (totpData.IsTotpEntry)
|
||||
{
|
||||
TOTPProvider prov = new TOTPProvider(totpData);
|
||||
string totp = prov.GenerateByByte(totpData.TotpSecret);
|
||||
CopyToClipboardService.CopyValueToClipboardWithTimeout(activity, totp, true);
|
||||
|
||||
App.Kp2a.ShowMessage(activity, activity.GetString(Resource.String.TotpCopiedToClipboard),
|
||||
MessageSeverity.Info);
|
||||
}
|
||||
|
||||
|
||||
DoCopyTotpToClipboard(activity, pwEntryOutput, totpPluginAdapter);
|
||||
}
|
||||
|
||||
if (CloseAfterCreate)
|
||||
@@ -661,7 +650,23 @@ namespace keepass2android
|
||||
activity.CloseAfterTaskComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void DoCopyTotpToClipboard(EntryActivity activity, PwEntryOutput pwEntryOutput,
|
||||
ITotpPluginAdapter? totpPluginAdapter)
|
||||
{
|
||||
Dictionary<string, string> entryFields = pwEntryOutput.OutputStrings.ToDictionary(pair => StrUtil.SafeXmlString(pair.Key), pair => pair.Value.ReadString());
|
||||
var totpData = totpPluginAdapter.GetTotpData(entryFields, activity, true);
|
||||
if (totpData.IsTotpEntry)
|
||||
{
|
||||
TOTPProvider prov = new TOTPProvider(totpData);
|
||||
string totp = prov.GenerateByByte(totpData.TotpSecret);
|
||||
CopyToClipboardService.CopyValueToClipboardWithTimeout(activity, totp, true);
|
||||
|
||||
App.Kp2a.ShowMessage(activity, activity.GetString(Resource.String.TotpCopiedToClipboard),
|
||||
MessageSeverity.Info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace keepass2android.services.AutofillBase
|
||||
{
|
||||
var intent = Intent;
|
||||
AssistStructure structure = (AssistStructure)intent.GetParcelableExtra(AutofillManager.ExtraAssistStructure);
|
||||
if (structure == null)
|
||||
if (structure == null || clientFormDataMap == null)
|
||||
{
|
||||
SetResult(Result.Canceled);
|
||||
Finish();
|
||||
|
||||
Reference in New Issue
Block a user