diff --git a/app/build.gradle b/app/build.gradle index 5a4e660..99cbe97 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,8 +13,8 @@ android { applicationId "me.ash.reader" minSdk 26 targetSdk 32 - versionCode 2 - versionName "0.6.2" + versionCode 3 + versionName "0.6.5" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index 6e5dd5a..31b5494 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -11,8 +11,8 @@ "type": "SINGLE", "filters": [], "attributes": [], - "versionCode": 2, - "versionName": "0.6.2", + "versionCode": 3, + "versionName": "0.6.5", "outputFile": "app-release.apk" } ], diff --git a/app/src/main/java/me/ash/reader/App.kt b/app/src/main/java/me/ash/reader/App.kt index 79c6e3f..c7c083d 100644 --- a/app/src/main/java/me/ash/reader/App.kt +++ b/app/src/main/java/me/ash/reader/App.kt @@ -67,6 +67,7 @@ class App : Application(), Configuration.Provider { override fun onCreate() { super.onCreate() + CrashHandler(this) applicationScope.launch(dispatcherDefault) { accountInit() dataStoreInit() diff --git a/app/src/main/java/me/ash/reader/CrashHandler.kt b/app/src/main/java/me/ash/reader/CrashHandler.kt new file mode 100644 index 0000000..0e446b2 --- /dev/null +++ b/app/src/main/java/me/ash/reader/CrashHandler.kt @@ -0,0 +1,20 @@ +package me.ash.reader + +import android.content.Context +import android.widget.Toast +import java.lang.Thread.UncaughtExceptionHandler +import kotlin.system.exitProcess + +class CrashHandler(private val context: Context) : UncaughtExceptionHandler { + private val mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler(); + + init { + Thread.setDefaultUncaughtExceptionHandler(this) + } + + override fun uncaughtException(p0: Thread, p1: Throwable) { + Toast.makeText(context, p1.message, Toast.LENGTH_LONG).show() + android.os.Process.killProcess(android.os.Process.myPid()); + exitProcess(1) + } +}