pull/1282/head
gedoor 3 years ago
parent d626d1392e
commit 7631e05a81
  1. 6
      app/src/main/assets/updateLog.md
  2. 4
      app/src/main/java/io/legado/app/model/Debug.kt
  3. 4
      app/src/main/java/io/legado/app/model/rss/Rss.kt
  4. 4
      app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt
  5. 8
      app/src/main/java/io/legado/app/model/rss/RssParserDefault.kt
  6. 5
      app/src/main/java/io/legado/app/model/rss/RssResult.kt
  7. 8
      app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt

@ -12,6 +12,12 @@
* 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源!
* 关于最近版本有时候界面没有数据的问题是因为把LiveData组件换成了谷歌推荐的Flow组件导致的问题,正在查找解决办法
**2021/08/28**
1. 发现界面添加登录菜单
2. 优化调试界面,预设搜索项可以点击
3. 修复再没有webDav恢复时恢复按钮没反应的bug
**2021/08/27**
1. 修复导入书源问题

@ -102,7 +102,7 @@ object Debug {
val sort = rssSource.sortUrls().first()
Rss.getArticles(scope, sort.first, sort.second, rssSource, 1)
.onSuccess {
if (it.articles.isEmpty()) {
if (it.first.isEmpty()) {
log(debugSource, "⇒列表页解析成功,为空")
log(debugSource, "︽解析完成", state = 1000)
} else {
@ -113,7 +113,7 @@ object Debug {
if (ruleContent.isNullOrEmpty()) {
log(debugSource, "⇒内容规则为空,默认获取整个网页", state = 1000)
} else {
rssContentDebug(scope, it.articles[0], ruleContent, rssSource)
rssContentDebug(scope, it.first[0], ruleContent, rssSource)
}
} else {
log(debugSource, "⇒存在描述规则,不解析内容页")

@ -22,7 +22,7 @@ object Rss {
rssSource: RssSource,
page: Int,
context: CoroutineContext = Dispatchers.IO
): Coroutine<RssResult> {
): Coroutine<Pair<MutableList<RssArticle>, String?>> {
return Coroutine.async(scope, context) {
getArticlesAwait(sortName, sortUrl, rssSource, page)
}
@ -33,7 +33,7 @@ object Rss {
sortUrl: String,
rssSource: RssSource,
page: Int,
): RssResult {
): Pair<MutableList<RssArticle>, String?> {
val ruleData = RuleData()
val analyzeUrl = AnalyzeUrl(
sortUrl,

@ -22,7 +22,7 @@ object RssParserByRule {
body: String?,
rssSource: RssSource,
ruleData: RuleDataInterface
): RssResult {
): Pair<MutableList<RssArticle>, String?> {
val sourceUrl = rssSource.sourceUrl
var nextUrl: String? = null
if (body.isNullOrBlank()) {
@ -79,7 +79,7 @@ object RssParserByRule {
if (reverse) {
articleList.reverse()
}
return RssResult(articleList, nextUrl)
return Pair(articleList, nextUrl)
}
}

@ -12,7 +12,11 @@ import java.io.StringReader
object RssParserDefault {
@Throws(XmlPullParserException::class, IOException::class)
fun parseXML(sortName: String, xml: String, sourceUrl: String): RssResult {
fun parseXML(
sortName: String,
xml: String,
sourceUrl: String
): Pair<MutableList<RssArticle>, String?> {
val articleList = mutableListOf<RssArticle>()
var currentArticle = RssArticle()
@ -106,7 +110,7 @@ object RssParserDefault {
Debug.log(sourceUrl, "┌获取文章链接")
Debug.log(sourceUrl, "${it.link}")
}
return RssResult(articleList, null)
return Pair(articleList, null)
}
/**

@ -1,5 +0,0 @@
package io.legado.app.model.rss
import io.legado.app.data.entities.RssArticle
data class RssResult(val articles: MutableList<RssArticle>, val nextPageUrl: String?)

@ -34,8 +34,8 @@ class RssArticlesViewModel(application: Application) : BaseViewModel(application
page = 1
Rss.getArticles(viewModelScope, sortName, sortUrl, rssSource, page)
.onSuccess(Dispatchers.IO) {
nextPageUrl = it.nextPageUrl
it.articles.let { list ->
nextPageUrl = it.second
it.first.let { list ->
list.forEach { rssArticle ->
rssArticle.order = order--
}
@ -64,8 +64,8 @@ class RssArticlesViewModel(application: Application) : BaseViewModel(application
if (!pageUrl.isNullOrEmpty()) {
Rss.getArticles(viewModelScope, sortName, pageUrl, rssSource, page)
.onSuccess(Dispatchers.IO) {
nextPageUrl = it.nextPageUrl
loadMoreSuccess(it.articles)
nextPageUrl = it.second
loadMoreSuccess(it.first)
}
.onError {
it.printStackTrace()

Loading…
Cancel
Save