diff --git a/.idea/misc.xml b/.idea/misc.xml index 80c665a..95e27f3 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,6 +5,7 @@ + diff --git a/app/build.gradle b/app/build.gradle index 9ffb408..4562aa5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -62,4 +62,12 @@ dependencies { api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$rootProject.coroutines" api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.coroutines" + // ACRA crash report library + implementation "ch.acra:acra-mail:5.9.5" + implementation "ch.acra:acra-dialog:5.9.5" + + + + + } \ No newline at end of file diff --git a/app/src/main/java/com/mahmoudrh/roomxml/application/NotesApplication.kt b/app/src/main/java/com/mahmoudrh/roomxml/application/NotesApplication.kt index afcd181..96152bc 100644 --- a/app/src/main/java/com/mahmoudrh/roomxml/application/NotesApplication.kt +++ b/app/src/main/java/com/mahmoudrh/roomxml/application/NotesApplication.kt @@ -1,10 +1,17 @@ package com.mahmoudrh.roomxml.application import android.app.Application +import android.content.Context +import com.mahmoudrh.roomxml.BuildConfig +import com.mahmoudrh.roomxml.R import com.mahmoudrh.roomxml.data.NotesDB import com.mahmoudrh.roomxml.data.NotesRepository import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.SupervisorJob +import org.acra.config.dialog +import org.acra.config.mailSender +import org.acra.data.StringFormat +import org.acra.ktx.initAcra class NotesApplication: Application() { @@ -12,4 +19,29 @@ class NotesApplication: Application() { val database by lazy { NotesDB.getInstance(this,applicationScope) } val repository by lazy { NotesRepository(database.NoteDAO()) } + + override fun attachBaseContext(base: Context?) { + super.attachBaseContext(base) + + initAcra { + buildConfigClass = BuildConfig::class.java + reportFormat = StringFormat.JSON + + dialog { + text = getString(R.string.dialog_text) + title = getString(R.string.dialog_title) + positiveButtonText = getString(R.string.dialog_positive) + negativeButtonText = getString(R.string.dialog_negative) + commentPrompt = getString(R.string.dialog_comment) + resIcon = R.drawable.ic_dialog_icon + resTheme = R.style.Theme_Material3_Light_Dialog + } + + mailSender { + mailTo = "dnote.developer@gmail.com" + subject = "D-Note Crash Report" + reportFileName = "Crash.txt" + } + } + } } \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_dialog_icon.xml b/app/src/main/res/drawable/ic_dialog_icon.xml new file mode 100644 index 0000000..4c78355 --- /dev/null +++ b/app/src/main/res/drawable/ic_dialog_icon.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 08b3daf..403f6d4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3,4 +3,9 @@ NoteActivity NotesActivity Search Notes + Sorry.. Tha application crashed. Please send a report to the developers. + D Note Crashed + Send + Don\'t Send + You can add a comment here: \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index cadab4d..6718b0f 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -13,4 +13,5 @@ ?attr/colorPrimaryVariant +