Skip to content

Commit

Permalink
Merge branch 'release/3.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Jamet committed Sep 7, 2021
2 parents e6f082a + 8dd6c33 commit 82450c0
Show file tree
Hide file tree
Showing 258 changed files with 13,846 additions and 6,059 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
KeePassDX(3.0.0)
* Add / Manage dynamic templates #191
* Manually select RecycleBin group and Templates group #191
* Setting to display OTP Token in list #655
* Fix timeout in dialogs #716
* Check URI permissions #626
* Better autofill implementation #943 #946 #984 #1070 (Thx @uduerholz)
* Improvements #680 #1035 #1043 #942 #1021 #1027 #1046 #1082 #1083 (Thx @chenxiaolong)

KeePassDX(2.10.5)
* Increase the saving speed of database #1028
* Fix advanced unlocking by device credential #1029
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 15
targetSdkVersion 30
versionCode = 83
versionName = "2.10.5"
versionCode = 87
versionName = "3.0.0"
multiDexEnabled true

testApplicationId = "com.kunzisoft.keepass.tests"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.kunzisoft.keepass.tests.template

import com.kunzisoft.keepass.database.element.template.TemplateAttributeOption
import junit.framework.TestCase
import org.junit.Assert

class TemplateAttributeOptionTest: TestCase() {

fun testSerializeOptions() {
val options = TemplateAttributeOption().apply {
put("TestA", "TestB")
put("{D", "}C")
put("E,gyu", "15,jk")
put("ù*:**", "78:96?545")
}

val strings = TemplateAttributeOption.getStringFromOptions(options)
val optionsAfterSerialization = TemplateAttributeOption.getOptionsFromString(strings)
val otherString = TemplateAttributeOption.getStringFromOptions(optionsAfterSerialization)

Assert.assertEquals("Output not equal to input", strings, otherString)
}

}
7 changes: 3 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
android:label="@string/app_name"
android:launchMode="singleTop"
android:configChanges="keyboardHidden"
android:windowSoftInputMode="stateHidden" >
android:windowSoftInputMode="stateHidden|stateAlwaysHidden" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down Expand Up @@ -112,8 +112,7 @@
<activity
android:name="com.kunzisoft.keepass.activities.GroupActivity"
android:configChanges="keyboardHidden"
android:windowSoftInputMode="adjustPan"
android:launchMode="singleTask">
android:windowSoftInputMode="adjustPan">
<meta-data
android:name="android.app.default_searchable"
android:value="com.kunzisoft.keepass.search.SearchResults"
Expand Down Expand Up @@ -209,7 +208,7 @@
</intent-filter>
</service>
<service
android:name="com.kunzisoft.keepass.magikeyboard.MagikIME"
android:name="com.kunzisoft.keepass.magikeyboard.MagikeyboardService"
android:label="@string/keyboard_label"
android:permission="android.permission.BIND_INPUT_METHOD" >
<meta-data android:name="android.view.im"
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/com/igreenwood/loupe/Loupe.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ package com.igreenwood.loupe
import android.animation.Animator
import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.annotation.SuppressLint
import android.graphics.Matrix
import android.graphics.PointF
import android.graphics.Rect
Expand Down Expand Up @@ -108,6 +109,8 @@ class Loupe(imageView: ImageView, container: ViewGroup) : View.OnTouchListener,
var viewDragFriction = DEFAULT_VIEW_DRAG_FRICTION
// drag distance threshold in dp for swipe to dismiss
var dragDismissDistanceInDp = DEFAULT_DRAG_DISMISS_DISTANCE_IN_DP
// on view touched
var onViewTouchedListener: View.OnTouchListener? = null
// on view translate listener
var onViewTranslateListener: OnViewTranslateListener? = null
// on scale changed
Expand Down Expand Up @@ -272,7 +275,10 @@ class Loupe(imageView: ImageView, container: ViewGroup) : View.OnTouchListener,
private var imageViewRef: WeakReference<ImageView> = WeakReference(imageView)
private var containerRef: WeakReference<ViewGroup> = WeakReference(container)

