mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-04-04 13:27:36 +03:00
fix: Small changes
This commit is contained in:
parent
64bdcc2f32
commit
0d2c814b3d
5 changed files with 36 additions and 28 deletions
|
@ -6,7 +6,6 @@ apply plugin: 'kotlin-kapt'
|
|||
android {
|
||||
compileSdkVersion 32
|
||||
buildToolsVersion "32.0.0"
|
||||
ndkVersion "21.4.7075529"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.kunzisoft.keepass"
|
||||
|
|
|
@ -628,16 +628,16 @@ open class DatabaseTaskNotificationService : LockNotificationService(), Progress
|
|||
}
|
||||
}
|
||||
|
||||
fun updateMessage(resId: Int) {
|
||||
private fun updateMessage(resId: Int) {
|
||||
mProgressMessage.messageId = resId
|
||||
notifyProgressMessage()
|
||||
}
|
||||
|
||||
override fun updateMessageRetrievingDBKey() {
|
||||
override fun retrievingDatabaseKey() {
|
||||
updateMessage(R.string.retrieving_db_key)
|
||||
}
|
||||
|
||||
override fun updateMessageDecryptingDB() {
|
||||
override fun decryptingDatabase() {
|
||||
updateMessage(R.string.decrypting_db)
|
||||
}
|
||||
|
||||
|
|
|
@ -550,12 +550,13 @@ class Database(private val iconPackChooser: InterfaceIconPackChooser) {
|
|||
this.mDatabaseKDBX = databaseKDBX
|
||||
}
|
||||
|
||||
fun createData(databaseUri: Uri,
|
||||
fun createData(
|
||||
databaseUri: Uri,
|
||||
databaseName: String,
|
||||
rootName: String,
|
||||
templateGroupName: String?) {
|
||||
val newDatabase = DatabaseKDBX(databaseName, rootName, templateGroupName)
|
||||
setDatabaseKDBX(newDatabase)
|
||||
templateGroupName: String?
|
||||
) {
|
||||
setDatabaseKDBX(DatabaseKDBX(databaseName, rootName, templateGroupName))
|
||||
this.fileUri = databaseUri
|
||||
// Set Database state
|
||||
this.dataModifiedSinceLastLoading = false
|
||||
|
@ -781,10 +782,12 @@ class Database(private val iconPackChooser: InterfaceIconPackChooser) {
|
|||
}
|
||||
|
||||
@Throws(Exception::class)
|
||||
private fun readDatabaseStream(contentResolver: ContentResolver,
|
||||
private fun readDatabaseStream(
|
||||
contentResolver: ContentResolver,
|
||||
databaseUri: Uri,
|
||||
openDatabaseKDB: (InputStream) -> Unit,
|
||||
openDatabaseKDBX: (InputStream) -> Unit) {
|
||||
openDatabaseKDBX: (InputStream) -> Unit
|
||||
) {
|
||||
try {
|
||||
// Load Data, pass Uris as InputStreams
|
||||
val databaseStream = contentResolver.getUriInputStream(databaseUri)
|
||||
|
@ -821,11 +824,13 @@ class Database(private val iconPackChooser: InterfaceIconPackChooser) {
|
|||
}
|
||||
|
||||
@Throws(DatabaseOutputException::class)
|
||||
fun saveData(contentResolver: ContentResolver,
|
||||
fun saveData(
|
||||
contentResolver: ContentResolver,
|
||||
cacheDir: File,
|
||||
databaseCopyUri: Uri?,
|
||||
mainCredential: MainCredential?,
|
||||
challengeResponseRetriever: (HardwareKey, ByteArray?) -> ByteArray) {
|
||||
challengeResponseRetriever: (HardwareKey, ByteArray?) -> ByteArray
|
||||
) {
|
||||
val saveUri = databaseCopyUri ?: this.fileUri
|
||||
// Build temp database file to avoid file corruption if error
|
||||
val cacheFile = File(cacheDir, saveUri.hashCode().toString())
|
||||
|
@ -915,15 +920,19 @@ class Database(private val iconPackChooser: InterfaceIconPackChooser) {
|
|||
return false
|
||||
}
|
||||
|
||||
fun createVirtualGroupFromSearch(searchParameters: SearchParameters,
|
||||
fun createVirtualGroupFromSearch(
|
||||
searchParameters: SearchParameters,
|
||||
fromGroup: NodeId<*>? = null,
|
||||
max: Int = Integer.MAX_VALUE): Group? {
|
||||
max: Int = Integer.MAX_VALUE
|
||||
): Group? {
|
||||
return mSearchHelper.createVirtualGroupWithSearchResult(this,
|
||||
searchParameters, fromGroup, max)
|
||||
}
|
||||
|
||||
fun createVirtualGroupFromSearchInfo(searchInfoString: String,
|
||||
max: Int = Integer.MAX_VALUE): Group? {
|
||||
fun createVirtualGroupFromSearchInfo(
|
||||
searchInfoString: String,
|
||||
max: Int = Integer.MAX_VALUE
|
||||
): Group? {
|
||||
return mSearchHelper.createVirtualGroupWithSearchResult(this,
|
||||
SearchParameters().apply {
|
||||
searchQuery = searchInfoString
|
||||
|
|
|
@ -40,7 +40,7 @@ abstract class DatabaseInput<D : DatabaseVersioned<*, *, *, *>> (protected var m
|
|||
assignMasterKey: (() -> Unit)): D
|
||||
|
||||
protected fun startKeyTimer(progressTaskUpdater: ProgressTaskUpdater?) {
|
||||
progressTaskUpdater?.updateMessageRetrievingDBKey()
|
||||
progressTaskUpdater?.retrievingDatabaseKey()
|
||||
Log.d(TAG, "Start retrieving database key...")
|
||||
startTimeKey = System.currentTimeMillis()
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ abstract class DatabaseInput<D : DatabaseVersioned<*, *, *, *>> (protected var m
|
|||
}
|
||||
|
||||
protected fun startContentTimer(progressTaskUpdater: ProgressTaskUpdater?) {
|
||||
progressTaskUpdater?.updateMessageDecryptingDB()
|
||||
progressTaskUpdater?.decryptingDatabase()
|
||||
Log.d(TAG, "Start decrypting database content...")
|
||||
startTimeContent = System.currentTimeMillis()
|
||||
}
|
||||
|
|
|
@ -20,6 +20,6 @@
|
|||
package com.kunzisoft.keepass.tasks
|
||||
|
||||
interface ProgressTaskUpdater {
|
||||
fun updateMessageRetrievingDBKey()
|
||||
fun updateMessageDecryptingDB()
|
||||
fun retrievingDatabaseKey()
|
||||
fun decryptingDatabase()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue