diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2022-11-26 19:25:49 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2022-11-26 19:25:49 +0530 |
commit | c89e9250c280ea58b5702644a323cf9b321d1bb0 (patch) | |
tree | fb30a927ade6235ff0b03de446969d3e1cbc1b81 /app/src/main | |
parent | 438a332132f4a2845c6a870188616ec99936383d (diff) |
fix: correctly handle default auth mode
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/app/passwordstore/ui/git/config/GitServerConfigActivity.kt | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/app/src/main/java/app/passwordstore/ui/git/config/GitServerConfigActivity.kt b/app/src/main/java/app/passwordstore/ui/git/config/GitServerConfigActivity.kt index a07b409f..85eae71d 100644 --- a/app/src/main/java/app/passwordstore/ui/git/config/GitServerConfigActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/git/config/GitServerConfigActivity.kt @@ -62,17 +62,17 @@ class GitServerConfigActivity : BaseGitActivity() { when (newAuthMode) { AuthMode.SshKey -> check(binding.authModeSshKey.id) AuthMode.Password -> check(binding.authModePassword.id) - AuthMode.None -> check(View.NO_ID) + AuthMode.None -> clearChecked() } - addOnButtonCheckedListener { _, checkedId, isChecked -> - if (!isChecked) { + addOnButtonCheckedListener { _, _, _ -> + if (checkedButtonIds.isEmpty()) { newAuthMode = AuthMode.None - return@addOnButtonCheckedListener - } - when (checkedId) { - binding.authModeSshKey.id -> newAuthMode = AuthMode.SshKey - binding.authModePassword.id -> newAuthMode = AuthMode.Password - View.NO_ID -> newAuthMode = AuthMode.None + } else { + when (checkedButtonId) { + binding.authModeSshKey.id -> newAuthMode = AuthMode.SshKey + binding.authModePassword.id -> newAuthMode = AuthMode.Password + View.NO_ID -> newAuthMode = AuthMode.None + } } } } @@ -214,7 +214,7 @@ class GitServerConfigActivity : BaseGitActivity() { if (isHttps) { authModeSshKey.isVisible = false authModePassword.isVisible = true - if (authModeGroup.checkedButtonId != authModePassword.id) authModeGroup.check(View.NO_ID) + if (authModeGroup.checkedButtonId != authModePassword.id) authModeGroup.clearChecked() } else { authModeSshKey.isVisible = true authModePassword.isVisible = true |