Update acra configuration

This commit is contained in:
Koitharu
2023-12-09 08:58:23 +02:00
parent 66356dc094
commit 2ae046d4c5
7 changed files with 16 additions and 54 deletions

1
.gitignore vendored
View File

@@ -15,6 +15,7 @@
/.idea/kotlinc.xml /.idea/kotlinc.xml
/.idea/deploymentTargetDropDown.xml /.idea/deploymentTargetDropDown.xml
/.idea/androidTestResultsUserPreferences.xml /.idea/androidTestResultsUserPreferences.xml
/.idea/deploymentTargetSelector.xml
/.idea/render.experimental.xml /.idea/render.experimental.xml
/.idea/inspectionProfiles/ /.idea/inspectionProfiles/
.DS_Store .DS_Store

View File

@@ -11,6 +11,7 @@ import androidx.work.WorkManager
import dagger.hilt.android.HiltAndroidApp import dagger.hilt.android.HiltAndroidApp
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.acra.ACRA import org.acra.ACRA
import org.acra.ReportField import org.acra.ReportField
import org.acra.config.dialog import org.acra.config.dialog
@@ -63,10 +64,15 @@ open class BaseApp : Application(), Configuration.Provider {
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
ACRA.errorReporter.putCustomData("isOriginalApp", appValidator.isOriginalApp.toString())
AppCompatDelegate.setDefaultNightMode(settings.theme) AppCompatDelegate.setDefaultNightMode(settings.theme)
AppCompatDelegate.setApplicationLocales(settings.appLocales) AppCompatDelegate.setApplicationLocales(settings.appLocales)
setupActivityLifecycleCallbacks() setupActivityLifecycleCallbacks()
processLifecycleScope.launch {
val isOriginalApp = withContext(Dispatchers.Default) {
appValidator.isOriginalApp
}
ACRA.errorReporter.putCustomData("isOriginalApp", isOriginalApp.toString())
}
processLifecycleScope.launch(Dispatchers.Default) { processLifecycleScope.launch(Dispatchers.Default) {
setupDatabaseObservers() setupDatabaseObservers()
} }
@@ -79,13 +85,6 @@ open class BaseApp : Application(), Configuration.Provider {
initAcra { initAcra {
buildConfigClass = BuildConfig::class.java buildConfigClass = BuildConfig::class.java
reportFormat = StringFormat.JSON reportFormat = StringFormat.JSON
excludeMatchingSharedPreferencesKeys = listOf(
"sources_\\w+",
AppSettings.KEY_APP_PASSWORD,
AppSettings.KEY_PROXY_LOGIN,
AppSettings.KEY_PROXY_ADDRESS,
AppSettings.KEY_PROXY_PASSWORD,
)
httpSender { httpSender {
uri = getString(R.string.url_error_report) uri = getString(R.string.url_error_report)
basicAuthLogin = getString(R.string.acra_login) basicAuthLogin = getString(R.string.acra_login)
@@ -102,7 +101,6 @@ open class BaseApp : Application(), Configuration.Provider {
ReportField.STACK_TRACE, ReportField.STACK_TRACE,
ReportField.CRASH_CONFIGURATION, ReportField.CRASH_CONFIGURATION,
ReportField.CUSTOM_DATA, ReportField.CUSTOM_DATA,
ReportField.SHARED_PREFERENCES,
) )
dialog { dialog {

View File

@@ -449,17 +449,6 @@ class AppSettings @Inject constructor(@ApplicationContext context: Context) {
return result return result
} }
@SuppressLint("ApplySharedPref")
private inline fun SharedPreferences.editAsync(
action: SharedPreferences.Editor.() -> Unit
) {
val editor = edit()
action(editor)
processLifecycleScope.launch(Dispatchers.IO, CoroutineStart.ATOMIC) {
editor.commit()
}
}
companion object { companion object {
const val PAGE_SWITCH_TAPS = "taps" const val PAGE_SWITCH_TAPS = "taps"

View File

@@ -7,8 +7,10 @@ import android.util.AttributeSet
import android.view.View import android.view.View
import androidx.appcompat.widget.TooltipCompat import androidx.appcompat.widget.TooltipCompat
import androidx.core.net.toUri import androidx.core.net.toUri
import androidx.core.view.forEach
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.PreferenceViewHolder import androidx.preference.PreferenceViewHolder
import com.google.android.material.snackbar.Snackbar
import org.koitharu.kotatsu.R import org.koitharu.kotatsu.R
import org.koitharu.kotatsu.databinding.PreferenceAboutLinksBinding import org.koitharu.kotatsu.databinding.PreferenceAboutLinksBinding
@@ -27,12 +29,7 @@ class AboutLinksPreference @JvmOverloads constructor(
super.onBindViewHolder(holder) super.onBindViewHolder(holder)
val binding = PreferenceAboutLinksBinding.bind(holder.itemView) val binding = PreferenceAboutLinksBinding.bind(holder.itemView)
arrayOf( binding.root.forEach { button ->
binding.btn4pda,
binding.btnDiscord,
binding.btnGithub,
binding.btnTelegram,
).forEach { button ->
TooltipCompat.setTooltipText(button, button.contentDescription) TooltipCompat.setTooltipText(button, button.contentDescription)
button.setOnClickListener(this) button.setOnClickListener(this)
} }
@@ -40,16 +37,15 @@ class AboutLinksPreference @JvmOverloads constructor(
override fun onClick(v: View) { override fun onClick(v: View) {
val urlResId = when (v.id) { val urlResId = when (v.id) {
R.id.btn_4pda -> R.string.url_forpda
R.id.btn_discord -> R.string.url_discord R.id.btn_discord -> R.string.url_discord
R.id.btn_telegram -> R.string.url_telegram R.id.btn_telegram -> R.string.url_telegram
R.id.btn_github -> R.string.url_github R.id.btn_github -> R.string.url_github
else -> return else -> return
} }
openLink(v.context.getString(urlResId), v.contentDescription) openLink(v, v.context.getString(urlResId), v.contentDescription)
} }
private fun openLink(url: String, title: CharSequence?) { private fun openLink(v: View, url: String, title: CharSequence?) {
val intent = Intent(Intent.ACTION_VIEW, url.toUri()) val intent = Intent(Intent.ACTION_VIEW, url.toUri())
try { try {
context.startActivity( context.startActivity(
@@ -60,6 +56,7 @@ class AboutLinksPreference @JvmOverloads constructor(
}, },
) )
} catch (_: ActivityNotFoundException) { } catch (_: ActivityNotFoundException) {
Snackbar.make(v, R.string.operation_not_supported, Snackbar.LENGTH_SHORT).show()
} }
} }
} }

View File

@@ -1,11 +0,0 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#000000"
android:pathData="M426.1,112 L112,545.6l0,247.7l486.7,0l0,118.8l313.3,0L912,112ZM599.5,312L599.5,577.6L390.1,577.6Z" />
</vector>

View File

@@ -40,15 +40,4 @@
app:tint="?attr/colorAccent" app:tint="?attr/colorAccent"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
<ImageButton
android:id="@+id/btn_4pda"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="4PDA"
android:padding="16dp"
android:src="@drawable/ic_4pda"
app:tint="?attr/colorAccent"
tools:ignore="HardcodedText" />
</LinearLayout> </LinearLayout>

View File

@@ -2,7 +2,6 @@
<resources> <resources>
<string name="url_github" translatable="false">https://github.com/KotatsuApp/Kotatsu</string> <string name="url_github" translatable="false">https://github.com/KotatsuApp/Kotatsu</string>
<string name="url_discord" translatable="false">https://discord.gg/NNJ5RgVBC5</string> <string name="url_discord" translatable="false">https://discord.gg/NNJ5RgVBC5</string>
<string name="url_forpda" translatable="false">https://4pda.to/forum/index.php?showtopic=697669</string>
<string name="url_telegram" translatable="false">https://t.me/kotatsuapp</string> <string name="url_telegram" translatable="false">https://t.me/kotatsuapp</string>
<string name="url_weblate" translatable="false">https://hosted.weblate.org/engage/kotatsu</string> <string name="url_weblate" translatable="false">https://hosted.weblate.org/engage/kotatsu</string>
<string name="url_error_report" translatable="false">https://acra.kotatsu.app/report</string> <string name="url_error_report" translatable="false">https://acra.kotatsu.app/report</string>
@@ -13,8 +12,8 @@
<string name="anilist_clientId" translatable="false">9887</string> <string name="anilist_clientId" translatable="false">9887</string>
<string name="anilist_clientSecret" translatable="false">wrMqFosItQWsmB8dtAHfIFPDt15FfQi2ZGiKkJoW</string> <string name="anilist_clientSecret" translatable="false">wrMqFosItQWsmB8dtAHfIFPDt15FfQi2ZGiKkJoW</string>
<string name="mal_clientId" translatable="false">6cd8e6349e9a36bc1fc1ab97703c9fd1</string> <string name="mal_clientId" translatable="false">6cd8e6349e9a36bc1fc1ab97703c9fd1</string>
<string name="acra_login" translatable="false">LxUiQIbVgKv1pdtM</string> <string name="acra_login" translatable="false">zPALLBPdpn5mnCB4</string>
<string name="acra_password" translatable="false">gtG6y1MpEPHrdV1z</string> <string name="acra_password" translatable="false">kgpuhoNJpSsQDCwu</string>
<string name="sync_authority_history" translatable="false">org.koitharu.kotatsu.history</string> <string name="sync_authority_history" translatable="false">org.koitharu.kotatsu.history</string>
<string name="sync_authority_favourites" translatable="false">org.koitharu.kotatsu.favourites</string> <string name="sync_authority_favourites" translatable="false">org.koitharu.kotatsu.favourites</string>
<string-array name="values_theme" translatable="false"> <string-array name="values_theme" translatable="false">