only logging on device http responses in debug builds

This commit is contained in:
Adam Brown 2022-09-19 19:58:10 +01:00
parent 82d4f5b960
commit bd2dca2a41
2 changed files with 5 additions and 3 deletions

View File

@ -68,7 +68,7 @@ import java.time.Clock
internal class AppModule(context: Application, logger: MatrixLogger) { internal class AppModule(context: Application, logger: MatrixLogger) {
private val buildMeta = BuildMeta(BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE) private val buildMeta = BuildMeta(BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE, isDebug = BuildConfig.DEBUG)
private val deviceMeta = DeviceMeta(Build.VERSION.SDK_INT) private val deviceMeta = DeviceMeta(Build.VERSION.SDK_INT)
private val trackingModule by unsafeLazy { private val trackingModule by unsafeLazy {
TrackingModule( TrackingModule(
@ -94,7 +94,7 @@ internal class AppModule(context: Application, logger: MatrixLogger) {
private val workModule = WorkModule(context) private val workModule = WorkModule(context)
private val imageLoaderModule = ImageLoaderModule(context) private val imageLoaderModule = ImageLoaderModule(context)
private val matrixModules = MatrixModules(storeModule, trackingModule, workModule, logger, coroutineDispatchers, context.contentResolver) private val matrixModules = MatrixModules(storeModule, trackingModule, workModule, logger, coroutineDispatchers, context.contentResolver, buildMeta)
val domainModules = DomainModules(matrixModules, trackingModule.errorTracker, workModule, storeModule, context, coroutineDispatchers) val domainModules = DomainModules(matrixModules, trackingModule.errorTracker, workModule, storeModule, context, coroutineDispatchers)
val coreAndroidModule = CoreAndroidModule( val coreAndroidModule = CoreAndroidModule(
@ -232,6 +232,7 @@ internal class MatrixModules(
private val logger: MatrixLogger, private val logger: MatrixLogger,
private val coroutineDispatchers: CoroutineDispatchers, private val coroutineDispatchers: CoroutineDispatchers,
private val contentResolver: ContentResolver, private val contentResolver: ContentResolver,
private val buildMeta: BuildMeta,
) { ) {
val matrix by unsafeLazy { val matrix by unsafeLazy {
@ -240,7 +241,7 @@ internal class MatrixModules(
MatrixClient( MatrixClient(
KtorMatrixHttpClientFactory( KtorMatrixHttpClientFactory(
credentialsStore, credentialsStore,
includeLogging = true includeLogging = buildMeta.isDebug,
), ),
logger logger
).also { ).also {

View File

@ -3,4 +3,5 @@ package app.dapk.st.core
data class BuildMeta( data class BuildMeta(
val versionName: String, val versionName: String,
val versionCode: Int, val versionCode: Int,
val isDebug: Boolean,
) )