mirror of
https://github.com/android-password-store/Android-Password-Store.git
synced 2025-09-07 16:09:38 +02:00
PasswordEntry: use update
method to write new TOTP values (#1472)
This commit is contained in:
parent
003e757b1c
commit
6c73cccd37
|
@ -19,6 +19,7 @@ import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
|
import kotlinx.coroutines.flow.update
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
/** Represents a single entry in the password store. */
|
/** Represents a single entry in the password store. */
|
||||||
|
@ -192,7 +193,7 @@ constructor(
|
||||||
) {
|
) {
|
||||||
if (totpSecret != null) {
|
if (totpSecret != null) {
|
||||||
Otp.calculateCode(totpSecret, millis / (1000 * totpPeriod), totpAlgorithm, digits, issuer)
|
Otp.calculateCode(totpSecret, millis / (1000 * totpPeriod), totpAlgorithm, digits, issuer)
|
||||||
.mapBoth({ code -> _totp.value = code }, { throwable -> throw throwable })
|
.mapBoth({ code -> _totp.update { code } }, { throwable -> throw throwable })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue