Skip to content

Commit

Permalink
Merge pull request #40 from infinum/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
bojankoma authored Apr 3, 2023
2 parents 1f78190 + 9e456d6 commit 758d165
Show file tree
Hide file tree
Showing 104 changed files with 1,421 additions and 694 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Change Log
==========

## Version 1.2.4

_2023-04-03_

* Replace Koin with Kotlin Inject.
* Filter out non Bundle keys in Bundle size monitor.
* Add support for explicit trigger declarations in manifest.

## Version 1.2.3

_2023-03-21_
Expand Down
81 changes: 60 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ Then add the following dependencies in your app `build.gradle` or `build.gradle.
**Groovy**

```groovy
debugImplementation "com.infinum.sentinel:sentinel:1.2.3"
releaseImplementation "com.infinum.sentinel:sentinel-no-op:1.2.3"
debugImplementation "com.infinum.sentinel:sentinel:1.2.4"
releaseImplementation "com.infinum.sentinel:sentinel-no-op:1.2.4"
```

**KotlinDSL**

```kotlin
debugImplementation("com.infinum.sentinel:sentinel:1.2.3")
releaseImplementation("com.infinum.sentinel:sentinel-no-op:1.2.3")
debugImplementation("com.infinum.sentinel:sentinel:1.2.4")
releaseImplementation("com.infinum.sentinel:sentinel-no-op:1.2.4")
```

Basic tools are provided inside the main package but depending on requirements you might want to add
Expand All @@ -74,27 +74,27 @@ specific tools:
**Groovy**

```groovy
debugImplementation "com.infinum.sentinel:tool-chucker:1.2.3"
debugImplementation "com.infinum.sentinel:tool-collar:1.2.3"
debugImplementation "com.infinum.sentinel:tool-dbinspector:1.2.3"
debugImplementation "com.infinum.sentinel:tool-leakcanary:1.2.3"
debugImplementation "com.infinum.sentinel:tool-appgallery:1.2.3"
debugImplementation "com.infinum.sentinel:tool-googleplay:1.2.3"
debugImplementation "com.infinum.sentinel:tool-thimble:1.2.3"
debugImplementation "com.infinum.sentinel:tool-timber:1.2.3"
debugImplementation "com.infinum.sentinel:tool-chucker:1.2.4"
debugImplementation "com.infinum.sentinel:tool-collar:1.2.4"
debugImplementation "com.infinum.sentinel:tool-dbinspector:1.2.4"
debugImplementation "com.infinum.sentinel:tool-leakcanary:1.2.4"
debugImplementation "com.infinum.sentinel:tool-appgallery:1.2.4"
debugImplementation "com.infinum.sentinel:tool-googleplay:1.2.4"
debugImplementation "com.infinum.sentinel:tool-thimble:1.2.4"
debugImplementation "com.infinum.sentinel:tool-timber:1.2.4"
```

**KotlinDSL**

```kotlin
debugImplementation("com.infinum.sentinel:tool-chucker:1.2.3")
debugImplementation("com.infinum.sentinel:tool-collar:1.2.3")
debugImplementation("com.infinum.sentinel:tool-dbinspector:1.2.3")
debugImplementation("com.infinum.sentinel:tool-leakcanary:1.2.3")
debugImplementation("com.infinum.sentinel:tool-appgallery:1.2.3")
debugImplementation("com.infinum.sentinel:tool-googleplay:1.2.3")
debugImplementation("com.infinum.sentinel:tool-thimble:1.2.3")
debugImplementation("com.infinum.sentinel:tool-timber:1.2.3")
debugImplementation("com.infinum.sentinel:tool-chucker:1.2.4")
debugImplementation("com.infinum.sentinel:tool-collar:1.2.4")
debugImplementation("com.infinum.sentinel:tool-dbinspector:1.2.4")
debugImplementation("com.infinum.sentinel:tool-leakcanary:1.2.4")
debugImplementation("com.infinum.sentinel:tool-appgallery:1.2.4")
debugImplementation("com.infinum.sentinel:tool-googleplay:1.2.4")
debugImplementation("com.infinum.sentinel:tool-thimble:1.2.4")
debugImplementation("com.infinum.sentinel:tool-timber:1.2.4")
```

Now you can sync your project.
Expand Down Expand Up @@ -194,7 +194,46 @@ _Sentinel_ observes several different trigger events, determining when to show u
*Manual* trigger cannot be turned off but rest are configurable through _Sentinel_
settings except *Foreground* trigger when running on emulators. Trigger states will be persisted
between sessions.
*Upon first run, all triggers are enabled.*
*Upon first run, all triggers are enabled.*
Only way to override default trigger behaviour is to explicitly set them in you application manifest.
If declared, these will override any changes that user does on each application launch.
Accepted values are *0* and *1* to disable or enable a trigger.
Anything else will result in the same way like the metadata key isn't declared at all.
```xml
<application
android:name=".SampleApplication"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
...
<meta-data
android:name="com.infinum.sentinel.trigger.shake"
android:value="1" />
<meta-data
android:name="com.infinum.sentinel.trigger.proximity"
android:value="0" />
<meta-data
android:name="com.infinum.sentinel.trigger.foreground"
android:value="0" />
<meta-data
android:name="com.infinum.sentinel.trigger.usb_connected"
android:value="0" />
<meta-data
android:name="com.infinum.sentinel.trigger.airplane_mode_on"
android:value="0" />
...
</application>
```
- `Manual` - used for manually triggering UI with _show()_
- `Shake` - default trigger to show UI, shake device to invoke
Expand Down
4 changes: 2 additions & 2 deletions config.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ext {
def major = 1
def minor = 2
def patch = 3
def patch = 4

buildConfig = [
"minSdk" : 21,
"compileSdk": 33,
"targetSdk" : 33,
"buildTools": "33.0.0"
"buildTools": "33.0.2"
]
releaseConfig = [
"group" : "com.infinum.sentinel",
Expand Down
11 changes: 6 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
sentinel = "1.2.3"
sentinel = "1.2.4"
gradle = "7.4.2"
desugar = "1.2.2"
desugar = "2.0.2"
kotlin = "1.8.10"
coroutines = "1.6.4"
json = "1.5.0"
Expand All @@ -18,15 +18,15 @@ startup = "1.1.1"
crypto = "1.1.0-alpha05"
dynamicanimation = "1.0.0"
design = "1.8.0"
koin = "3.3.3"
inject = "0.6.1"
timber = "5.0.1"
detekt = "1.21.0"
ktlintplugin = "10.3.0"
ktlint = "0.45.2"
cpd = "3.2"
dokka = "1.8.10"
chucker = "3.5.2"
collar = "1.3.7"
collar = "1.4.0"
dbinspector = "5.4.9"
leakcanary = "2.10"
thimble = "1.0.1"
Expand Down Expand Up @@ -75,7 +75,8 @@ androidx-workmanager-ktx = { module = "androidx.work:work-runtime-ktx", version.

material = { module = "com.google.android.material:material", version.ref = "design" }

koin = { module = "io.insert-koin:koin-android", version.ref = "koin" }
inject-compiler = { module = "me.tatarka.inject:kotlin-inject-compiler-ksp", version.ref = "inject" }
inject-runtime = { module = "me.tatarka.inject:kotlin-inject-runtime", version.ref = "inject" }

detekt-gradle = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" }
detekt-formatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detekt" }
Expand Down
1 change: 1 addition & 0 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ dependencies {
implementation libs.timber

debugImplementation libs.library
// debugImplementation project(":sentinel")
releaseImplementation libs.librarynoop

debugImplementation libs.bundles.tools
Expand Down
1 change: 1 addition & 0 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:theme,android:name,android:supportsRtl">

<activity
android:name=".MainActivity"
android:exported="true">
Expand Down
7 changes: 6 additions & 1 deletion sentinel/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ dependencies {
implementation libs.bundles.androidx
ksp libs.androidx.room.compiler
implementation libs.material
implementation libs.koin
ksp libs.inject.compiler
implementation libs.inject.runtime

androidTestImplementation "junit:junit:4.13.2"
androidTestImplementation "androidx.arch.core:core-testing:2.1.0"
Expand All @@ -114,6 +115,10 @@ dependencies {
testImplementation "androidx.test.ext:junit:1.1.3"
}

ksp {
arg("me.tatarka.inject.dumpGraph", "false")
}

apply from: "publish.gradle"

project.gradle.taskGraph.whenReady {
Expand Down
10 changes: 5 additions & 5 deletions sentinel/src/main/kotlin/com/infinum/sentinel/Sentinel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import com.infinum.sentinel.data.models.local.crash.ProcessThread
import com.infinum.sentinel.data.models.memory.triggers.manual.ManualTrigger
import com.infinum.sentinel.di.LibraryComponents
import com.infinum.sentinel.extensions.asStringArray
import com.infinum.sentinel.ui.Presentation
import java.io.ByteArrayOutputStream
import java.io.PrintStream
import java.util.Locale
Expand All @@ -16,7 +16,7 @@ public object Sentinel {
@JvmStatic
@JvmOverloads
public fun watch(tools: Set<Tool> = setOf()): Sentinel {
Presentation.setup(tools) { Presentation.show() }
LibraryComponents.setup(tools) { LibraryComponents.presentation().show() }
return this
}

Expand All @@ -25,19 +25,19 @@ public object Sentinel {

@JvmStatic
public fun setExceptionHandler(handler: Thread.UncaughtExceptionHandler?): Unit =
Presentation.setExceptionHandler(handler)
LibraryComponents.presentation().setExceptionHandler(handler)

@JvmStatic
public fun setAnrListener(listener: ApplicationNotRespondingListener?): Unit =
Presentation.setAnrListener(listener)
LibraryComponents.presentation().setAnrListener(listener)

/**
* Used for manually showing Sentinel UI
*/
private fun showInternal() {
val manualTrigger = ManualTrigger()
if (manualTrigger.active) {
Presentation.show()
LibraryComponents.presentation().show()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@ package com.infinum.sentinel

import android.content.Context
import androidx.startup.Initializer
import com.infinum.sentinel.di.LibraryKoin
import com.infinum.sentinel.ui.Presentation
import com.infinum.sentinel.di.LibraryComponents

internal class SentinelInitializer : Initializer<Class<SentinelInitializer>> {

override fun create(context: Context): Class<SentinelInitializer> {

LibraryKoin.initialize(context)

Presentation.initialize(context)
LibraryComponents.initialize(context)

return SentinelInitializer::class.java
}
Expand Down
Loading

0 comments on commit 758d165

Please sign in to comment.