Refactor allowInsecure variable declaration (#3736)
- Changed `allowInsecure` from `var` to `val` to ensure immutability. - Replaced the nullable safe call `settingsStorage?.decodeBool(AppConfig.PREF_ALLOW_INSECURE) ?: false` with `settingsStorage.decodeBool(AppConfig.PREF_ALLOW_INSECURE, false)` for more concise and readable code. - This ensures `allowInsecure` is always initialized with a default value of `false` in a cleaner and more efficient way.
This commit is contained in:
@@ -15,7 +15,7 @@ import java.net.URI
|
||||
object Hysteria2Fmt : FmtBase() {
|
||||
|
||||
fun parse(str: String): ServerConfig {
|
||||
var allowInsecure = settingsStorage?.decodeBool(AppConfig.PREF_ALLOW_INSECURE) ?: false
|
||||
val allowInsecure = settingsStorage.decodeBool(AppConfig.PREF_ALLOW_INSECURE,false)
|
||||
val config = ServerConfig.create(EConfigType.HYSTERIA2)
|
||||
|
||||
val uri = URI(Utils.fixIllegalUrl(str))
|
||||
|
||||
Reference in New Issue
Block a user