Skip to content

Commit 3ddba7a

Browse files
committed
Move AdvancedDialog initialization
1 parent 090edb7 commit 3ddba7a

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

app/src/main/kotlin/com/github/gotify/login/AdvancedDialog.kt

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,9 @@ internal class AdvancedDialog(
6565
binding = AdvancedSettingsDialogBinding.inflate(layoutInflater)
6666
binding.disableSSL.isChecked = disableSSL
6767
binding.disableSSL.setOnCheckedChangeListener(onCheckedChangeListener)
68-
if (caCertPath == null) {
69-
showSelectCaCertificate()
70-
} else {
71-
showRemoveCaCertificate(caCertCN!!)
72-
}
7368
if (!clientCertPassword.isNullOrEmpty()) {
7469
binding.clientCertPasswordEdittext.setText(clientCertPassword)
7570
}
76-
if (clientCertPath == null) {
77-
showSelectClientCertificate()
78-
} else {
79-
showRemoveClientCertificate()
80-
}
8171
binding.clientCertPasswordEdittext.doOnTextChanged { _, _, _, _ ->
8272
if (binding.selectedClientCert.text.toString() ==
8373
context.getString(R.string.certificate_found)
@@ -95,6 +85,16 @@ internal class AdvancedDialog(
9585
.create()
9686
dialog.show()
9787
dialogDoneButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE)
88+
if (caCertPath == null) {
89+
showSelectCaCertificate()
90+
} else {
91+
showRemoveCaCertificate(caCertCN!!)
92+
}
93+
if (clientCertPath == null) {
94+
showSelectClientCertificate()
95+
} else {
96+
showRemoveClientCertificate()
97+
}
9898
return this
9999
}
100100

@@ -132,9 +132,7 @@ internal class AdvancedDialog(
132132
}
133133

134134
private fun showPasswordMissing(toggled: Boolean) {
135-
if (::dialogDoneButton.isInitialized) {
136-
dialogDoneButton.isEnabled = !toggled
137-
}
135+
dialogDoneButton.isEnabled = !toggled
138136
val error = if (toggled) {
139137
context.getString(R.string.client_cert_password_missing)
140138
} else {

0 commit comments

Comments
 (0)