feat: change to use strings (#9)
Some checks failed
build

This commit is contained in:
2023-03-22 14:32:17 +01:00
committed by GitHub
parent 64d9b25883
commit 06777bfef1
9 changed files with 96 additions and 34 deletions

View File

@ -22,10 +22,10 @@ class Application : android.app.Application() {
.withPrefsKey("com.dzeio.crashhandler.key")
// a Prefix to add at the beginning the crash message
.withPrefix(
"POKEMON"
"Pokémon"
)
// a Suffix to add at the end of the crash message
.withSuffix("WHYYYYY")
.withSuffix("Suffix")
// build & start the module
.build().setup()
}

View File

@ -8,6 +8,7 @@ import android.os.Process
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.WindowCompat
import com.dzeio.crashhandlertest.R
import com.dzeio.crashhandlertest.databinding.ActivityErrorBinding
import kotlin.system.exitProcess
@ -48,14 +49,26 @@ class ErrorActivity : AppCompatActivity() {
val intent = Intent(Intent.ACTION_SEND)
intent.setDataAndType(Uri.parse("mailto:"), "text/plain")
intent.putExtra(Intent.EXTRA_EMAIL, arrayOf("report.openhealth@dzeio.com"))
intent.putExtra(Intent.EXTRA_SUBJECT, "Error report for application crash")
intent.putExtra(Intent.EXTRA_TEXT, "Send Report Email\n$data")
intent.putExtra(
Intent.EXTRA_SUBJECT,
getString(R.string.error_report_application_crash)
)
intent.putExtra(Intent.EXTRA_TEXT, "${getString(R.string.send_email_report)}\n$data")
// send intent
try {
startActivity(Intent.createChooser(intent, "Send Report Email..."))
startActivity(
Intent.createChooser(
intent,
getString(R.string.send_email_report)
)
)
} catch (e: ActivityNotFoundException) {
Toast.makeText(this, "Not Email client found :(", Toast.LENGTH_LONG).show()
Toast.makeText(
this,
getString(R.string.no_email_client_found),
Toast.LENGTH_LONG
).show()
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="crash_app">Faire Planter l\'application</string>
<string name="error_message">Je suis une erreur</string>
<string name="crash_handler_page_title">Crash Handler Titre de page</string>
<string name="crash_handler_page_subtitle">Crash Handler sous-titre de page</string>
<string name="e_mail">E-Mail</string>
<string name="quit">Quitter</string>
<string name="no_email_client_found">Aucun client E-Mail trouvé!</string>
<string name="send_email_report">Envoyer le rapport de crash par E-Mail</string>
<string name="error_report_application_crash">Rapport d\'erreur pour le crash d\'application</string>
</resources>

View File

@ -1,10 +1,13 @@
<resources>
<string name="app_name" translatable="false">Crash Handler</string>
<string name="crash_app" translatable="false">Crash app</string>
<string name="error_message" translatable="false">I am an error</string>
<string name="crash_handler_page_title" translatable="false">Crash Handler page title</string>
<string name="crash_handler_page_subtitle" translatable="false">crash handler page subtitle</string>
<string name="crash_app">Crash app</string>
<string name="error_message">I am an error</string>
<string name="crash_handler_page_title">Crash Handler page title</string>
<string name="crash_handler_page_subtitle">crash handler page subtitle</string>
<string name="github" translatable="false">Github</string>
<string name="e_mail" translatable="false">E-Mail</string>
<string name="quit" translatable="false">Quit</string>
<string name="e_mail">E-Mail</string>
<string name="quit">Quit</string>
<string name="no_email_client_found">No E-Mail client found!</string>
<string name="send_email_report">Send a Report E-Mail</string>
<string name="error_report_application_crash">Error report for the application crash</string>
</resources>