@SuppressLint("ClickableViewAccessibility")
override fun onTouch(view: View?, event: MotionEvent?): Boolean {
onViewTouchedListener?.onTouch(view, event)

event ?: return false
val imageView = imageViewRef.get() ?: return false
val container = containerRef.get() ?: return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ import android.content.Context
import android.content.Intent
import android.content.IntentSender
import android.os.Build
import android.os.Bundle
import android.view.inputmethod.InlineSuggestionsRequest
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper
import com.kunzisoft.keepass.activities.helpers.SpecialMode
import com.kunzisoft.keepass.activities.legacy.DatabaseModeActivity
import com.kunzisoft.keepass.autofill.AutofillHelper
import com.kunzisoft.keepass.autofill.AutofillHelper.EXTRA_INLINE_SUGGESTIONS_REQUEST
import com.kunzisoft.keepass.autofill.KeeAutofillService
Expand All @@ -44,9 +43,18 @@ import com.kunzisoft.keepass.settings.PreferencesUtil
import com.kunzisoft.keepass.utils.LOCK_ACTION

@RequiresApi(api = Build.VERSION_CODES.O)
class AutofillLauncherActivity : AppCompatActivity() {
class AutofillLauncherActivity : DatabaseModeActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
override fun applyCustomStyle(): Boolean {
return false
}

override fun finishActivityIfReloadRequested(): Boolean {
return true
}

override fun onDatabaseRetrieved(database: Database?) {
super.onDatabaseRetrieved(database)

// Retrieve selection mode
EntrySelectionHelper.retrieveSpecialModeFromIntent(intent).let { specialMode ->
Expand All @@ -57,10 +65,11 @@ class AutofillLauncherActivity : AppCompatActivity() {
applicationId = intent.getStringExtra(KEY_SEARCH_APPLICATION_ID)
webDomain = intent.getStringExtra(KEY_SEARCH_DOMAIN)
webScheme = intent.getStringExtra(KEY_SEARCH_SCHEME)
manualSelection = intent.getBooleanExtra(KEY_MANUAL_SELECTION, false)
}
SearchInfo.getConcreteWebDomain(this, searchInfo.webDomain) { concreteWebDomain ->
searchInfo.webDomain = concreteWebDomain
launchSelection(searchInfo)
launchSelection(database, searchInfo)
}
}
SpecialMode.REGISTRATION -> {
Expand All @@ -69,7 +78,7 @@ class AutofillLauncherActivity : AppCompatActivity() {
val searchInfo = SearchInfo(registerInfo?.searchInfo)
SearchInfo.getConcreteWebDomain(this, searchInfo.webDomain) { concreteWebDomain ->
searchInfo.webDomain = concreteWebDomain
launchRegistration(searchInfo, registerInfo)
launchRegistration(database, searchInfo, registerInfo)
}
}
else -> {
Expand All @@ -79,11 +88,10 @@ class AutofillLauncherActivity : AppCompatActivity() {
}
}
}

super.onCreate(savedInstanceState)
}

private fun launchSelection(searchInfo: SearchInfo) {
private fun launchSelection(database: Database?,
searchInfo: SearchInfo) {
// Pass extra for Autofill (EXTRA_ASSIST_STRUCTURE)
val autofillComponent = AutofillHelper.retrieveAutofillComponent(intent)

Expand All @@ -98,24 +106,22 @@ class AutofillLauncherActivity : AppCompatActivity() {
setResult(Activity.RESULT_CANCELED)
finish()
} else {
val database = Database.getInstance()
val readOnly = database.isReadOnly
// If database is open
SearchHelper.checkAutoSearchInfo(this,
Database.getInstance(),
database,
searchInfo,
{ items ->
{ openedDatabase, items ->
// Items found
AutofillHelper.buildResponseAndSetResult(this, items)
AutofillHelper.buildResponseAndSetResult(this, openedDatabase, items)
finish()
},
{
{ openedDatabase ->
// Show the database UI to select the entry
GroupActivity.launchForAutofillResult(this,
readOnly,
autofillComponent,
searchInfo,
false)
openedDatabase,
autofillComponent,
searchInfo,
false)
},
{
// If database not open
Expand All @@ -127,33 +133,36 @@ class AutofillLauncherActivity : AppCompatActivity() {
}
}

private fun launchRegistration(searchInfo: SearchInfo, registerInfo: RegisterInfo?) {
private fun launchRegistration(database: Database?,
searchInfo: SearchInfo,
registerInfo: RegisterInfo?) {
if (!KeeAutofillService.autofillAllowedFor(searchInfo.applicationId,
PreferencesUtil.applicationIdBlocklist(this))
|| !KeeAutofillService.autofillAllowedFor(searchInfo.webDomain,
PreferencesUtil.webDomainBlocklist(this))) {
showBlockRestartMessage()
setResult(Activity.RESULT_CANCELED)
} else {
val database = Database.getInstance()
val readOnly = database.isReadOnly
val readOnly = database?.isReadOnly != false
SearchHelper.checkAutoSearchInfo(this,
database,
searchInfo,
{ _ ->
{ openedDatabase, _ ->
if (!readOnly) {
// Show the database UI to select the entry
GroupActivity.launchForRegistration(this,
registerInfo)
openedDatabase,
registerInfo)
} else {
showReadOnlySaveMessage()
}
},
{
{ openedDatabase ->
if (!readOnly) {
// Show the database UI to select the entry
GroupActivity.launchForRegistration(this,
registerInfo)
openedDatabase,
registerInfo)
} else {
showReadOnlySaveMessage()
}
Expand Down Expand Up @@ -190,40 +199,42 @@ class AutofillLauncherActivity : AppCompatActivity() {

companion object {

private const val KEY_MANUAL_SELECTION = "KEY_MANUAL_SELECTION"
private const val KEY_SEARCH_APPLICATION_ID = "KEY_SEARCH_APPLICATION_ID"
private const val KEY_SEARCH_DOMAIN = "KEY_SEARCH_DOMAIN"
private const val KEY_SEARCH_SCHEME = "KEY_SEARCH_SCHEME"

private const val KEY_REGISTER_INFO = "KEY_REGISTER_INFO"

fun getAuthIntentSenderForSelection(context: Context,
searchInfo: SearchInfo? = null,
inlineSuggestionsRequest: InlineSuggestionsRequest? = null): IntentSender {
fun getPendingIntentForSelection(context: Context,
searchInfo: SearchInfo? = null,
inlineSuggestionsRequest: InlineSuggestionsRequest? = null): PendingIntent {
return PendingIntent.getActivity(context, 0,
// Doesn't work with Parcelable (don't know why?)
Intent(context, AutofillLauncherActivity::class.java).apply {
searchInfo?.let {
putExtra(KEY_SEARCH_APPLICATION_ID, it.applicationId)
putExtra(KEY_SEARCH_DOMAIN, it.webDomain)
putExtra(KEY_SEARCH_SCHEME, it.webScheme)
putExtra(KEY_MANUAL_SELECTION, it.manualSelection)
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
inlineSuggestionsRequest?.let {
putExtra(EXTRA_INLINE_SUGGESTIONS_REQUEST, it)
}
}
},
PendingIntent.FLAG_CANCEL_CURRENT).intentSender
PendingIntent.FLAG_CANCEL_CURRENT)
}

fun getAuthIntentSenderForRegistration(context: Context,
registerInfo: RegisterInfo): IntentSender {
fun getPendingIntentForRegistration(context: Context,
registerInfo: RegisterInfo): PendingIntent {
return PendingIntent.getActivity(context, 0,
Intent(context, AutofillLauncherActivity::class.java).apply {
EntrySelectionHelper.addSpecialModeInIntent(this, SpecialMode.REGISTRATION)
putExtra(KEY_REGISTER_INFO, registerInfo)
},
PendingIntent.FLAG_CANCEL_CURRENT).intentSender
PendingIntent.FLAG_CANCEL_CURRENT)
}

fun launchForRegistration(context: Context,
Expand Down
Loading

0 comments on commit 82450c0

Please sign in to comment.