mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-30 13:57:47 +00:00
GitServerConfigActivity: set auth mode visibility on launch as well
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
@@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Some classes of errors would be swallowed by an unhelpful 'Invalid remote: origin' message
|
- Some classes of errors would be swallowed by an unhelpful 'Invalid remote: origin' message
|
||||||
- Repositories created within APS would contain invalid `.gpg-id` files with no ability to fix them from the app
|
- Repositories created within APS would contain invalid `.gpg-id` files with no ability to fix them from the app
|
||||||
- Button labels were invisible in Autofill phishing warning screen
|
- Button labels were invisible in Autofill phishing warning screen
|
||||||
|
- Unsupported authentication modes would appear briefly in the server config screen
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
@@ -71,24 +71,15 @@ class GitServerConfigActivity : BaseGitActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.serverUrl.setText(GitSettings.url)
|
binding.serverUrl.setText(GitSettings.url.also {
|
||||||
|
if (it.isNullOrEmpty()) return@also
|
||||||
|
setAuthModes(it.startsWith("http://") || it.startsWith("https://"))
|
||||||
|
})
|
||||||
binding.serverBranch.setText(GitSettings.branch)
|
binding.serverBranch.setText(GitSettings.branch)
|
||||||
|
|
||||||
binding.serverUrl.doOnTextChanged { text, _, _, _ ->
|
binding.serverUrl.doOnTextChanged { text, _, _, _ ->
|
||||||
if (text.isNullOrEmpty()) return@doOnTextChanged
|
if (text.isNullOrEmpty()) return@doOnTextChanged
|
||||||
if (text.startsWith("http://") || text.startsWith("https://")) {
|
setAuthModes(text.startsWith("http://") || text.startsWith("https://"))
|
||||||
binding.authModeSshKey.isVisible = false
|
|
||||||
binding.authModeOpenKeychain.isVisible = false
|
|
||||||
binding.authModePassword.isVisible = true
|
|
||||||
if (binding.authModeGroup.checkedButtonId != binding.authModePassword.id)
|
|
||||||
binding.authModeGroup.check(View.NO_ID)
|
|
||||||
} else {
|
|
||||||
binding.authModeSshKey.isVisible = true
|
|
||||||
binding.authModeOpenKeychain.isVisible = true
|
|
||||||
binding.authModePassword.isVisible = true
|
|
||||||
if (binding.authModeGroup.checkedButtonId == View.NO_ID)
|
|
||||||
binding.authModeGroup.check(binding.authModeSshKey.id)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.saveButton.setOnClickListener {
|
binding.saveButton.setOnClickListener {
|
||||||
@@ -168,6 +159,22 @@ class GitServerConfigActivity : BaseGitActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setAuthModes(isHttps: Boolean) = with(binding) {
|
||||||
|
if (isHttps) {
|
||||||
|
authModeSshKey.isVisible = false
|
||||||
|
authModeOpenKeychain.isVisible = false
|
||||||
|
authModePassword.isVisible = true
|
||||||
|
if (authModeGroup.checkedButtonId != authModePassword.id)
|
||||||
|
authModeGroup.check(View.NO_ID)
|
||||||
|
} else {
|
||||||
|
authModeSshKey.isVisible = true
|
||||||
|
authModeOpenKeychain.isVisible = true
|
||||||
|
authModePassword.isVisible = true
|
||||||
|
if (authModeGroup.checkedButtonId == View.NO_ID)
|
||||||
|
authModeGroup.check(authModeSshKey.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clones the repository, the directory exists, deletes it
|
* Clones the repository, the directory exists, deletes it
|
||||||
*/
|
*/
|
||||||
@@ -234,6 +241,7 @@ class GitServerConfigActivity : BaseGitActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
fun createCloneIntent(context: Context): Intent {
|
fun createCloneIntent(context: Context): Intent {
|
||||||
return Intent(context, GitServerConfigActivity::class.java).apply {
|
return Intent(context, GitServerConfigActivity::class.java).apply {
|
||||||
putExtra("cloning", true)
|
putExtra("cloning", true)
|
||||||
|
Reference in New Issue
Block a user