LibreTube/app/src/main/java/com/github/libretube/util/CronetHelper.kt
2022-07-21 23:43:11 +05:30

25 lines
668 B
Kotlin

package com.github.libretube.util
import android.content.Context
import com.google.net.cronet.okhttptransport.CronetCallFactory
import org.chromium.net.CronetEngine
class CronetHelper {
companion object {
private lateinit var engine: CronetEngine
lateinit var callFactory: CronetCallFactory
fun initCronet(context: Context) {
this.engine = CronetEngine.Builder(context)
.enableBrotli(true)
.build()
callFactory = CronetCallFactory.newBuilder(this.engine)
.build()
}
fun getCronetEngine(): CronetEngine {
return engine
}
}
}