add optional username in crash report
This commit is contained in:
parent
b1eedce229
commit
ea96291bfc
5 changed files with 82 additions and 20 deletions
|
@ -13,7 +13,9 @@ import ani.dantotsu.parsers.AnimeSources
|
|||
import ani.dantotsu.parsers.MangaSources
|
||||
import ani.dantotsu.parsers.NovelSources
|
||||
import ani.dantotsu.parsers.novel.NovelExtensionManager
|
||||
import ani.dantotsu.settings.SettingsActivity
|
||||
import com.google.android.material.color.DynamicColors
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import eu.kanade.tachiyomi.data.notification.Notifications
|
||||
|
@ -58,6 +60,24 @@ class App : MultiDexApplication() {
|
|||
registerActivityLifecycleCallbacks(mFTActivityLifecycleCallbacks)
|
||||
|
||||
Firebase.crashlytics.setCrashlyticsCollectionEnabled(!DisabledReports)
|
||||
getSharedPreferences(
|
||||
getString(R.string.preference_file_key),
|
||||
Context.MODE_PRIVATE
|
||||
).getBoolean("shared_user_id", true).let {
|
||||
if (!it) return@let
|
||||
val dUsername = getSharedPreferences(
|
||||
getString(R.string.preference_file_key),
|
||||
Context.MODE_PRIVATE
|
||||
).getString("discord_username", null)
|
||||
val aUsername = getSharedPreferences(
|
||||
getString(R.string.preference_file_key),
|
||||
Context.MODE_PRIVATE
|
||||
).getString("anilist_username", null)
|
||||
if (dUsername != null || aUsername != null) {
|
||||
Firebase.crashlytics.setUserId("$dUsername - $aUsername")
|
||||
}
|
||||
}
|
||||
FirebaseCrashlytics.getInstance().setCustomKey("device Info", SettingsActivity.getDeviceInfo())
|
||||
|
||||
Injekt.importModule(AppModule(this))
|
||||
Injekt.importModule(PreferenceModule(this))
|
||||
|
|
|
@ -35,6 +35,13 @@ class AnilistQueries {
|
|||
}.also { println("time : $it") }
|
||||
val user = response?.data?.user ?: return false
|
||||
|
||||
currContext()?.let {
|
||||
it.getSharedPreferences(it.getString(R.string.preference_file_key), Context.MODE_PRIVATE)
|
||||
.edit()
|
||||
.putString("anilist_username", user.name)
|
||||
.apply()
|
||||
}
|
||||
|
||||
Anilist.userid = user.id
|
||||
Anilist.username = user.name
|
||||
Anilist.bg = user.bannerImage
|
||||
|
|
|
@ -80,26 +80,7 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
|
|||
|
||||
binding.settingsVersion.text = getString(R.string.version_current, BuildConfig.VERSION_NAME)
|
||||
binding.settingsVersion.setOnLongClickListener {
|
||||
fun getArch(): String {
|
||||
SUPPORTED_ABIS.forEach {
|
||||
when (it) {
|
||||
"arm64-v8a" -> return "aarch64"
|
||||
"armeabi-v7a" -> return "arm"
|
||||
"x86_64" -> return "x86_64"
|
||||
"x86" -> return "i686"
|
||||
}
|
||||
}
|
||||
return System.getProperty("os.arch") ?: System.getProperty("os.product.cpu.abi")
|
||||
?: "Unknown Architecture"
|
||||
}
|
||||
|
||||
val info = """
|
||||
dantotsu Version: ${BuildConfig.VERSION_NAME}
|
||||
Device: $BRAND $DEVICE
|
||||
Architecture: ${getArch()}
|
||||
OS Version: $CODENAME $RELEASE ($SDK_INT)
|
||||
""".trimIndent()
|
||||
copyToClipboard(info, false)
|
||||
copyToClipboard(getDeviceInfo(), false)
|
||||
toast(getString(R.string.copied_device_info))
|
||||
return@setOnLongClickListener true
|
||||
}
|
||||
|
@ -404,6 +385,17 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
|
|||
binding.settingsRecentlyListOnly.setOnCheckedChangeListener { _, isChecked ->
|
||||
saveData("recently_list_only", isChecked)
|
||||
}
|
||||
binding.settingsShareUsername.isChecked = getSharedPreferences(
|
||||
getString(R.string.preference_file_key),
|
||||
Context.MODE_PRIVATE
|
||||
).getBoolean("shared_user_id", true)
|
||||
binding.settingsShareUsername.setOnCheckedChangeListener { _, isChecked ->
|
||||
getSharedPreferences(
|
||||
getString(R.string.preference_file_key),
|
||||
Context.MODE_PRIVATE
|
||||
).edit().putBoolean("shared_user_id", isChecked).apply()
|
||||
}
|
||||
|
||||
binding.settingsPreferDub.isChecked = loadData("settings_prefer_dub") ?: false
|
||||
binding.settingsPreferDub.setOnCheckedChangeListener { _, isChecked ->
|
||||
saveData("settings_prefer_dub", isChecked)
|
||||
|
@ -853,4 +845,28 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
|
|||
show()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getDeviceInfo(): String {
|
||||
return """
|
||||
dantotsu Version: ${BuildConfig.VERSION_NAME}
|
||||
Device: $BRAND $DEVICE
|
||||
Architecture: ${getArch()}
|
||||
OS Version: $CODENAME $RELEASE ($SDK_INT)
|
||||
""".trimIndent()
|
||||
}
|
||||
|
||||
private fun getArch(): String {
|
||||
SUPPORTED_ABIS.forEach {
|
||||
when (it) {
|
||||
"arm64-v8a" -> return "aarch64"
|
||||
"armeabi-v7a" -> return "arm"
|
||||
"x86_64" -> return "x86_64"
|
||||
"x86" -> return "i686"
|
||||
}
|
||||
}
|
||||
return System.getProperty("os.arch") ?: System.getProperty("os.product.cpu.abi")
|
||||
?: "Unknown Architecture"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue