mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-11-22 09:12:17 -05:00
Merge branch 'AlexVallat/Keepass2AndroidPerfOpt'
Conflicts: src/Kp2aBusinessLogic/database/edit/LoadDB.cs
This commit is contained in:
commit
e014b2c185
@ -17,6 +17,7 @@ This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using KeePassLib.Serialization;
|
using KeePassLib.Serialization;
|
||||||
|
|
||||||
@ -56,11 +57,25 @@ namespace keepass2android
|
|||||||
Kp2aLog.Log("KeyFileException");
|
Kp2aLog.Log("KeyFileException");
|
||||||
Finish(false, /*TODO Localize: use Keepass error text KPRes.KeyFileError (including "or invalid format")*/ _app.GetResourceString(UiStringKey.keyfile_does_not_exist));
|
Finish(false, /*TODO Localize: use Keepass error text KPRes.KeyFileError (including "or invalid format")*/ _app.GetResourceString(UiStringKey.keyfile_does_not_exist));
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (AggregateException e)
|
||||||
|
{
|
||||||
|
string message = e.Message;
|
||||||
|
foreach (var innerException in e.InnerExceptions)
|
||||||
|
{
|
||||||
|
message = innerException.Message; // Override the message shown with the last (hopefully most recent) inner exception
|
||||||
|
Kp2aLog.Log("Exception: " + message);
|
||||||
|
}
|
||||||
|
Finish(false, "An error occured: " + message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
Kp2aLog.Log("Exception: " + e);
|
Kp2aLog.Log("Exception: " + e);
|
||||||
Finish(false, "An error occured: " + e.Message);
|
Finish(false, "An error occured: " + e.Message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* catch (InvalidPasswordException e) {
|
/* catch (InvalidPasswordException e) {
|
||||||
finish(false, Ctx.GetString(Resource.String.InvalidPassword));
|
finish(false, Ctx.GetString(Resource.String.InvalidPassword));
|
||||||
return;
|
return;
|
||||||
|
@ -59,7 +59,7 @@ namespace keepass2android
|
|||||||
private bool _rememberKeyfile;
|
private bool _rememberKeyfile;
|
||||||
ISharedPreferences _prefs;
|
ISharedPreferences _prefs;
|
||||||
|
|
||||||
private bool _started;
|
private bool _starting;
|
||||||
|
|
||||||
public PasswordActivity (IntPtr javaReference, JniHandleOwnership transfer)
|
public PasswordActivity (IntPtr javaReference, JniHandleOwnership transfer)
|
||||||
: base(javaReference, transfer)
|
: base(javaReference, transfer)
|
||||||
@ -370,7 +370,7 @@ namespace keepass2android
|
|||||||
protected override void OnStart()
|
protected override void OnStart()
|
||||||
{
|
{
|
||||||
base.OnStart();
|
base.OnStart();
|
||||||
_started = true;
|
_starting = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MemoryStream LoadDbFile()
|
private MemoryStream LoadDbFile()
|
||||||
@ -411,9 +411,9 @@ namespace keepass2android
|
|||||||
|
|
||||||
// OnResume is run every time the activity comes to the foreground. This code should only run when the activity is started (OnStart), but must
|
// OnResume is run every time the activity comes to the foreground. This code should only run when the activity is started (OnStart), but must
|
||||||
// be run in OnResume rather than OnStart so that it always occurrs after OnActivityResult (when re-creating a killed activity, OnStart occurs before OnActivityResult)
|
// be run in OnResume rather than OnStart so that it always occurrs after OnActivityResult (when re-creating a killed activity, OnStart occurs before OnActivityResult)
|
||||||
if (_started && !IsFinishing) //use !IsFinishing to make sure we're not starting another activity when we're already finishing (e.g. due to TaskComplete in OnActivityResult)
|
if (_starting && !IsFinishing) //use !IsFinishing to make sure we're not starting another activity when we're already finishing (e.g. due to TaskComplete in OnActivityResult)
|
||||||
{
|
{
|
||||||
_started = false;
|
_starting = false;
|
||||||
if (App.Kp2a.DatabaseIsUnlocked)
|
if (App.Kp2a.DatabaseIsUnlocked)
|
||||||
{
|
{
|
||||||
LaunchNextActivity();
|
LaunchNextActivity();
|
||||||
|
Loading…
Reference in New Issue
Block a user