From 505c2fa705fca1aaec7aae80c50a939bfd607716 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 29 Oct 2022 05:34:09 +0530 Subject: refactor(format-common): add a getter to `PasswordEntry` for current OTP value --- .../main/java/app/passwordstore/util/autofill/AutofillPreferences.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'app/src/main/java') diff --git a/app/src/main/java/app/passwordstore/util/autofill/AutofillPreferences.kt b/app/src/main/java/app/passwordstore/util/autofill/AutofillPreferences.kt index ba3e5079..dc587cda 100644 --- a/app/src/main/java/app/passwordstore/util/autofill/AutofillPreferences.kt +++ b/app/src/main/java/app/passwordstore/util/autofill/AutofillPreferences.kt @@ -15,8 +15,6 @@ import app.passwordstore.util.settings.PreferenceKeys import com.github.androidpasswordstore.autofillparser.Credentials import java.io.File import java.nio.file.Paths -import kotlinx.coroutines.flow.first -import kotlinx.coroutines.runBlocking enum class DirectoryStructure(val value: String) { EncryptedUsername("encrypted_username"), @@ -143,7 +141,7 @@ object AutofillPreferences { // Always give priority to a username stored in the encrypted extras val username = entry.username ?: directoryStructure.getUsernameFor(file) ?: context.getDefaultUsername() - val totp = if (entry.hasTotp()) runBlocking { entry.totp.first().value } else null + val totp = if (entry.hasTotp()) entry.currentOtp else null return Credentials(username, entry.password, totp) } } -- cgit v1.2.3