mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-11-21 01:21:34 -08:00
Workaround to fill OTP token in multiple fields with Magikeyboard (long press) #1158
This commit is contained in:
1 parent
b0e722acce
commit
b561db3a67
5 files changed
+39
-13
No files matched your search
@@ -4,6 +4,7 @@ KeePassDX(3.3.1)
|
||||
* Fix filters #1249
|
||||
* Fix temp advanced unlocking #1245
|
||||
* Best autofill recognition #1250
|
||||
* Workaround to fill OTP token in multiple fields with Magikeyboard (long press) #1158
|
||||
|
||||
KeePassDX(3.3.0)
|
||||
* Quick search and dynamic filters #163 #462 #521
|
||||
|
||||
@@ -18,6 +18,8 @@ package com.kunzisoft.keepass.magikeyboard;
|
||||
|
||||
import static com.kunzisoft.keepass.magikeyboard.MagikeyboardService.KEY_BACK_KEYBOARD;
|
||||
import static com.kunzisoft.keepass.magikeyboard.MagikeyboardService.KEY_CHANGE_KEYBOARD;
|
||||
import static com.kunzisoft.keepass.magikeyboard.MagikeyboardService.KEY_OTP;
|
||||
import static com.kunzisoft.keepass.magikeyboard.MagikeyboardService.KEY_OTP_ALT;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
@@ -1047,6 +1049,9 @@ public class KeyboardView extends View implements View.OnClickListener {
|
||||
if (popupKey.codes[0] == KEY_BACK_KEYBOARD) {
|
||||
mKeyboardActionListener.onKey(KEY_CHANGE_KEYBOARD, popupKey.codes);
|
||||
return true;
|
||||
} else if (popupKey.codes[0] == KEY_OTP) {
|
||||
mKeyboardActionListener.onKey(KEY_OTP_ALT, popupKey.codes);
|
||||
return true;
|
||||
} else {
|
||||
int popupKeyboardId = popupKey.popupResId;
|
||||
if (popupKeyboardId != 0) {
|
||||
|
||||
@@ -245,35 +245,52 @@ class MagikeyboardService : InputMethodService(), KeyboardView.OnKeyboardActionL
|
||||
dismissCustomKeys()
|
||||
}
|
||||
KEY_USERNAME -> {
|
||||
if (entryInfoKey != null) {
|
||||
currentInputConnection.commitText(entryInfoKey!!.username, 1)
|
||||
entryInfoKey?.username?.let { username ->
|
||||
currentInputConnection.commitText(username, 1)
|
||||
}
|
||||
actionTabAutomatically()
|
||||
}
|
||||
KEY_PASSWORD -> {
|
||||
if (entryInfoKey != null) {
|
||||
currentInputConnection.commitText(entryInfoKey!!.password, 1)
|
||||
entryInfoKey?.password?.let { password ->
|
||||
currentInputConnection.commitText(password, 1)
|
||||
}
|
||||
val otpFieldExists = entryInfoKey?.containsCustomField(OTP_TOKEN_FIELD) ?: false
|
||||
actionGoAutomatically(!otpFieldExists)
|
||||
}
|
||||
KEY_OTP -> {
|
||||
if (entryInfoKey != null) {
|
||||
entryInfoKey?.let { entryInfo ->
|
||||
currentInputConnection.commitText(
|
||||
entryInfoKey!!.getGeneratedFieldValue(OTP_TOKEN_FIELD), 1)
|
||||
entryInfo.getGeneratedFieldValue(OTP_TOKEN_FIELD), 1)
|
||||
}
|
||||
actionGoAutomatically()
|
||||
}
|
||||
KEY_OTP_ALT -> {
|
||||
entryInfoKey?.let { entryInfo ->
|
||||
val otpToken = entryInfo.getGeneratedFieldValue(OTP_TOKEN_FIELD)
|
||||
if (otpToken.isNotEmpty()) {
|
||||
// Cut to fill each digit separatelyKeyEvent.KEYCODE_TAB
|
||||
val otpTokenChars = otpToken.chunked(1)
|
||||
otpTokenChars.forEachIndexed { index, char ->
|
||||
currentInputConnection.commitText(char, 1)
|
||||
if (index < (otpTokenChars.size-1))
|
||||
currentInputConnection.sendKeyEvent(
|
||||
KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_TAB)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
actionGoAutomatically()
|
||||
}
|
||||
KEY_URL -> {
|
||||
if (entryInfoKey != null) {
|
||||
currentInputConnection.commitText(entryInfoKey!!.url, 1)
|
||||
entryInfoKey?.url?.let { url ->
|
||||
currentInputConnection.commitText(url, 1)
|
||||
}
|
||||
actionGoAutomatically()
|
||||
}
|
||||
KEY_FIELDS -> {
|
||||
if (entryInfoKey != null) {
|
||||
entryInfoKey?.customFields?.let { customFields ->
|
||||
fieldsAdapter?.apply {
|
||||
setFields(entryInfoKey!!.customFields.filter { it.name != OTP_TOKEN_FIELD})
|
||||
setFields(customFields.filter { it.name != OTP_TOKEN_FIELD})
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
@@ -347,7 +364,8 @@ class MagikeyboardService : InputMethodService(), KeyboardView.OnKeyboardActionL
|
||||
private const val KEY_ENTRY = 620
|
||||
private const val KEY_USERNAME = 500
|
||||
private const val KEY_PASSWORD = 510
|
||||
private const val KEY_OTP = 515
|
||||
const val KEY_OTP = 515
|
||||
const val KEY_OTP_ALT = 516
|
||||
private const val KEY_URL = 520
|
||||
private const val KEY_FIELDS = 530
|
||||
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
* Better OOM management #256
|
||||
* Fix filters #1249
|
||||
* Fix temp advanced unlocking #1245
|
||||
* Best autofill recognition #1250
|
||||
* Best autofill recognition #1250
|
||||
* Workaround to fill OTP token in multiple fields with Magikeyboard (long press) #1158
|
||||
@@ -2,4 +2,5 @@
|
||||
* Meilleur gestion d'OOM #256
|
||||
* Correction des filtres #1249
|
||||
* Correction du déverouillage avancé temporaire #1245
|
||||
* Meilleure reconnaissance du remplissage automatique #1250
|
||||
* Meilleure reconnaissance du remplissage automatique #1250
|
||||
* Solution pour remplir le token OTP dans des champs multiple avec le Magiclavier (appui long) #1158
|
||||
Reference in new issue
Block a user