pull/2339/head
kunfei 2 years ago
parent 242452c3a5
commit fd92b424c7
  1. 8
      app/src/main/java/io/legado/app/ui/about/AboutFragment.kt

@ -15,6 +15,7 @@ import io.legado.app.help.config.AppConfig
import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.dialogs.selector import io.legado.app.lib.dialogs.selector
import io.legado.app.ui.widget.dialog.TextDialog import io.legado.app.ui.widget.dialog.TextDialog
import io.legado.app.ui.widget.dialog.WaitDialog
import io.legado.app.utils.* import io.legado.app.utils.*
import splitties.init.appCtx import splitties.init.appCtx
@ -36,6 +37,10 @@ class AboutFragment : PreferenceFragmentCompat() {
private val qqChannel = private val qqChannel =
"https://qun.qq.com/qqweb/qunpro/share?_wv=3&_wwv=128&inviteCode=25d870&from=246610&biz=ka" "https://qun.qq.com/qqweb/qunpro/share?_wv=3&_wwv=128&inviteCode=25d870&from=246610&biz=ka"
private val waitDialog by lazy {
WaitDialog(requireContext())
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
addPreferencesFromResource(R.xml.about) addPreferencesFromResource(R.xml.about)
findPreference<Preference>("update_log")?.summary = findPreference<Preference>("update_log")?.summary =
@ -85,6 +90,7 @@ class AboutFragment : PreferenceFragmentCompat() {
* 检测更新 * 检测更新
*/ */
private fun checkUpdate() { private fun checkUpdate() {
waitDialog.show()
AppUpdate.checkFromGitHub(lifecycleScope) AppUpdate.checkFromGitHub(lifecycleScope)
.onSuccess { .onSuccess {
showDialogFragment( showDialogFragment(
@ -92,6 +98,8 @@ class AboutFragment : PreferenceFragmentCompat() {
) )
}.onError { }.onError {
appCtx.toastOnUi("${getString(R.string.check_update)}\n${it.localizedMessage}") appCtx.toastOnUi("${getString(R.string.check_update)}\n${it.localizedMessage}")
}.onFinally {
waitDialog.hide()
} }
} }

Loading…
Cancel
Save