Merge remote-tracking branch 'origin/master'

pull/1560/head^2
gedoor 3 years ago
commit 6e23baa971
  1. 4
      app/src/main/assets/web/rssSource/index.js
  2. 3
      app/src/main/java/io/legado/app/help/AppUpdate.kt
  3. 16
      app/src/main/java/io/legado/app/ui/about/AboutFragment.kt
  4. 3
      app/src/main/res/values/non_translat.xml
  5. 2
      app/src/main/res/xml/about.xml

@ -78,13 +78,13 @@ function rule2json() {
Object.keys(RuleJSON).forEach(key => { Object.keys(RuleJSON).forEach(key => {
RuleJSON[key] = $('#' + key).value; RuleJSON[key] = $('#' + key).value;
}); });
RuleJSON.lastUpdateTime = new Date().getTime(); RuleJSON.lastUpdateTime = new Date().getTime();
RuleJSON.customOrder = RuleJSON.customOrder == '' ? 0 : parseInt(RuleJSON.customOrder); RuleJSON.customOrder = RuleJSON.customOrder == '' ? 0 : parseInt(RuleJSON.customOrder);
RuleJSON.articleStyle = RuleJSON.articleStyle == '' ? 0 : parseInt(RuleJSON.articleStyle);
RuleJSON.enabled = RuleJSON.enabled == '' || String(RuleJSON.enabled).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true'; RuleJSON.enabled = RuleJSON.enabled == '' || String(RuleJSON.enabled).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true';
RuleJSON.enableJs = RuleJSON.enableJs == '' || String(RuleJSON.enableJs).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true'; RuleJSON.enableJs = RuleJSON.enableJs == '' || String(RuleJSON.enableJs).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true';
RuleJSON.loadWithBaseUrl = RuleJSON.loadWithBaseUrl == '' || String(RuleJSON.loadWithBaseUrl).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true'; RuleJSON.loadWithBaseUrl = RuleJSON.loadWithBaseUrl == '' || String(RuleJSON.loadWithBaseUrl).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true';
RuleJSON.singleUrl = RuleJSON.singleUrl == '' || String(RuleJSON.singleUrl).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true'; RuleJSON.singleUrl = String(RuleJSON.singleUrl).toLocaleLowerCase().replace(/^\s*|\s*$/g, '') == 'true';
return RuleJSON; return RuleJSON;
} }
// 将源对象填充到源表单 // 将源对象填充到源表单

