From e0f700477d86bc8425274e7e84cf4b60855af726 Mon Sep 17 00:00:00 2001 From: Yash Garg Date: Mon, 27 Feb 2023 22:14:10 +0530 Subject: [PATCH] Revert "cleanup: revert sentry integration" This reverts commit 7f01cb51e5eef76253a86fc8c90571dd920bcecb. --- app/build.gradle.kts | 1 + .../e/blisslauncher/BlissLauncher.java | 20 ++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 16242b9848..0cdd0f8172 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -178,4 +178,5 @@ dependencies { // elib implementation(libs.elib) + implementation(libs.telemetry) } diff --git a/app/src/main/java/foundation/e/blisslauncher/BlissLauncher.java b/app/src/main/java/foundation/e/blisslauncher/BlissLauncher.java index 1209351924..3ffc93e2ff 100755 --- a/app/src/main/java/foundation/e/blisslauncher/BlissLauncher.java +++ b/app/src/main/java/foundation/e/blisslauncher/BlissLauncher.java @@ -8,6 +8,10 @@ import android.database.ContentObserver; import android.net.Uri; import android.os.Handler; import android.provider.Settings; +import android.util.Log; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import foundation.e.blisslauncher.core.DeviceProfile; import foundation.e.blisslauncher.core.IconsHandler; @@ -15,6 +19,7 @@ import foundation.e.blisslauncher.core.blur.BlurWallpaperProvider; import foundation.e.blisslauncher.core.customviews.WidgetHost; import foundation.e.blisslauncher.features.launcher.AppProvider; import foundation.e.blisslauncher.features.notification.NotificationService; +import foundation.e.lib.telemetry.Telemetry; import timber.log.Timber; public class BlissLauncher extends Application { @@ -46,7 +51,20 @@ public class BlissLauncher extends Application { }; getContentResolver().registerContentObserver(NOTIFICATION_BADGING_URI, false, notificationSettingsObserver); - Timber.plant(new Timber.DebugTree()); + if (!BuildConfig.DEBUG) { + Telemetry.INSTANCE.init(BuildConfig.SENTRY_DSN, this); + Timber.plant(new Timber.Tree() { + @Override + protected void log(int priority, @Nullable String tag, @NonNull String message, @Nullable Throwable t) { + Log.println(priority, tag, message); + if (priority == Log.WARN || priority == Log.ERROR) { + Telemetry.INSTANCE.reportMessage(tag + ": " + message); + } + } + }); + } else { + Timber.plant(new Timber.DebugTree()); + } } private void onNotificationSettingsChanged() { -- GitLab