mirror of
https://github.com/zhanghai/MaterialFiles
synced 2024-07-08 19:45:51 +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) {
|
if (authority.port != Authority.DEFAULT_PORT) {
|
||||||
binding.portEdit.setText(authority.port.toString())
|
binding.portEdit.setText(authority.port.toString())
|
||||||
}
|
}
|
||||||
val authentication = server.authentication
|
|
||||||
binding.usernameEdit.setText(authority.username)
|
binding.usernameEdit.setText(authority.username)
|
||||||
when (authentication) {
|
when (val authentication = server.authentication) {
|
||||||
is PasswordAuthentication -> {
|
is PasswordAuthentication -> {
|
||||||
authenticationType = AuthenticationType.PASSWORD
|
authenticationType = AuthenticationType.PASSWORD
|
||||||
binding.passwordEdit.setText(authentication.password)
|
binding.passwordEdit.setText(authentication.password)
|
||||||
|
@ -315,7 +314,7 @@ class EditSftpServerFragment : Fragment() {
|
||||||
val authentication = when (authenticationType) {
|
val authentication = when (authenticationType) {
|
||||||
AuthenticationType.PASSWORD -> {
|
AuthenticationType.PASSWORD -> {
|
||||||
val password = binding.passwordEdit.text.toString()
|
val password = binding.passwordEdit.text.toString()
|
||||||
if (errorEdit == null) PasswordAuthentication(password) else null
|
PasswordAuthentication(password)
|
||||||
}
|
}
|
||||||
AuthenticationType.PUBLIC_KEY -> {
|
AuthenticationType.PUBLIC_KEY -> {
|
||||||
val privateKey = binding.privateKeyEdit.text.toString().takeIfNotEmpty()
|
val privateKey = binding.privateKeyEdit.text.toString().takeIfNotEmpty()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user