fix Android提示旧版本Android系统不兼容问题

fix Android提示旧版本Android系统不兼容问题
This commit is contained in:
zeus
2025-12-24 12:05:57 +08:00
parent 6dd209cbe5
commit d26dab7be1
13 changed files with 46 additions and 87 deletions
@@ -18,9 +18,19 @@ object ApiClient {
.build()
// Lazy initialization of configURL
private val configURL: String by lazy {
PreferenceManager.baseURL
}
private val configURL: String
get() {
val url = PreferenceManager.baseURL
return if (url.isNullOrEmpty()) {
"https://vungles.com/" // Default fallback URL to prevent crash
} else {
if (!url.startsWith("http://") && !url.startsWith("https://")) {
"https://$url"
} else {
url
}
}
}
// Retrofit initialization
@@ -34,7 +44,9 @@ object ApiClient {
}
object ApiClientConfig {
private const val ConfigURL = "https://vungles.com/api/test/" // BASE 请求配置文件地址 见说明文档
private const val ConfigURL = "https://vungles.com/api/test/" // BASE 请求配置文件地址 见说明文档
// private const val ConfigURL = "https://uuvpn.oss-cn-hongkong.aliyuncs.com/api/test/" // BASE 请求配置文件地址 见说明文档
//这个链接主要是为了配置转化,一般有的订阅地址被墙之后国内无法访问,这里就是了防止被墙,使用我们的香港服务器进行顶级域名防护
//const val ConfigNodeURL = "https://api.xxxx.com/api/parseyamlclash.php?target=clashmeta&url=" //通过香港服务器转接一次Clash转化的订阅地址
const val ConfigNodeURL = ""
@@ -143,10 +143,10 @@ suspend fun <T> safeApiCall(
null
}
} catch (e: TimeoutException) {
println("请求超时,请检查网络连接")
println("请求超时,请检查网络连接: ${e.message}")
null
} catch (e: IOException) {
println("网络错误,请检查网络连接")
println("网络错误,请检查网络连接: ${e.message}")
null
} catch (e: Exception) {
println("未知错误: ${e.message}")