mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-11-25 19:41:34 -08:00
fix: OTP token visibility
This commit is contained in:
1 file changed
+7
-15
@@ -115,6 +115,9 @@ class OtpDisplayView @JvmOverloads constructor(
|
||||
fun setOtpModel(otpModel: OtpModel?) {
|
||||
otpModel?.let { model ->
|
||||
val otpElement = OtpElement(model)
|
||||
if (this.otpElement?.otpModel != model) {
|
||||
mRevealed = mShowOTP
|
||||
}
|
||||
this.otpElement = otpElement
|
||||
if (otpElement.token.isNotEmpty()) {
|
||||
otpProgress.apply {
|
||||
@@ -133,7 +136,10 @@ class OtpDisplayView @JvmOverloads constructor(
|
||||
} else {
|
||||
visibility = GONE
|
||||
}
|
||||
} ?: run { visibility = GONE }
|
||||
} ?: run {
|
||||
mRevealed = mShowOTP
|
||||
visibility = GONE
|
||||
}
|
||||
|
||||
setOnClickListener {
|
||||
copyTokenToClipboard()
|
||||
@@ -183,11 +189,6 @@ class OtpDisplayView @JvmOverloads constructor(
|
||||
otpProgress.setProgressColor(color)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
clearData()
|
||||
}
|
||||
|
||||
override fun setProtection(
|
||||
isProtected: Boolean,
|
||||
isRevealedByDefault: Boolean,
|
||||
@@ -216,15 +217,6 @@ class OtpDisplayView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the data and stop any pending updates.
|
||||
*/
|
||||
fun clearData() {
|
||||
otpElement = null
|
||||
otpProgress.clearData()
|
||||
visibility = GONE
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val TAG = OtpDisplayView::class.java.name
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user