fix Android提示旧版本Android系统不兼容问题
fix Android提示旧版本Android系统不兼容问题
This commit is contained in:
+16
-4
@@ -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 = ""
|
||||
|
||||
|
||||
+2
-2
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user