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组件导致的问题,正在查找解决办法 * 关于最近版本有时候界面没有数据的问题是因为把LiveData组件换成了谷歌推荐的Flow组件导致的问题,正在查找解决办法
**2021/08/28**
1. 发现界面添加登录菜单
2. 优化调试界面,预设搜索项可以点击
3. 修复再没有webDav恢复时恢复按钮没反应的bug
**2021/08/27** **2021/08/27**
1. 修复导入书源问题 1. 修复导入书源问题

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

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

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

@ -12,7 +12,11 @@ import java.io.StringReader
object RssParserDefault { object RssParserDefault {
@Throws(XmlPullParserException::class, IOException::class) @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>() val articleList = mutableListOf<RssArticle>()
var currentArticle = RssArticle() var currentArticle = RssArticle()
@ -106,7 +110,7 @@ object RssParserDefault {
Debug.log(sourceUrl, "┌获取文章链接") Debug.log(sourceUrl, "┌获取文章链接")
Debug.log(sourceUrl, "${it.link}") 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 page = 1
Rss.getArticles(viewModelScope, sortName, sortUrl, rssSource, page) Rss.getArticles(viewModelScope, sortName, sortUrl, rssSource, page)
.onSuccess(Dispatchers.IO) { .onSuccess(Dispatchers.IO) {
nextPageUrl = it.nextPageUrl nextPageUrl = it.second
it.articles.let { list -> it.first.let { list ->
list.forEach { rssArticle -> list.forEach { rssArticle ->
rssArticle.order = order-- rssArticle.order = order--
} }
@ -64,8 +64,8 @@ class RssArticlesViewModel(application: Application) : BaseViewModel(application
if (!pageUrl.isNullOrEmpty()) { if (!pageUrl.isNullOrEmpty()) {
Rss.getArticles(viewModelScope, sortName, pageUrl, rssSource, page) Rss.getArticles(viewModelScope, sortName, pageUrl, rssSource, page)
.onSuccess(Dispatchers.IO) { .onSuccess(Dispatchers.IO) {
nextPageUrl = it.nextPageUrl nextPageUrl = it.second
loadMoreSuccess(it.articles) loadMoreSuccess(it.first)
} }
.onError { .onError {
it.printStackTrace() it.printStackTrace()

Loading…
Cancel
Save