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.MangaSources
|
||||||
import ani.dantotsu.parsers.NovelSources
|
import ani.dantotsu.parsers.NovelSources
|
||||||
import ani.dantotsu.parsers.novel.NovelExtensionManager
|
import ani.dantotsu.parsers.novel.NovelExtensionManager
|
||||||
|
import ani.dantotsu.settings.SettingsActivity
|
||||||
import com.google.android.material.color.DynamicColors
|
import com.google.android.material.color.DynamicColors
|
||||||
|
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||||
import com.google.firebase.crashlytics.ktx.crashlytics
|
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||||
import com.google.firebase.ktx.Firebase
|
import com.google.firebase.ktx.Firebase
|
||||||
import eu.kanade.tachiyomi.data.notification.Notifications
|
import eu.kanade.tachiyomi.data.notification.Notifications
|
||||||
|
@ -58,6 +60,24 @@ class App : MultiDexApplication() {
|
||||||
registerActivityLifecycleCallbacks(mFTActivityLifecycleCallbacks)
|
registerActivityLifecycleCallbacks(mFTActivityLifecycleCallbacks)
|
||||||
|
|
||||||
Firebase.crashlytics.setCrashlyticsCollectionEnabled(!DisabledReports)
|
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(AppModule(this))
|
||||||
Injekt.importModule(PreferenceModule(this))
|
Injekt.importModule(PreferenceModule(this))
|
||||||
|
|
|
@ -35,6 +35,13 @@ class AnilistQueries {
|
||||||
}.also { println("time : $it") }
|
}.also { println("time : $it") }
|
||||||
val user = response?.data?.user ?: return false
|
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.userid = user.id
|
||||||
Anilist.username = user.name
|
Anilist.username = user.name
|
||||||
Anilist.bg = user.bannerImage
|
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.text = getString(R.string.version_current, BuildConfig.VERSION_NAME)
|
||||||
binding.settingsVersion.setOnLongClickListener {
|
binding.settingsVersion.setOnLongClickListener {
|
||||||
fun getArch(): String {
|
copyToClipboard(getDeviceInfo(), false)
|
||||||
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)
|
|
||||||
toast(getString(R.string.copied_device_info))
|
toast(getString(R.string.copied_device_info))
|
||||||
return@setOnLongClickListener true
|
return@setOnLongClickListener true
|
||||||
}
|
}
|
||||||
|
@ -404,6 +385,17 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
|
||||||
binding.settingsRecentlyListOnly.setOnCheckedChangeListener { _, isChecked ->
|
binding.settingsRecentlyListOnly.setOnCheckedChangeListener { _, isChecked ->
|
||||||
saveData("recently_list_only", 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.isChecked = loadData("settings_prefer_dub") ?: false
|
||||||
binding.settingsPreferDub.setOnCheckedChangeListener { _, isChecked ->
|
binding.settingsPreferDub.setOnCheckedChangeListener { _, isChecked ->
|
||||||
saveData("settings_prefer_dub", isChecked)
|
saveData("settings_prefer_dub", isChecked)
|
||||||
|
@ -853,4 +845,28 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
|
||||||
show()
|
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"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1044,6 +1044,24 @@
|
||||||
app:showText="false"
|
app:showText="false"
|
||||||
app:thumbTint="@color/button_switch_track" />
|
app:thumbTint="@color/button_switch_track" />
|
||||||
|
|
||||||
|
<com.google.android.material.materialswitch.MaterialSwitch
|
||||||
|
android:id="@+id/settingsShareUsername"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:checked="false"
|
||||||
|
android:drawableStart="@drawable/ic_round_search_24"
|
||||||
|
android:drawablePadding="16dp"
|
||||||
|
android:elegantTextHeight="true"
|
||||||
|
android:fontFamily="@font/poppins_bold"
|
||||||
|
android:minHeight="64dp"
|
||||||
|
android:text="@string/share_username_in_crash_reports"
|
||||||
|
android:textAlignment="viewStart"
|
||||||
|
android:textColor="?attr/colorOnBackground"
|
||||||
|
app:cornerRadius="0dp"
|
||||||
|
app:drawableTint="?attr/colorPrimary"
|
||||||
|
app:showText="false"
|
||||||
|
app:thumbTint="@color/button_switch_track" />
|
||||||
|
|
||||||
</ani.dantotsu.others.Xpandable>
|
</ani.dantotsu.others.Xpandable>
|
||||||
|
|
||||||
<ani.dantotsu.others.Xpandable
|
<ani.dantotsu.others.Xpandable
|
||||||
|
|
|
@ -652,5 +652,6 @@
|
||||||
<string name="purge_manga_downloads">Delete all Manga Downloads</string>
|
<string name="purge_manga_downloads">Delete all Manga Downloads</string>
|
||||||
<string name="purge_novel_downloads">Delete all Novel Downloads</string>
|
<string name="purge_novel_downloads">Delete all Novel Downloads</string>
|
||||||
<string name="requires_android_12">Requires Android 12+</string>
|
<string name="requires_android_12">Requires Android 12+</string>
|
||||||
|
<string name="share_username_in_crash_reports">Share username in crash reports</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue