2022-05-27 07:04:44 +05:30
|
|
|
package com.github.libretube.util
|
|
|
|
|
|
|
|
import android.content.Context
|
2022-07-21 23:28:38 +05:30
|
|
|
import com.google.net.cronet.okhttptransport.CronetCallFactory
|
2022-05-27 07:04:44 +05:30
|
|
|
import org.chromium.net.CronetEngine
|
|
|
|
|
|
|
|
class CronetHelper {
|
|
|
|
companion object {
|
|
|
|
private lateinit var engine: CronetEngine
|
2022-07-21 23:28:38 +05:30
|
|
|
lateinit var callFactory: CronetCallFactory
|
2022-05-27 07:04:44 +05:30
|
|
|
|
|
|
|
fun initCronet(context: Context) {
|
|
|
|
this.engine = CronetEngine.Builder(context)
|
|
|
|
.enableBrotli(true)
|
|
|
|
.build()
|
2022-07-21 23:28:38 +05:30
|
|
|
callFactory = CronetCallFactory.newBuilder(this.engine)
|
|
|
|
.build()
|
2022-05-27 07:04:44 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
fun getCronetEngine(): CronetEngine {
|
|
|
|
return engine
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|