diff options
author | Harsh Shandilya <msfjarvis@gmail.com> | 2020-07-29 13:06:22 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2020-07-30 14:00:25 +0530 |
commit | c132cc98e632036731b118d886709d783a55cc71 (patch) | |
tree | 7c0e1151f2ea3e5aea421e3e7b3af8d3276c3409 | |
parent | 64a6e0f4e916122fdd00df2e2b48d96ea7d49c1c (diff) |
Fix TOTP import button check semantics (#982)
* Improve TOTP checking semantics
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* Fix return label
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* update CHANGELOG
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* Move updateViewState() call outside with(binding) scope
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
(cherry picked from commit ecf96aa0668a758b2408284facda41ac70fe10aa)
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt | 8 |
2 files changed, 4 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 93b247b4..2c79702e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. ### Fixed - Properly handle cases where files contain only TOTP secrets and no password +- Correctly hide TOTP import button when TOTP secret/OTPAUTH URL is already present in extra content ## [1.10.1] - 2020-07-23 diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt index 3c1757f1..615b695e 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PasswordCreationActivity.kt @@ -177,13 +177,11 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB extraContent.setText(entry.extraContentWithoutAuthData) } } - updateViewState() } } listOf(filename, extraContent).forEach { it.doOnTextChanged { _, _, _, _ -> updateViewState() } } - updateViewState() } suggestedPass?.let { password.setText(it) @@ -195,6 +193,7 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB password.inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_PASSWORD } } + updateViewState() } override fun onCreateOptionsMenu(menu: Menu?): Boolean { @@ -235,7 +234,7 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB val entry = PasswordEntry("PLACEHOLDER\n${extraContent.text}") encryptUsername.apply { if (visibility != View.VISIBLE) - return@with + return@apply val hasUsernameInFileName = filename.text.toString().isNotBlank() val hasUsernameInExtras = entry.hasUsername() isEnabled = hasUsernameInFileName xor hasUsernameInExtras @@ -420,8 +419,7 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB AutofillPreferences.directoryStructure(applicationContext) val entry = PasswordEntry(content) returnIntent.putExtra(RETURN_EXTRA_PASSWORD, entry.password) - val username = PasswordEntry(content).username - ?: directoryStructure.getUsernameFor(file) + val username = entry.username ?: directoryStructure.getUsernameFor(file) returnIntent.putExtra(RETURN_EXTRA_USERNAME, username) } |