Skip to content

Commit

Permalink
Merge branch 'release/2.8.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Jamet committed Jul 17, 2020
2 parents fea4da2 + 1c11e16 commit ffad62e
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 69 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
KeePassDX(2.8.1)
* Capture exceptions in coroutines

KeePassDX(2.8)
* Fix TOTP period (> 60s)
* Fix searching in recycle bin
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId "com.kunzisoft.keepass"
minSdkVersion 14
targetSdkVersion 29
versionCode = 36
versionName = "2.8"
versionCode = 37
versionName = "2.8.1"
multiDexEnabled true

testApplicationId = "com.kunzisoft.keepass.tests"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ open class PasswordActivity : SpecialModeActivity() {
if (resultMessage != null && resultMessage.isNotEmpty()) {
resultError = "$resultError $resultMessage"
}
Log.e(TAG, resultError, resultException)
Log.e(TAG, resultError)
Snackbar.make(activity_password_coordinator_layout,
resultError,
Snackbar.LENGTH_LONG).asError().show()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,8 @@ class Database {
loaded = true

} catch (e: LoadDatabaseException) {
Log.e("KPD", "Database::loadData", e)
throw e
} catch (e: Exception) {
Log.e("KPD", "Database::loadData", e)
throw FileNotFoundDatabaseException()
} finally {
keyFileInputStream?.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.IBinder
import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.activities.GroupActivity
import com.kunzisoft.keepass.database.element.Database
Expand All @@ -47,11 +48,16 @@ class DatabaseOpenNotificationService: LockNotificationService() {
super.actionOnLock()
}

override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
super.onStartCommand(intent, flags, startId)
private fun checkIntent(intent: Intent?) {
val notificationBuilder = buildNewNotification().apply {
setSmallIcon(R.drawable.notification_ic_database_open)
setContentTitle(getString(R.string.database_opened))
setAutoCancel(false)
}

when(intent?.action) {
ACTION_CLOSE_DATABASE -> {
startForeground(notificationId, notificationBuilder.build())
stopNotificationAndSendLock()
}
else -> {
Expand All @@ -68,23 +74,30 @@ class DatabaseOpenNotificationService: LockNotificationService() {

val database = Database.getInstance()
if (database.loaded) {
startForeground(notificationId, buildNewNotification().apply {
setSmallIcon(R.drawable.notification_ic_database_open)
setContentTitle(getString(R.string.database_opened))
startForeground(notificationId, notificationBuilder.apply {
setContentText(database.name + " (" + database.version + ")")
setAutoCancel(false)
setContentIntent(pendingDatabaseIntent)
// Unfortunately swipe is disabled in lollipop+
setDeleteIntent(pendingDeleteIntent)
addAction(R.drawable.ic_lock_white_24dp, getString(R.string.lock),
pendingDeleteIntent)
}.build())
} else {
startForeground(notificationId, notificationBuilder.build())
stopSelf()
}
}
}
}

override fun onBind(intent: Intent): IBinder? {
checkIntent(intent)
return super.onBind(intent)
}

override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
super.onStartCommand(intent, flags, startId)
checkIntent(intent)
return START_STICKY
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,13 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat
}
}

override fun onBind(intent: Intent): IBinder? {
return mActionTaskBinder
}

override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
super.onStartCommand(intent, flags, startId)

if (intent == null) return START_REDELIVER_INTENT

val intentAction = intent.action

private fun buildNotification(intent: Intent?) {
var saveAction = true
if (intent.hasExtra(SAVE_DATABASE_KEY)) {
if (intent != null && intent.hasExtra(SAVE_DATABASE_KEY)) {
saveAction = intent.getBooleanExtra(SAVE_DATABASE_KEY, saveAction)
}

val intentAction = intent?.action
val titleId: Int = when (intentAction) {
ACTION_DATABASE_CREATE_TASK -> R.string.creating_database
ACTION_DATABASE_LOAD_TASK -> R.string.loading_database
Expand All @@ -127,6 +118,31 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat
else
R.string.do_not_kill_app

// Assign elements for updates
mTitleId = titleId
mMessageId = messageId
mWarningId = warningId
// Create the notification
startForeground(notificationId, buildNewNotification()
.setSmallIcon(R.drawable.notification_ic_database_load)
.setContentTitle(getString(intent?.getIntExtra(DATABASE_TASK_TITLE_KEY, titleId) ?: titleId))
.setAutoCancel(false)
.setContentIntent(null).build())
}

override fun onBind(intent: Intent): IBinder? {
buildNotification(intent)
return mActionTaskBinder
}

override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
super.onStartCommand(intent, flags, startId)

buildNotification(intent)

if (intent == null) return START_REDELIVER_INTENT

val intentAction = intent.action
val actionRunnable: ActionRunnable? = when (intentAction) {
ACTION_DATABASE_CREATE_TASK -> buildDatabaseCreateActionTask(intent)
ACTION_DATABASE_LOAD_TASK -> buildDatabaseLoadActionTask(intent)
Expand Down Expand Up @@ -157,26 +173,19 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat
}

actionRunnable?.let { actionRunnableNotNull ->
// Assign elements for updates
mTitleId = titleId
mMessageId = messageId
mWarningId = warningId

// Create the notification
newNotification(intent.getIntExtra(DATABASE_TASK_TITLE_KEY, titleId))

// Build and launch the action
mainScope.launch {
executeAction(this@DatabaseTaskNotificationService,
{
sendBroadcast(Intent(DATABASE_START_TASK_ACTION).apply {
putExtra(DATABASE_TASK_TITLE_KEY, titleId)
putExtra(DATABASE_TASK_MESSAGE_KEY, messageId)
putExtra(DATABASE_TASK_WARNING_KEY, warningId)
putExtra(DATABASE_TASK_TITLE_KEY, mTitleId)
putExtra(DATABASE_TASK_MESSAGE_KEY, mMessageId)
putExtra(DATABASE_TASK_WARNING_KEY, mWarningId)
})

mActionTaskListeners.forEach { actionTaskListener ->
actionTaskListener.onStartAction(titleId, messageId, warningId)
actionTaskListener.onStartAction(mTitleId, mMessageId, mWarningId)
}

},
Expand Down Expand Up @@ -208,8 +217,6 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat
onPostExecute: (result: ActionRunnable.Result) -> Unit) {
mAllowFinishAction.set(false)

// Stop the opening notification
DatabaseOpenNotificationService.stop(this)
TimeoutHelper.temporarilyDisableTimeout()
onPreExecute.invoke()
withContext(Dispatchers.IO) {
Expand All @@ -228,27 +235,20 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat
result
}
withContext(Dispatchers.Main) {
onPostExecute.invoke(asyncResult.await())
TimeoutHelper.releaseTemporarilyDisableTimeout()
// Start the opening notification
if (TimeoutHelper.checkTimeAndLockIfTimeout(this@DatabaseTaskNotificationService)) {
DatabaseOpenNotificationService.start(this@DatabaseTaskNotificationService)
try {
onPostExecute.invoke(asyncResult.await())
} finally {
TimeoutHelper.releaseTemporarilyDisableTimeout()
// Start the opening notification
if (TimeoutHelper.checkTimeAndLockIfTimeout(this@DatabaseTaskNotificationService)) {
DatabaseOpenNotificationService.start(this@DatabaseTaskNotificationService)
}
}
}
}
}
}

private fun newNotification(title: Int) {

val builder = buildNewNotification()
.setSmallIcon(R.drawable.notification_ic_database_load)
.setContentTitle(getString(title))
.setAutoCancel(false)
.setContentIntent(null)
startForeground(notificationId, builder.build())
}

override fun updateMessage(resId: Int) {
mMessageId = resId
mActionTaskListeners.forEach { actionTaskListener ->
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/com/kunzisoft/keepass/tasks/ActionRunnable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package com.kunzisoft.keepass.tasks

import android.os.Bundle
import android.util.Log
import com.kunzisoft.keepass.database.exception.DatabaseException

/**
Expand Down Expand Up @@ -48,18 +49,26 @@ abstract class ActionRunnable: Runnable {
result.isSuccess = false
result.exception = null
result.message = message
showLog()
}

protected fun setError(exception: Exception) {
result.isSuccess = false
result.exception = null
result.message = exception.message
showLog()
}

protected fun setError(exception: DatabaseException) {
result.isSuccess = false
result.exception = exception
result.message = exception.message
showLog()
}

private fun showLog() {
val message = if (result.message != null) ", message=${result.message}" else ""
Log.e(TAG, "success=${result.isSuccess}$message", result.exception)
}

/**
Expand All @@ -69,4 +78,8 @@ abstract class ActionRunnable: Runnable {
var message: String? = null,
var exception: DatabaseException? = null,
var data: Bundle? = null)

companion object {
private const val TAG = "ActionRunnable"
}
}
5 changes: 5 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@
<string name="keyboard_keys_category">Touches</string>
<string name="keyboard_key_vibrate_title">Touches vibrantes</string>
<string name="keyboard_key_sound_title">Appui clavier audible</string>
<string name="keyboard_change">Changement de clavier</string>
<string name="keyboard_previous_database_credentials_title">Écran des identifications de la base de données</string>
<string name="keyboard_previous_database_credentials_summary">Revenir automatiquement au clavier précédent sur l\'écran des identifications de la base de données</string>
<string name="keyboard_previous_fill_in_title">Action de touche automatique</string>
<string name="keyboard_previous_fill_in_summary">Revenir automatiquement au clavier précédent après avoir exécuté "Action de touche automatique"</string>
<string name="selection_mode">Mode sélection</string>
<string name="do_not_kill_app">Veuillez ne pas tuer l’application…</string>
<string name="lock_database_back_root_title">Appuyer sur « Retour » pour verrouiller</string>
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,11 @@
<string name="keyboard_auto_go_action_summary">\"Go\" key action after pressing a \"Field\" key</string>
<string name="keyboard_key_vibrate_title">Vibratory keypresses</string>
<string name="keyboard_key_sound_title">Audible keypresses</string>
<string name="keyboard_change">Keyboard change</string>
<string name="keyboard_previous_database_credentials_title">Previous keyboard during database credentials</string>
<string name="keyboard_previous_database_credentials_summary">Automatically back to the previous keyboard if the database credentials screen is shown</string>
<string name="keyboard_previous_fill_in_title">Previous keyboard after form filling</string>
<string name="keyboard_previous_fill_in_summary">Automatically back to the previous keyboard if the form is filling and "Go" key action is auto activated</string>
<string name="keyboard_change">Switch keyboard</string>
<string name="keyboard_previous_database_credentials_title">Database credentials screen</string>
<string name="keyboard_previous_database_credentials_summary">Automatically switch back to the previous keyboard on the database credentials screen</string>
<string name="keyboard_previous_fill_in_title">Auto key action</string>
<string name="keyboard_previous_fill_in_summary">Automatically switch back to the previous keyboard after executing "Auto key action"</string>
<string name="autofill_auto_search_title">Auto search</string>
<string name="autofill_auto_search_summary">Automatically suggest search results from the web domain or application ID</string>
<string name="autofill_application_id_blocklist_title">Application blocklist</string>
Expand Down
2 changes: 1 addition & 1 deletion fastlane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Install _fastlane_ using
```
[sudo] gem install fastlane -NV
```
or alternatively using `brew cask install fastlane`
or alternatively using `brew install fastlane`

# Available Actions
## Android
Expand Down
7 changes: 1 addition & 6 deletions fastlane/metadata/android/en-US/changelogs/36.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
* Fix TOTP period (> 60s)
* Fix searching in recycle bin
* Settings to back to the previous keyboard during database credentials and after form filling
* Improving action tasks
* Improve recognition to reset app timeout
* Fix minor issues
* Capture exceptions in coroutines

7 changes: 1 addition & 6 deletions fastlane/metadata/android/fr-FR/changelogs/36.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
* Correction de la période pour le TOTP (> 60s)
* Correction de la recherche dans la corbeille
* Paramètres pour revenir automatiquement au clavier précédent durant l'identification de la base et après le remplissage de formulaire
* Amélioration des tâches d'action
* Amélioration de la reconnaissance pour le temps écoulé
* Correction de problèmes mineurs
* Capture des exceptions dans les coroutines

0 comments on commit ffad62e

Please sign in to comment.