diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index 0f1044235..09f0def6a 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -12,6 +12,12 @@ * 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源! * 关于最近版本有时候界面没有数据的问题是因为把LiveData组件换成了谷歌推荐的Flow组件导致的问题,正在查找解决办法 +**2021/08/28** + +1. 发现界面添加登录菜单 +2. 优化调试界面,预设搜索项可以点击 +3. 修复再没有webDav恢复时恢复按钮没反应的bug + **2021/08/27** 1. 修复导入书源问题 diff --git a/app/src/main/java/io/legado/app/model/Debug.kt b/app/src/main/java/io/legado/app/model/Debug.kt index 1af763707..20ece55df 100644 --- a/app/src/main/java/io/legado/app/model/Debug.kt +++ b/app/src/main/java/io/legado/app/model/Debug.kt @@ -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, "⇒存在描述规则,不解析内容页") diff --git a/app/src/main/java/io/legado/app/model/rss/Rss.kt b/app/src/main/java/io/legado/app/model/rss/Rss.kt index 51539ee0a..3207fcc3c 100644 --- a/app/src/main/java/io/legado/app/model/rss/Rss.kt +++ b/app/src/main/java/io/legado/app/model/rss/Rss.kt @@ -22,7 +22,7 @@ object Rss { rssSource: RssSource, page: Int, context: CoroutineContext = Dispatchers.IO - ): Coroutine { + ): Coroutine, 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, String?> { val ruleData = RuleData() val analyzeUrl = AnalyzeUrl( sortUrl, diff --git a/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt b/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt index b0c039095..f03129e8a 100644 --- a/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt +++ b/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt @@ -22,7 +22,7 @@ object RssParserByRule { body: String?, rssSource: RssSource, ruleData: RuleDataInterface - ): RssResult { + ): Pair, 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) } } diff --git a/app/src/main/java/io/legado/app/model/rss/RssParserDefault.kt b/app/src/main/java/io/legado/app/model/rss/RssParserDefault.kt index 2cb3d6c17..6568283c3 100644 --- a/app/src/main/java/io/legado/app/model/rss/RssParserDefault.kt +++ b/app/src/main/java/io/legado/app/model/rss/RssParserDefault.kt @@ -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, String?> { val articleList = mutableListOf() 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) } /** diff --git a/app/src/main/java/io/legado/app/model/rss/RssResult.kt b/app/src/main/java/io/legado/app/model/rss/RssResult.kt deleted file mode 100644 index 4074871ff..000000000 --- a/app/src/main/java/io/legado/app/model/rss/RssResult.kt +++ /dev/null @@ -1,5 +0,0 @@ -package io.legado.app.model.rss - -import io.legado.app.data.entities.RssArticle - -data class RssResult(val articles: MutableList, val nextPageUrl: String?) \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt index b30579356..1a414dec6 100644 --- a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt @@ -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()