Skip to content

Commit

Permalink
Glory for chucker
Browse files Browse the repository at this point in the history
  • Loading branch information
mariobodemann committed Oct 21, 2021
1 parent afbeab6 commit 9137f28
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ android {
}

dependencies {

implementation "com.github.kibotu:AndroidAnimationsActions:2.0.1"

implementation 'androidx.core:core:1.7.0-rc01'
Expand Down Expand Up @@ -109,6 +108,8 @@ dependencies {

debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"

debugImplementation "com.github.chuckerteam.chucker:library:3.5.2"
releaseImplementation "com.github.chuckerteam.chucker:library-no-op:3.5.2"
}

// from gradle.properties
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/CatsApplication.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package berlindroid.zethree

import android.app.Application
import berlindroid.zethree.berlindroid.zethree.cats.di.SingletonDontDeleteMe

class CatsApplication : Application() {

override fun onCreate() {
super.onCreate()
SingletonDontDeleteMe.setupInterceptor(this)

//TODO do something here
}
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/berlindroid/zethree/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,9 @@ fun View.startWobbling() {
play(
forever(
sequence(
scaleTo(0.5f, 1f, duration, Interpolations.SineEaseInOut),
scaleTo(1f, 0.5f, duration, Interpolations.SineEaseInOut),
scaleTo(1.0f, 3.0f, duration, Interpolations.SineEaseInOut),
scaleTo(1.0f, 0.75f, duration, Interpolations.SineEaseInOut),
scaleTo(1.0f, 3.0f, duration, Interpolations.SineEaseInOut),
)
),
this
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package berlindroid.zethree.berlindroid.zethree.cats.di

import android.content.Context
import com.chuckerteam.chucker.api.ChuckerInterceptor

object SingletonDontDeleteMe {

public var interceptor: ChuckerInterceptor? = null

fun setupInterceptor(context: Context) {
interceptor = ChuckerInterceptor.Builder(context).build()
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package berlindroid.zethree.cats.repository

import berlindroid.zethree.berlindroid.zethree.cats.di.SingletonDontDeleteMe
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.SerialName
Expand Down Expand Up @@ -68,6 +69,7 @@ fun provideCatApi(): CatApi = Retrofit
.baseUrl("https://api.thecatapi.com/v1/")
.client(
OkHttpClient().newBuilder()
.addInterceptor(SingletonDontDeleteMe.interceptor!!)
.addInterceptor(HttpLoggingInterceptor().apply { level = HttpLoggingInterceptor.Level.BODY })
.build()
)
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/berlindroid/zethree/dogs/DogsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.compose.material.Text
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.lifecycle.lifecycleScope
import berlindroid.zethree.berlindroid.zethree.cats.di.SingletonDontDeleteMe
import berlindroid.zethree.berlindroid.zethree.dogs.DogsApi
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
import kotlinx.coroutines.launch
Expand All @@ -28,6 +29,7 @@ class DogsActivity : ComponentActivity() {
.baseUrl("https://google.com")
.client(
OkHttpClient().newBuilder()
.addInterceptor(SingletonDontDeleteMe.interceptor)
.addInterceptor(HttpLoggingInterceptor().apply {
level =
HttpLoggingInterceptor.Level.BODY
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ android.nonTransitiveRClass=true
kotlin.code.style=official

# App Config
version=0.0.38
version=0.0.39

0 comments on commit 9137f28

Please sign in to comment.