@ -1,5 +1,6 @@
package io.legado.app.help package io.legado.app.help
import io.legado.app.R
import io.legado.app.constant.AppConst import io.legado.app.constant.AppConst
import io.legado.app.help.coroutine.Coroutine import io.legado.app.help.coroutine.Coroutine
import io.legado.app.help.http.newCallStrResponse import io.legado.app.help.http.newCallStrResponse
@ -19,7 +20,7 @@ object AppUpdate {
callback: (newVersion: String, updateBody: String, url: String, fileName: String) -> Unit callback: (newVersion: String, updateBody: String, url: String, fileName: String) -> Unit
) { ) {
Coroutine.async(scope) { 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 { val body = okHttpClient.newCallStrResponse {
url(lastReleaseUrl) url(lastReleaseUrl)
}.body }.body

@ -19,8 +19,6 @@ import io.legado.app.utils.*
class AboutFragment : PreferenceFragmentCompat() { class AboutFragment : PreferenceFragmentCompat() {
private val licenseUrl = "https://github.com/gedoor/legado/blob/master/LICENSE"
private val disclaimerUrl = "https://gedoor.github.io/MyBookshelf/disclaimer.html"
private val qqGroups = linkedMapOf( private val qqGroups = linkedMapOf(
Pair("(QQ群1)805192012", "6GlFKjLeIk5RhQnR3PNVDaKB6j10royo"), Pair("(QQ群1)805192012", "6GlFKjLeIk5RhQnR3PNVDaKB6j10royo"),
Pair("(QQ群2)773736122", "5Bm5w6OgLupXnICbYvbgzpPUgf0UlsJF"), Pair("(QQ群2)773736122", "5Bm5w6OgLupXnICbYvbgzpPUgf0UlsJF"),
@ -51,14 +49,14 @@ class AboutFragment : PreferenceFragmentCompat() {
override fun onPreferenceTreeClick(preference: Preference?): Boolean { override fun onPreferenceTreeClick(preference: Preference?): Boolean {
when (preference?.key) { when (preference?.key) {
"contributors" -> openUrl(R.string.contributors_url) "contributors" -> openUrl(R.string.contributors_url)
"update_log" -> showUpdateLog() "update_log" -> show("updateLog.md")
"check_update" -> checkUpdate() "check_update" -> checkUpdate()
"mail" -> requireContext().sendMail("kunfei.ge@gmail.com") "mail" -> requireContext().sendMail(getString(R.string.email))
"sourceRuleSummary" -> openUrl(R.string.source_rule_url) "sourceRuleSummary" -> openUrl(R.string.source_rule_url)
"git" -> openUrl(R.string.this_github_url) "git" -> openUrl(R.string.this_github_url)
"home_page" -> openUrl(R.string.home_page_url) "home_page" -> openUrl(R.string.home_page_url)
"license" -> requireContext().openUrl(licenseUrl) "license" -> openUrl(R.string.license_url)
"disclaimer" -> requireContext().openUrl(disclaimerUrl) "disclaimer" -> show("disclaimer.md")
"qq" -> showQqGroups() "qq" -> showQqGroups()
"gzGzh" -> requireContext().sendToClip(getString(R.string.legado_gzh)) "gzGzh" -> requireContext().sendToClip(getString(R.string.legado_gzh))
"crashLog" -> showCrashLogs() "crashLog" -> showCrashLogs()
@ -73,9 +71,9 @@ class AboutFragment : PreferenceFragmentCompat() {
requireContext().openUrl(getString(addressID)) requireContext().openUrl(getString(addressID))
} }
private fun showUpdateLog() { private fun show(FileName: String) {
val log = String(requireContext().assets.open("updateLog.md").readBytes()) val mdText = String(requireContext().assets.open(FileName).readBytes())
showDialogFragment(TextDialog(log, TextDialog.Mode.MD)) showDialogFragment(TextDialog(mdText, TextDialog.Mode.MD))
} }
private fun checkUpdate() { private fun checkUpdate() {

@ -2,12 +2,13 @@
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation"> <resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
<string name="pk_bookshelf_px">bookshelf_px</string> <string name="pk_bookshelf_px">bookshelf_px</string>
<string name="legado_gzh">开源阅读</string> <string name="legado_gzh">开源阅读</string>
<string name="email">kunfei.ge@gmail.com</string>
<string name="source_rule_url">https://alanskycn.gitee.io/teachme/</string> <string name="source_rule_url">https://alanskycn.gitee.io/teachme/</string>
<string name="this_github_url">https://github.com/gedoor/legado</string> <string name="this_github_url">https://github.com/gedoor/legado</string>
<string name="contributors_url">https://github.com/gedoor/legado/graphs/contributors</string> <string name="contributors_url">https://github.com/gedoor/legado/graphs/contributors</string>
<string name="disclaimer_url">https://gedoor.github.io/MyBookshelf/disclaimer.html</string>
<string name="home_page_url">https://gedoor.github.io/MyBookshelf/</string> <string name="home_page_url">https://gedoor.github.io/MyBookshelf/</string>
<string name="license_url">https://github.com/gedoor/legado/blob/master/LICENSE</string>
<string name="latest_release_url">https://github.com/gedoor/legado/releases/latest</string> <string name="latest_release_url">https://github.com/gedoor/legado/releases/latest</string>
<string name="latest_release_api">https://api.github.com/repos/gedoor/legado/releases/latest</string> <string name="latest_release_api">https://api.github.com/repos/gedoor/legado/releases/latest</string>
<string name="tg_url">https://t.me/legado_channels</string> <string name="tg_url">https://t.me/legado_channels</string>

@ -43,7 +43,7 @@
<io.legado.app.ui.widget.prefs.Preference <io.legado.app.ui.widget.prefs.Preference
android:key="mail" android:key="mail"
android:summary="kunfei.ge@gmail.com" android:summary="@string/email"
android:title="@string/send_mail" android:title="@string/send_mail"
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />

Loading…
Cancel
Save