pull/913/head
gedoor 4 years ago
parent 59cb14f0a1
commit 360cf2f4fe
  1. 6
      app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt
  2. 17
      app/src/main/java/io/legado/app/ui/config/BackupRestoreUi.kt
  3. 2
      app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt

@ -68,7 +68,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
toastOnUi(R.string.error_get_book_info)
}
} ?: let {
chapterListData.postValue(null)
chapterListData.postValue(emptyList())
toastOnUi(R.string.error_no_source)
}
}
@ -104,11 +104,11 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
toastOnUi(R.string.chapter_list_empty)
}
}.onError {
chapterListData.postValue(null)
chapterListData.postValue(emptyList())
toastOnUi(R.string.error_get_chapter_list)
}
} ?: let {
chapterListData.postValue(null)
chapterListData.postValue(emptyList())
toastOnUi(R.string.error_no_source)
}
}

@ -3,7 +3,6 @@ package io.legado.app.ui.config
import android.app.Activity.RESULT_OK
import android.content.Intent
import android.net.Uri
import androidx.activity.result.contract.ActivityResultContracts
import androidx.documentfile.provider.DocumentFile
import androidx.fragment.app.Fragment
import io.legado.app.R
@ -104,13 +103,17 @@ object BackupRestoreUi {
}
private fun restoreUsePermission(fragment: Fragment, path: String) {
fragment.registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) {
Coroutine.async {
AppConfig.backupPath = path
Restore.restoreDatabase(path)
Restore.restoreConfig(path)
PermissionsCompat.Builder(fragment)
.addPermissions(*Permissions.Group.STORAGE)
.rationale(R.string.tip_perm_request_storage)
.onGranted {
Coroutine.async {
AppConfig.backupPath = path
Restore.restoreDatabase(path)
Restore.restoreConfig(path)
}
}
}.launch(Permissions.Group.STORAGE)
.request()
}
fun importOldData(fragment: Fragment) {

@ -53,7 +53,7 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application),
rssArticle = rssStar?.toRssArticle() ?: appDb.rssArticleDao.get(origin, link)
rssArticle?.let { rssArticle ->
if (!rssArticle.description.isNullOrBlank()) {
contentLiveData.postValue(rssArticle.description)
contentLiveData.postValue(rssArticle.description!!)
} else {
rssSource?.let {
val ruleContent = it.ruleContent

Loading…
Cancel
Save