LibreTube/app/src/main/java/com/github/libretube/util/CronetHelper.kt

25 lines
668 B
Kotlin
Raw Normal View History

package com.github.libretube.util
import android.content.Context
2022-07-21 23:28:38 +05:30
import com.google.net.cronet.okhttptransport.CronetCallFactory
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
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()
}
fun getCronetEngine(): CronetEngine {
return engine
}
}
}