This commit is contained in:
Xwite
2022-01-23 08:27:22 +08:00
parent c3308205b7
commit b8536a46a7
4 changed files with 12 additions and 16 deletions
@@ -1,5 +1,6 @@
package io.legado.app.help
import io.legado.app.R
import io.legado.app.constant.AppConst
import io.legado.app.help.coroutine.Coroutine
import io.legado.app.help.http.newCallStrResponse
@@ -19,7 +20,7 @@ object AppUpdate {
callback: (newVersion: String, updateBody: String, url: String, fileName: String) -> Unit
) {
Coroutine.async(scope) {
val lastReleaseUrl = "https://api.github.com/repos/gedoor/legado/releases/latest"
val lastReleaseUrl = appCtx.getString(R.string.latest_release_api)
val body = okHttpClient.newCallStrResponse {
url(lastReleaseUrl)
}.body
@@ -19,7 +19,6 @@ import io.legado.app.utils.*
class AboutFragment : PreferenceFragmentCompat() {
private val licenseUrl = "https://github.com/gedoor/legado/blob/master/LICENSE"
private val qqGroups = linkedMapOf(
Pair("(QQ群1)805192012", "6GlFKjLeIk5RhQnR3PNVDaKB6j10royo"),
Pair("(QQ群2)773736122", "5Bm5w6OgLupXnICbYvbgzpPUgf0UlsJF"),
@@ -50,14 +49,14 @@ class AboutFragment : PreferenceFragmentCompat() {
override fun onPreferenceTreeClick(preference: Preference?): Boolean {
when (preference?.key) {
"contributors" -> openUrl(R.string.contributors_url)
"update_log" -> showUpdateLog()
"update_log" -> show("updateLog.md")
"check_update" -> checkUpdate()
"mail" -> requireContext().sendMail("kunfei.ge@gmail.com")
"mail" -> requireContext().sendMail(getString(R.string.email))
"sourceRuleSummary" -> openUrl(R.string.source_rule_url)
"git" -> openUrl(R.string.this_github_url)
"home_page" -> openUrl(R.string.home_page_url)
"license" -> requireContext().openUrl(licenseUrl)
"disclaimer" -> showDisclaimer()
"license" -> openUrl(R.string.license_url)
"disclaimer" -> show("disclaimer.md")
"qq" -> showQqGroups()
"gzGzh" -> requireContext().sendToClip(getString(R.string.legado_gzh))
"crashLog" -> showCrashLogs()
@@ -72,14 +71,9 @@ class AboutFragment : PreferenceFragmentCompat() {
requireContext().openUrl(getString(addressID))
}
private fun showUpdateLog() {
val log = String(requireContext().assets.open("updateLog.md").readBytes())
showDialogFragment(TextDialog(log, TextDialog.Mode.MD))
}
private fun showDisclaimer() {
val disclaimer = String(requireContext().assets.open("disclaimer.md").readBytes())
showDialogFragment(TextDialog(disclaimer, TextDialog.Mode.MD))
private fun show(FileName: String) {
val mdText = String(requireContext().assets.open(FileName).readBytes())
showDialogFragment(TextDialog(mdText, TextDialog.Mode.MD))
}
private fun checkUpdate() {