Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Snippets Groups Projects
Commit 5ce2afbb authored by Sayantan Roychowdhury's avatar Sayantan Roychowdhury
Browse files

Revert "Revert "Issue 854: Integrate sentry""

This reverts commit 3ab57cf6.
parent 6372b633
Branches
No related tags found
No related merge requests found
image: registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:55-workshop-auto-release image: registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:55-workshop-auto-release
variables:
SENTRY_DSN: $SENTRY_DSN
stages: stages:
- debug - debug
- release - release
......
...@@ -25,6 +25,21 @@ def getDate = { -> ...@@ -25,6 +25,21 @@ def getDate = { ->
return new Date().format('yyyyMMddHHmmss') return new Date().format('yyyyMMddHHmmss')
} }
def getSentryDsn = { ->
def sentryDsnEnv = System.getenv("SENTRY_DSN")
if (sentryDsnEnv != null) {
return sentryDsnEnv
}
Properties properties = new Properties()
def propertiesFile = project.rootProject.file('local.properties')
if (propertiesFile.exists()) {
properties.load(propertiesFile.newDataInputStream())
}
return properties.getProperty('SENTRY_DSN')
}
android { android {
compileSdk 31 compileSdk 31
...@@ -36,6 +51,7 @@ android { ...@@ -36,6 +51,7 @@ android {
versionName "${versionMajor}.${versionMinor}.${versionPatch}" versionName "${versionMajor}.${versionMinor}.${versionPatch}"
buildConfigField "String", "BUILD_ID", "\"${getGitHash() + "." + getDate()}\"" buildConfigField "String", "BUILD_ID", "\"${getGitHash() + "." + getDate()}\""
buildConfigField("String", "SENTRY_DSN", "\"${getSentryDsn()}\"")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
...@@ -132,6 +148,8 @@ dependencies { ...@@ -132,6 +148,8 @@ dependencies {
// TODO: Add splitinstall-lib to a repo https://gitlab.e.foundation/e/os/backlog/-/issues/628 // TODO: Add splitinstall-lib to a repo https://gitlab.e.foundation/e/os/backlog/-/issues/628
api files('libs/splitinstall-lib.jar') api files('libs/splitinstall-lib.jar')
implementation 'foundation.e.lib:telemetry:0.0.4-alpha'
implementation 'foundation.e:gplayapi:3.0.1' implementation 'foundation.e:gplayapi:3.0.1'
implementation 'androidx.core:core-ktx:1.7.0' implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'androidx.appcompat:appcompat:1.4.1'
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.Apps" android:theme="@style/Theme.Apps"
android:usesCleartextTraffic="true"> android:usesCleartextTraffic="true">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true"> android:exported="true">
......
...@@ -28,6 +28,7 @@ import foundation.e.apps.manager.pkg.PkgManagerModule ...@@ -28,6 +28,7 @@ import foundation.e.apps.manager.pkg.PkgManagerModule
import foundation.e.apps.manager.workmanager.InstallWorkManager import foundation.e.apps.manager.workmanager.InstallWorkManager
import foundation.e.apps.setup.tos.TOS_VERSION import foundation.e.apps.setup.tos.TOS_VERSION
import foundation.e.apps.utils.modules.DataStoreModule import foundation.e.apps.utils.modules.DataStoreModule
import foundation.e.lib.telemetry.Telemetry
import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.MainScope import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
...@@ -63,14 +64,19 @@ class AppLoungeApplication : Application(), Configuration.Provider { ...@@ -63,14 +64,19 @@ class AppLoungeApplication : Application(), Configuration.Provider {
dataStoreModule.saveTOCStatus(false, "") dataStoreModule.saveTOCStatus(false, "")
} }
} }
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
plant(Timber.DebugTree()) plant(Timber.DebugTree())
} else { } else {
// Allow enabling telemetry only for release builds.
Telemetry.init(BuildConfig.SENTRY_DSN, this)
plant(object : Timber.Tree() { plant(object : Timber.Tree() {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) { override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
Telemetry.reportMessage("$tag: $message")
if (priority == Log.DEBUG || priority == Log.VERBOSE) { if (priority == Log.DEBUG || priority == Log.VERBOSE) {
return return
} }
Log.println(priority, tag, message) Log.println(priority, tag, message)
} }
}) })
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment