mirror of
https://github.com/zhanghai/MaterialFiles
synced 2024-07-09 03:55:50 +00:00
Refactor: Minor refactor
This commit is contained in:
parent
4469d66ad2
commit
fb6ecce3a8
|
@ -147,9 +147,8 @@ class EditSftpServerFragment : Fragment() {
|
|||
if (authority.port != Authority.DEFAULT_PORT) {
|
||||
binding.portEdit.setText(authority.port.toString())
|
||||
}
|
||||
val authentication = server.authentication
|
||||
binding.usernameEdit.setText(authority.username)
|
||||
when (authentication) {
|
||||
when (val authentication = server.authentication) {
|
||||
is PasswordAuthentication -> {
|
||||
authenticationType = AuthenticationType.PASSWORD
|
||||
binding.passwordEdit.setText(authentication.password)
|
||||
|
@ -315,7 +314,7 @@ class EditSftpServerFragment : Fragment() {
|
|||
val authentication = when (authenticationType) {
|
||||
AuthenticationType.PASSWORD -> {
|
||||
val password = binding.passwordEdit.text.toString()
|
||||
if (errorEdit == null) PasswordAuthentication(password) else null
|
||||
PasswordAuthentication(password)
|
||||
}
|
||||
AuthenticationType.PUBLIC_KEY -> {
|
||||
val privateKey = binding.privateKeyEdit.text.toString().takeIfNotEmpty()
|
||||
|
|
Loading…
Reference in New Issue
Block a user