Add stetho in debug to allow some inspection

This commit is contained in:
ganfra 2019-02-19 17:40:38 +01:00
parent 24ffd96b6e
commit b5f40f9732
4 changed files with 10 additions and 0 deletions

View File

@ -76,6 +76,7 @@ dependencies {
implementation 'com.jakewharton.threetenabp:threetenabp:1.1.1'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.facebook.stetho:stetho:1.5.0'
// rx
implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0'

View File

@ -19,6 +19,7 @@ package im.vector.riotredesign
import android.app.Application
import android.content.Context
import androidx.multidex.MultiDex
import com.facebook.stetho.Stetho
import com.jakewharton.threetenabp.AndroidThreeTen
import im.vector.matrix.android.BuildConfig
import im.vector.riotredesign.core.di.AppModule
@ -33,6 +34,7 @@ class Riot : Application() {
super.onCreate()
if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
Stetho.initializeWithDefaults(this)
}
AndroidThreeTen.init(this)
startKoin(listOf(AppModule(this).definition), logger = EmptyLogger())

View File

@ -95,6 +95,7 @@ dependencies {
// Logging
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'
debugImplementation 'com.airbnb.okreplay:okreplay:1.4.0'
releaseImplementation 'com.airbnb.okreplay:noop:1.4.0'

View File

@ -16,6 +16,7 @@
package im.vector.matrix.android.internal.di
import com.facebook.stetho.okhttp3.StethoInterceptor
import im.vector.matrix.android.internal.network.AccessTokenInterceptor
import im.vector.matrix.android.internal.network.NetworkConnectivityChecker
import im.vector.matrix.android.internal.network.UnitConverterFactory
@ -47,11 +48,16 @@ class NetworkModule {
OkReplayInterceptor()
}
single {
StethoInterceptor()
}
single {
OkHttpClient.Builder()
.connectTimeout(30, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.writeTimeout(30, TimeUnit.SECONDS)
.addNetworkInterceptor(get<StethoInterceptor>())
.addInterceptor(get<AccessTokenInterceptor>())
.addInterceptor(get<HttpLoggingInterceptor>())
.addInterceptor(get<OkReplayInterceptor>())