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 authored and GitHub committed 2024-10-25 19:13:34 +08:00
1 parent ba54005753
commit 28027b5288
1 file changed
+4 -6
@@ -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
}