mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-30 13:57:47 +00:00
DecryptActivity: use correct TOTP period (#1359)
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
@@ -190,7 +190,7 @@ class DecryptActivity : BasePgpActivity(), OpenPgpServiceConnection.OnBound {
|
|||||||
if (entry.hasTotp()) {
|
if (entry.hasTotp()) {
|
||||||
launch(Dispatchers.IO) {
|
launch(Dispatchers.IO) {
|
||||||
// Calculate the actual remaining time for the first pass
|
// Calculate the actual remaining time for the first pass
|
||||||
// then return to the standard 30 second affair.
|
// then return to the standard rotation.
|
||||||
val remainingTime = entry.totpPeriod - (System.currentTimeMillis() % entry.totpPeriod)
|
val remainingTime = entry.totpPeriod - (System.currentTimeMillis() % entry.totpPeriod)
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
val code = entry.calculateTotpCode() ?: "Error"
|
val code = entry.calculateTotpCode() ?: "Error"
|
||||||
@@ -200,7 +200,7 @@ class DecryptActivity : BasePgpActivity(), OpenPgpServiceConnection.OnBound {
|
|||||||
repeat(Int.MAX_VALUE) {
|
repeat(Int.MAX_VALUE) {
|
||||||
val code = entry.calculateTotpCode() ?: "Error"
|
val code = entry.calculateTotpCode() ?: "Error"
|
||||||
withContext(Dispatchers.Main) { adapter.updateOTPCode(code) }
|
withContext(Dispatchers.Main) { adapter.updateOTPCode(code) }
|
||||||
delay(30.seconds)
|
delay(entry.totpPeriod.seconds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user