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>
This commit is contained in:
Harsh Shandilya 2020-07-29 13:06:22 +05:30 committed by GitHub
parent a3b6bf954f
commit ecf96aa066
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View file

@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file.
- Properly handle cases where files contain only TOTP secrets and no password
- Allow creating nested directories directly
- I keep saying this but for real: error message for wrong SSH/HTTPS password is properly fixed now
- Correctly hide TOTP import button when TOTP secret/OTPAUTH URL is already present in extra content
## [1.10.1] - 2020-07-23

View file

@ -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
@ -424,8 +423,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)
}