Skip to content

Commit

Permalink
Merge pull request #198 from skydoves/feature/snitcher
Browse files Browse the repository at this point in the history
Introduce Snitcher to trace global exceptions
  • Loading branch information
skydoves authored Aug 23, 2023
2 parents 7b83384 + b34be2a commit 162986f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ dependencies {
// logger
implementation(libs.stream.log)

// crash tracer & restorer
implementation(libs.snitcher)

// firebase
implementation(platform(libs.firebase.bom))
implementation(libs.firebase.analytics)
Expand Down
12 changes: 11 additions & 1 deletion app/src/main/kotlin/com/skydoves/chatgpt/ChatGPTApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,17 @@
package com.skydoves.chatgpt

import android.app.Application
import com.skydoves.snitcher.Snitcher
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class ChatGPTApp : Application()
class ChatGPTApp : Application() {

override fun onCreate() {
super.onCreate()

// install Snitcher to trace global exceptions and restore the app.
// https://github.com/skydoves/snitcher
Snitcher.install(this)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,25 @@

package com.skydoves.chatgpt.benchmark

import android.os.Build
import androidx.annotation.RequiresApi
import androidx.benchmark.macro.junit4.BaselineProfileRule
import org.junit.Rule
import org.junit.Test

/**
* Generates a baseline profile which can be copied to `app/src/main/baseline-prof.txt`.
*/
@RequiresApi(Build.VERSION_CODES.P)
class BaselineProfileGenerator {
@get:Rule
val baselineProfileRule = BaselineProfileRule()

@Test
fun startup() =
baselineProfileRule.collectBaselineProfile(
packageName = "com.skydoves.chatgpt"
baselineProfileRule.collect(
packageName = "com.skydoves.chatgpt",
includeInStartupProfile = true
) {
pressHome()
// This block defines the app's critical user journey. Here we are interested in
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ retrofit = "2.9.0"
sandwich = "1.3.8"
moshi="1.15.0"
spotless = "6.7.0"
snitcher = "1.0.1"
webviewInspector = "1.0.2"
firebaseBom = "32.1.1"

Expand Down Expand Up @@ -86,6 +87,7 @@ kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-
kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinxCoroutines" }
okhttp-logging = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp" }
sandwich = { group = "com.github.skydoves", name = "sandwich", version.ref = "sandwich" }
snitcher = { group = "com.github.skydoves", name = "snitcher", version.ref = "snitcher" }
retrofit-core = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" }
moshi = { module = "com.squareup.moshi:moshi-kotlin", version.ref = "moshi" }
moshi-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshi" }
Expand Down

0 comments on commit 162986f

Please sign in to comment.