Add explicit dependency to okhttp (was provided by coil), and inject the OkHttpClient to DefaultBugReporter.

This commit is contained in:
Benoit Marty 2023-03-16 15:11:55 +01:00 committed by Benoit Marty
parent 771855dfe3
commit 0d73b962c2
2 changed files with 4 additions and 4 deletions

View file

@ -43,6 +43,8 @@ dependencies {
api(libs.squareup.seismic)
api(projects.features.rageshake.api)
implementation(libs.androidx.datastore.preferences)
implementation(platform(libs.network.okhttp.bom))
implementation("com.squareup.okhttp3:okhttp")
implementation(libs.coil)
implementation(libs.coil.compose)
ksp(libs.showkase.processor)

View file

@ -64,6 +64,7 @@ class DefaultBugReporter @Inject constructor(
private val screenshotHolder: ScreenshotHolder,
private val crashDataStore: CrashDataStore,
private val coroutineDispatchers: CoroutineDispatchers,
private val okHttpClient: OkHttpClient,
/*
private val activeSessionHolder: ActiveSessionHolder,
private val versionProvider: VersionProvider,
@ -88,9 +89,6 @@ class DefaultBugReporter @Inject constructor(
private const val BUFFER_SIZE = 1024 * 1024 * 50
}
// the http client
private val mOkHttpClient = OkHttpClient()
// the pending bug report call
private var mBugReportCall: Call? = null
@ -346,7 +344,7 @@ class DefaultBugReporter @Inject constructor(
// trigger the request
try {
mBugReportCall = mOkHttpClient.newCall(request)
mBugReportCall = okHttpClient.newCall(request)
response = mBugReportCall!!.execute()
responseCode = response.code
} catch (e: Exception) {