diff --git a/app/src/main/java/io/legado/app/model/rss/Result.kt b/app/src/main/java/io/legado/app/model/rss/Result.kt deleted file mode 100644 index 4d7f67c0a..000000000 --- a/app/src/main/java/io/legado/app/model/rss/Result.kt +++ /dev/null @@ -1,5 +0,0 @@ -package io.legado.app.model.rss - -import io.legado.app.data.entities.RssArticle - -data class Result(val articles: MutableList, val nextPageUrl: String?) \ No newline at end of file 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 f9ea78195..830f72a80 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 @@ -5,8 +5,6 @@ import io.legado.app.data.entities.RssSource import io.legado.app.help.coroutine.Coroutine import io.legado.app.model.analyzeRule.AnalyzeRule import io.legado.app.model.analyzeRule.AnalyzeUrl -import io.legado.app.model.rss.Result -import io.legado.app.model.rss.RssParserByRule import io.legado.app.utils.NetworkUtils import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -21,7 +19,7 @@ object Rss { page: Int, scope: CoroutineScope = Coroutine.DEFAULT, context: CoroutineContext = Dispatchers.IO - ): Coroutine { + ): Coroutine { return Coroutine.async(scope, context) { 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 047d39459..82ab063ae 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 @@ -14,7 +14,12 @@ import java.util.* object RssParserByRule { @Throws(Exception::class) - fun parseXML(sortName: String, sortUrl: String, body: String?, rssSource: RssSource): Result { + fun parseXML( + sortName: String, + sortUrl: String, + body: String?, + rssSource: RssSource + ): RssResult { val sourceUrl = rssSource.sourceUrl var nextUrl: String? = null if (body.isNullOrBlank()) { @@ -29,7 +34,7 @@ object RssParserByRule { var ruleArticles = rssSource.ruleArticles if (ruleArticles.isNullOrBlank()) { Debug.log(sourceUrl, "⇒列表规则为空, 使用默认规则解析") - return RssParser.parseXML(sortName, body, sourceUrl) + return RssParserDefault.parseXML(sortName, body, sourceUrl) } else { val articleList = mutableListOf() val analyzeRule = AnalyzeRule() @@ -72,7 +77,7 @@ object RssParserByRule { if (reverse) { articleList.reverse() } - return Result(articleList, nextUrl) + return RssResult(articleList, nextUrl) } } diff --git a/app/src/main/java/io/legado/app/model/rss/RssParser.kt b/app/src/main/java/io/legado/app/model/rss/RssParserDefault.kt similarity index 98% rename from app/src/main/java/io/legado/app/model/rss/RssParser.kt rename to app/src/main/java/io/legado/app/model/rss/RssParserDefault.kt index e6667164e..2a02c2bdc 100644 --- a/app/src/main/java/io/legado/app/model/rss/RssParser.kt +++ b/app/src/main/java/io/legado/app/model/rss/RssParserDefault.kt @@ -8,10 +8,10 @@ import org.xmlpull.v1.XmlPullParserFactory import java.io.IOException import java.io.StringReader -object RssParser { +object RssParserDefault { @Throws(XmlPullParserException::class, IOException::class) - fun parseXML(sortName: String, xml: String, sourceUrl: String): Result { + fun parseXML(sortName: String, xml: String, sourceUrl: String): RssResult { val articleList = mutableListOf() var currentArticle = RssArticle() @@ -105,7 +105,7 @@ object RssParser { Debug.log(sourceUrl, "┌获取文章链接") Debug.log(sourceUrl, "└${it.link}") } - return Result(articleList, null) + return RssResult(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 new file mode 100644 index 000000000..4074871ff --- /dev/null +++ b/app/src/main/java/io/legado/app/model/rss/RssResult.kt @@ -0,0 +1,5 @@ +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