mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-1305 App | Enhancement | About app screen (#3210)
* DROID-1305 about app di * DROID-1305 sentry crash report implementation * DROID-1305 sentry, send analytics id * DROID-1305 build provider, debug state * DROID-1305 about app screen, redesign + show analytics id * DROID-1305 string resources * DROID-1305 sentry module deps * DROID-1305 fix tests * DROID-1305 moving crashReporter to crash module
This commit is contained in:
parent
1ea667a6b1
commit
425598a6b6
22 changed files with 198 additions and 74 deletions
|
@ -0,0 +1,6 @@
|
|||
package com.anytypeio.anytype
|
||||
|
||||
interface CrashReporter {
|
||||
fun init()
|
||||
fun setUser(userId: String)
|
||||
}
|
|
@ -2,18 +2,22 @@ package com.anytypeio.anytype
|
|||
|
||||
import android.content.Context
|
||||
import com.anytypeio.anytype.core_utils.tools.AppInfo
|
||||
import io.sentry.Sentry
|
||||
import io.sentry.SentryLevel
|
||||
import io.sentry.android.core.SentryAndroid
|
||||
import io.sentry.android.core.SentryAndroidOptions
|
||||
import io.sentry.android.timber.SentryTimberIntegration
|
||||
import io.sentry.protocol.User
|
||||
import java.lang.Exception
|
||||
import timber.log.Timber
|
||||
|
||||
class SentryCrashReporter(
|
||||
private val context: Context,
|
||||
private val appInfo: AppInfo,
|
||||
) {
|
||||
fun init(
|
||||
withTimber: Boolean
|
||||
) {
|
||||
private val withTimber: Boolean
|
||||
) : CrashReporter {
|
||||
|
||||
override fun init() {
|
||||
SentryAndroid.init(context) { options: SentryAndroidOptions ->
|
||||
with(options) {
|
||||
release = appInfo.versionName
|
||||
|
@ -29,4 +33,15 @@ class SentryCrashReporter(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun setUser(userId: String) {
|
||||
try {
|
||||
val user = User().apply {
|
||||
id = userId
|
||||
}
|
||||
Sentry.setUser(user)
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "Sentry set user error")
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue