Made pre-loading optional

Refactoring of PasswordActivity/QuickUnlock lifecycle
This commit is contained in:
AlexVallat
2013-08-07 18:34:43 +01:00
parent 518479904a
commit b9aad79b62
9 changed files with 595 additions and 586 deletions

View File

@@ -109,7 +109,7 @@ namespace keepass2android
var filename = fileStorage.GetFilenameWithoutPathAndExt(iocInfo);
try
{
pwDatabase.Open(databaseData, filename, iocInfo, compositeKey, status);
pwDatabase.Open(databaseData ?? fileStorage.OpenFileForRead(iocInfo), filename, iocInfo, compositeKey, status);
}
catch (Exception)
{
@@ -118,8 +118,11 @@ namespace keepass2android
//if we don't get a password, we don't know whether this means "empty password" or "no password"
//retry without password:
compositeKey.RemoveUserKey(compositeKey.GetUserKey(typeof (KcpPassword)));
databaseData.Seek(0, SeekOrigin.Begin);
pwDatabase.Open(databaseData, filename, iocInfo, compositeKey, status);
if (databaseData != null)
{
databaseData.Seek(0, SeekOrigin.Begin);
}
pwDatabase.Open(databaseData ?? fileStorage.OpenFileForRead(iocInfo), filename, iocInfo, compositeKey, status);
}
else throw;
}

View File

@@ -48,7 +48,7 @@ namespace keepass2android
try
{
StatusLogger.UpdateMessage(UiStringKey.loading_database);
_app.LoadDatabase(_ioc, _databaseData.Result, _pass, _key, StatusLogger);
_app.LoadDatabase(_ioc, _databaseData == null ? null : _databaseData.Result, _pass, _key, StatusLogger);
SaveFileData (_ioc, _key);
} catch (KeyFileException) {