Skip to content

Commit

Permalink
Improve Sentinel init
Browse files Browse the repository at this point in the history
  • Loading branch information
KCeh committed May 7, 2024
1 parent ddb96d2 commit 6e263d6
Showing 1 changed file with 17 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,23 @@ class SampleApplication : Application() {
override fun onCreate() {
super.onCreate()

Sentinel.watch(
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
setOf(
ChuckerTool(),
CollarTool(),
DbInspectorTool(),
LeakCanaryTool(),
AppGalleryTool(appId = "102016595"),
GooglePlayTool(),
ThimbleTool(),
TimberTool(allowedTags = listOf("Main")),
CertificateTool(userCertificates = loadDebugCertificates())
)
} else {
setOf(
ChuckerTool(),
CollarTool(),
DbInspectorTool(),
LeakCanaryTool(),
AppGalleryTool(appId = "102016595"),
GooglePlayTool(),
ThimbleTool(),
TimberTool(allowedTags = listOf("Main"))
)
}
)
Sentinel.watch(getWatchedTools())
}

private fun getWatchedTools(): Set<Sentinel.Tool> {
val tools = mutableSetOf<Sentinel.Tool>()
tools.add(ChuckerTool())
tools.add(CollarTool())
tools.add(DbInspectorTool())
tools.add(LeakCanaryTool())
tools.add(AppGalleryTool(appId = "102016595"))
tools.add(GooglePlayTool())
tools.add(ThimbleTool())
tools.add(TimberTool(allowedTags = listOf("Main")))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
tools.add(CertificateTool(userCertificates = loadDebugCertificates()))
}
return tools
}

private fun loadDebugCertificates(): List<X509Certificate> {
Expand Down

0 comments on commit 6e263d6

Please sign in to comment.