Fix Comment and Improve Null Safety in ServerCustomConfigActivity (#3779)

Fixed the comment typo in ServerCustomConfigActivity and improved null safety in the bindingServer function by ensuring proper fallback for raw content. Simplified logic for setting editor content.
This commit is contained in:
Tamim Hossain
2024-10-25 17:13:34 +06:00
committed by GitHub
parent ba54005753
commit 28027b5288
@@ -48,16 +48,14 @@ class ServerCustomConfigActivity : BaseActivity() {
}
/**
* bingding seleced server config
* Binding selected server config
*/
private fun bindingServer(config: ServerConfig): Boolean {
binding.etRemarks.text = Utils.getEditable(config.remarks)
val raw = MmkvManager.decodeServerRaw(editGuid)
if (raw.isNullOrBlank()) {
binding.editor.setTextContent(Utils.getEditable(config.fullConfig?.toPrettyPrinting().orEmpty()))
} else {
binding.editor.setTextContent(Utils.getEditable(raw))
}
val configContent = raw ?: config.fullConfig?.toPrettyPrinting().orEmpty()
binding.editor.setTextContent(Utils.getEditable(configContent))
return true
}