Apply some smaller changes
This commit is contained in:
@@ -45,7 +45,6 @@ class GotifyApplication : Application() {
|
||||
Logger.info("Migration of legacy CA cert succeeded")
|
||||
} catch (e: IOException) {
|
||||
Logger.error(e, "Migration of legacy CA cert failed")
|
||||
if (legacyCert != null) settings.legacyCert = legacyCert
|
||||
}
|
||||
}
|
||||
super.onCreate()
|
||||
|
||||
@@ -14,7 +14,6 @@ internal class AdvancedDialog(
|
||||
private val context: Context,
|
||||
private val layoutInflater: LayoutInflater
|
||||
) {
|
||||
private lateinit var dialog: AlertDialog
|
||||
private lateinit var dialogDoneButton: Button
|
||||
private lateinit var binding: AdvancedSettingsDialogBinding
|
||||
private var onCheckedChangeListener: CompoundButton.OnCheckedChangeListener? = null
|
||||
@@ -82,7 +81,7 @@ internal class AdvancedDialog(
|
||||
binding.clientCertPasswordEdittext.doOnTextChanged { _, _, _, _ ->
|
||||
showPasswordMissing(binding.clientCertPasswordEdittext.text.toString().isEmpty())
|
||||
}
|
||||
dialog = MaterialAlertDialogBuilder(context)
|
||||
val dialog = MaterialAlertDialogBuilder(context)
|
||||
.setView(binding.root)
|
||||
.setTitle(R.string.advanced_settings)
|
||||
.setPositiveButton(context.getString(R.string.done), null)
|
||||
|
||||
@@ -65,7 +65,7 @@ internal class LoginActivity : AppCompatActivity() {
|
||||
copyStreamToFile(fileStream, destinationFile)
|
||||
|
||||
// temporarily store it (don't store to settings until they decide to login)
|
||||
caCertCN = getNameOfCertContent(destinationFile)!!
|
||||
caCertCN = getNameOfCertContent(destinationFile) ?: "unknown"
|
||||
caCertPath = destinationFile.absolutePath
|
||||
advancedDialog.showRemoveCaCertificate(caCertCN!!)
|
||||
} catch (e: Exception) {
|
||||
@@ -220,7 +220,7 @@ internal class LoginActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
private fun getNameOfCertContent(file: File): String? {
|
||||
val ca = CertUtils.parseCertificate(FileInputStream(file))
|
||||
val ca = FileInputStream(file).use { CertUtils.parseCertificate(it) }
|
||||
return (ca as X509Certificate).subjectX500Principal.name
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user