Add ACRA
This commit is contained in:
parent
a127ba10c3
commit
822b7ea349
7 changed files with 90 additions and 9 deletions
|
@ -209,6 +209,8 @@ dependencies {
|
|||
implementation(ApplicationLibs.Square.okhttp)
|
||||
implementation(ApplicationLibs.Square.okhttpBrotli)
|
||||
|
||||
implementation(ApplicationLibs.acraMail)
|
||||
implementation(ApplicationLibs.acraNotification)
|
||||
implementation(ApplicationLibs.androidImageCropper)
|
||||
implementation(ApplicationLibs.autodispose)
|
||||
implementation(ApplicationLibs.autodisposeAndroidArchComp)
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
<resources>
|
||||
<!-- HUSKY SPECIFIC STRINGS -->
|
||||
|
||||
<!-- REPLACEMENT FOR TUSKY STRINGS -->
|
||||
<string name="tusky_website" translatable="false">https://huskyapp.dev</string>
|
||||
|
||||
<!-- ACRA SPECIFIC STRINGS -->
|
||||
<string name="acra_email">~captainepoch/husky-reports@lists.sr.ht</string>
|
||||
<string name="acra_email_subject">Husky crashed</string>
|
||||
<string name="acra_email_report_filename">husky_crash_report.txt</string>
|
||||
<string name="acra_notification_channel_title">ACRA</string>
|
||||
<string name="acra_notification_channel_body">This channel is used for push notifications related to crashes captured by ACRA.</string>
|
||||
<string name="acra_notification_title">Husky crashed</string>
|
||||
<string name="acra_notification_body">There was an error that crashed Husky. If you want, you can report via email this crash.</string>
|
||||
<string name="acra_notification_report">Report</string>
|
||||
<string name="acra_notification_discard">Discard</string>
|
||||
|
||||
<!-- REPLACEMENT FOR TUSKY STRINGS -->
|
||||
<string name="tusky_website" translatable="false">https://huskyapp.dev</string>
|
||||
|
||||
</resources>
|
||||
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import android.app.Application
|
|||
import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Bitmap
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import androidx.emoji.text.EmojiCompat
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.work.WorkManager
|
||||
|
@ -44,6 +45,15 @@ import dagger.android.HasAndroidInjector
|
|||
import io.reactivex.plugins.RxJavaPlugins
|
||||
import java.security.Security
|
||||
import javax.inject.Inject
|
||||
import org.acra.ReportField.ANDROID_VERSION
|
||||
import org.acra.ReportField.APP_VERSION_CODE
|
||||
import org.acra.ReportField.APP_VERSION_NAME
|
||||
import org.acra.ReportField.BUILD_CONFIG
|
||||
import org.acra.ReportField.STACK_TRACE
|
||||
import org.acra.config.mailSender
|
||||
import org.acra.config.notification
|
||||
import org.acra.data.StringFormat
|
||||
import org.acra.ktx.initAcra
|
||||
import org.conscrypt.Conscrypt
|
||||
import timber.log.Timber
|
||||
|
||||
|
@ -99,6 +109,8 @@ class TuskyApplication : Application(), HasAndroidInjector {
|
|||
override fun attachBaseContext(base: Context) {
|
||||
localeManager = LocaleManager(base)
|
||||
super.attachBaseContext(localeManager.setLocale(base))
|
||||
|
||||
setupAcra()
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
|
@ -112,4 +124,39 @@ class TuskyApplication : Application(), HasAndroidInjector {
|
|||
@JvmStatic
|
||||
lateinit var localeManager: LocaleManager
|
||||
}
|
||||
|
||||
private fun setupAcra() {
|
||||
initAcra {
|
||||
buildConfigClass = BuildConfig::class.java
|
||||
reportFormat = StringFormat.KEY_VALUE_LIST
|
||||
reportContent = listOf(
|
||||
ANDROID_VERSION,
|
||||
APP_VERSION_NAME,
|
||||
APP_VERSION_CODE,
|
||||
BUILD_CONFIG,
|
||||
STACK_TRACE
|
||||
).toTypedArray()
|
||||
|
||||
notification {
|
||||
title = getString(R.string.acra_notification_title)
|
||||
text = getString(R.string.acra_notification_body)
|
||||
channelName = getString(R.string.acra_notification_channel_title)
|
||||
channelDescription = getString(R.string.acra_notification_channel_body)
|
||||
resChannelImportance = NotificationManagerCompat.IMPORTANCE_DEFAULT
|
||||
//resIcon = R.drawable.notification_icon
|
||||
sendButtonText = getString(R.string.acra_notification_report)
|
||||
//resSendButtonIcon = R.drawable.notification_send
|
||||
discardButtonText = getString(R.string.acra_notification_discard)
|
||||
//resDiscardButtonIcon = R.drawable.notification_discard
|
||||
sendOnClick = false
|
||||
}
|
||||
|
||||
mailSender {
|
||||
mailTo = getString(R.string.acra_email)
|
||||
reportAsFile = false
|
||||
reportFileName = getString(R.string.acra_email_report_filename)
|
||||
subject = getString(R.string.acra_email_subject)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -335,6 +335,26 @@ class PreferencesFragment : PreferenceFragmentCompat(), Injectable {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
preferenceCategory(R.string.pref_title_proxy_settings) {
|
||||
httpProxyPref = preference {
|
||||
setTitle(R.string.pref_title_http_proxy_settings)
|
||||
setOnPreferenceClickListener {
|
||||
activity?.let { activity ->
|
||||
val intent = PreferencesActivity.newIntent(
|
||||
activity,
|
||||
PreferencesActivity.PROXY_PREFERENCES
|
||||
)
|
||||
activity.startActivity(intent)
|
||||
activity.overridePendingTransition(
|
||||
R.anim.slide_from_right,
|
||||
R.anim.slide_to_left
|
||||
)
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,4 +92,6 @@ object PrefKeys {
|
|||
|
||||
const val TAB_FILTER_HOME_REPLIES = "tabFilterHomeReplies"
|
||||
const val TAB_FILTER_HOME_BOOSTS = "tabFilterHomeBoosts"
|
||||
|
||||
const val ACRA_ENABLE_REPORT = "acraEnable"
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ object AppPlugins {
|
|||
|
||||
object ApplicationLibs {
|
||||
private object Versions {
|
||||
const val acra = "5.8.4"
|
||||
const val androidImageCropper = "2.8.0"
|
||||
const val appcompat = "1.3.1"
|
||||
const val autodispose = "1.4.0"
|
||||
|
@ -137,6 +138,8 @@ object ApplicationLibs {
|
|||
const val okhttpBrotli = "com.squareup.okhttp3:okhttp-brotli:${Versions.okhttpVersion}"
|
||||
}
|
||||
|
||||
const val acraMail = "ch.acra:acra-mail:${Versions.acra}"
|
||||
const val acraNotification = "ch.acra:acra-notification:${Versions.acra}"
|
||||
const val androidImageCropper =
|
||||
"com.theartofdev.edmodo:android-image-cropper:${Versions.androidImageCropper}"
|
||||
const val autodispose = "com.uber.autodispose:autodispose:${Versions.autodispose}"
|
||||
|
|
|
@ -21,8 +21,8 @@ object DefaultConfig {
|
|||
const val applicationID = "su.xash.husky"
|
||||
const val minSdk = 23
|
||||
const val targetSdk = 30
|
||||
const val versionCodeRel = 172
|
||||
const val versionNameRel = "1.0.2"
|
||||
const val versionCodeRel = 173
|
||||
const val versionNameRel = "1.1.0"
|
||||
|
||||
val javaVersion = JavaVersion.VERSION_11
|
||||
val jvmTarget = javaVersion.toString()
|
||||
|
|
Loading…
Reference in a new issue