From b74ad09a07c0cbf08ab85961116e51901a1edd4d Mon Sep 17 00:00:00 2001 From: Shinokuni Date: Sun, 17 Nov 2024 14:46:07 +0100 Subject: [PATCH] Display CrashActivity only in release mode --- .../main/java/com/readrops/app/ReadropsApp.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/readrops/app/ReadropsApp.kt b/app/src/main/java/com/readrops/app/ReadropsApp.kt index a8003743..6f090455 100644 --- a/app/src/main/java/com/readrops/app/ReadropsApp.kt +++ b/app/src/main/java/com/readrops/app/ReadropsApp.kt @@ -26,15 +26,17 @@ open class ReadropsApp : Application(), KoinComponent, ImageLoaderFactory { override fun onCreate() { super.onCreate() - Thread.setDefaultUncaughtExceptionHandler { _, throwable -> - val intent = Intent(this, CrashActivity::class.java).apply { - putExtra(CrashActivity.THROWABLE_KEY, throwable) - addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK) - addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) - } + if (!BuildConfig.DEBUG) { + Thread.setDefaultUncaughtExceptionHandler { _, throwable -> + val intent = Intent(this, CrashActivity::class.java).apply { + putExtra(CrashActivity.THROWABLE_KEY, throwable) + addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK) + addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) + } - startActivity(intent) - exitProcess(0) + startActivity(intent) + exitProcess(0) + } } startKoin {