-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a crash dialog so users can report app crashes via email
- Loading branch information
Showing
6 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
app/src/main/java/com/mahmoudrh/roomxml/application/NotesApplication.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,47 @@ | ||
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() { | ||
|
||
val applicationScope = CoroutineScope(SupervisorJob()) | ||
|
||
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 = "[email protected]" | ||
subject = "D-Note Crash Report" | ||
reportFileName = "Crash.txt" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<vector android:height="24dp" android:tint="#000000" | ||
android:viewportHeight="24" android:viewportWidth="24" | ||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillColor="@android:color/white" android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8zM15.5,11c0.83,0 1.5,-0.67 1.5,-1.5S16.33,8 15.5,8 14,8.67 14,9.5s0.67,1.5 1.5,1.5zM8.5,11c0.83,0 1.5,-0.67 1.5,-1.5S9.33,8 8.5,8 7,8.67 7,9.5 7.67,11 8.5,11zM12,14c-2.33,0 -4.31,1.46 -5.11,3.5h10.22c-0.8,-2.04 -2.78,-3.5 -5.11,-3.5z"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters