From 013ac308f76db24bd82cd7fe11e64aebd6bda824 Mon Sep 17 00:00:00 2001 From: Tamim Hossain <132823494+CodeWithTamim@users.noreply.github.com> Date: Tue, 22 Oct 2024 18:21:57 +0600 Subject: [PATCH] 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. --- .../app/src/main/kotlin/com/v2ray/ang/util/fmt/Hysteria2Fmt.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/fmt/Hysteria2Fmt.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/fmt/Hysteria2Fmt.kt index 880f2db1..f04ff424 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/fmt/Hysteria2Fmt.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/fmt/Hysteria2Fmt.kt @@ -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))