Add Stetho to debug application (#18)
This commit is contained in:
@@ -157,4 +157,9 @@ dependencies {
|
|||||||
|
|
||||||
// https://mvnrepository.com/artifact/com.google.truth/truth
|
// https://mvnrepository.com/artifact/com.google.truth/truth
|
||||||
testImplementation "com.google.truth:truth:1.1.3"
|
testImplementation "com.google.truth:truth:1.1.3"
|
||||||
|
|
||||||
|
// https://github.com/facebook/stetho/releases
|
||||||
|
def stetho_version = "1.6.0"
|
||||||
|
implementation "com.facebook.stetho:stetho:$stetho_version"
|
||||||
|
implementation "com.facebook.stetho:stetho-okhttp3:$stetho_version"
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package gq.kirmanak.mealient
|
package gq.kirmanak.mealient
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
|
import com.facebook.stetho.Stetho
|
||||||
import dagger.hilt.android.HiltAndroidApp
|
import dagger.hilt.android.HiltAndroidApp
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
@@ -8,7 +9,10 @@ import timber.log.Timber
|
|||||||
class App : Application() {
|
class App : Application() {
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
if (BuildConfig.DEBUG) Timber.plant(Timber.DebugTree())
|
if (BuildConfig.DEBUG) {
|
||||||
|
Timber.plant(Timber.DebugTree())
|
||||||
|
Stetho.initializeWithDefaults(this)
|
||||||
|
}
|
||||||
Timber.v("onCreate() called")
|
Timber.v("onCreate() called")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package gq.kirmanak.mealient.data.impl
|
package gq.kirmanak.mealient.data.impl
|
||||||
|
|
||||||
|
import com.facebook.stetho.okhttp3.StethoInterceptor
|
||||||
import gq.kirmanak.mealient.BuildConfig
|
import gq.kirmanak.mealient.BuildConfig
|
||||||
import gq.kirmanak.mealient.data.auth.impl.AuthOkHttpInterceptor
|
import gq.kirmanak.mealient.data.auth.impl.AuthOkHttpInterceptor
|
||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
@@ -14,8 +15,11 @@ class OkHttpBuilder @Inject constructor(
|
|||||||
fun buildOkHttp(): OkHttpClient {
|
fun buildOkHttp(): OkHttpClient {
|
||||||
Timber.v("buildOkHttp() called")
|
Timber.v("buildOkHttp() called")
|
||||||
val builder = OkHttpClient.Builder()
|
val builder = OkHttpClient.Builder()
|
||||||
if (BuildConfig.DEBUG) builder.addNetworkInterceptor(buildLoggingInterceptor())
|
|
||||||
builder.addNetworkInterceptor(authOkHttpInterceptor)
|
builder.addNetworkInterceptor(authOkHttpInterceptor)
|
||||||
|
if (BuildConfig.DEBUG) {
|
||||||
|
builder.addNetworkInterceptor(buildLoggingInterceptor())
|
||||||
|
builder.addNetworkInterceptor(StethoInterceptor())
|
||||||
|
}
|
||||||
return builder.build()
|
return builder.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user