This commit is contained in:
kunfei 2023-01-22 22:39:40 +08:00
parent 542a116afd
commit 08634398e3
2 changed files with 12 additions and 7 deletions

View File

@ -6,8 +6,10 @@ import kotlinx.coroutines.CoroutineScope
object AppUpdate {
val gitHubUpdate by lazy {
Class.forName("io.legado.app.help.AppUpdateGitHub").kotlin.objectInstance
as? AppUpdateInterface
kotlin.runCatching {
Class.forName("io.legado.app.help.AppUpdateGitHub")
.kotlin.objectInstance as AppUpdateInterface
}.getOrNull()
}
data class UpdateInfo(

View File

@ -5,9 +5,10 @@ import okhttp3.Interceptor
object Cronet {
val loader: CronetLoaderInterface? by lazy {
val cl = Class.forName("io.legado.app.lib.cronet.CronetLoader")
?.kotlin?.objectInstance
cl as? CronetLoaderInterface
kotlin.runCatching {
Class.forName("io.legado.app.lib.cronet.CronetLoader")
.kotlin.objectInstance as CronetLoaderInterface
}.getOrNull()
}
fun preDownload() {
@ -15,8 +16,10 @@ object Cronet {
}
val interceptor: Interceptor? by lazy {
val cl = Class.forName("io.legado.app.lib.cronet.CronetInterceptor")?.newInstance()
cl as? Interceptor
kotlin.runCatching {
Class.forName("io.legado.app.lib.cronet.CronetInterceptor")
.newInstance() as Interceptor
}.getOrNull()
}
}