emsM}$RsL~Ds;p15d?hU<<)D wvxJ2Dv@c4K+QQ?Y=ZL+9%0gTLeB*4h{b`We^f
zEVy~R&7ru=M9#JG40erfS58L0DH-}zFd5W)dsW`IcKR=9v@Pnq$3B4=6}VR*NiTV$
zqukX3+>z0sac;D1==~-}*gbJ6!(g383>YcNqi%kegKH@&s3f8S>5~i#{nc15#Wg!q
zr&Tja2$ZISutV;hKbMp6-ywY8T{jlP@QmuZeg9nU{e0lxejqz%Y8JojyIPy9a?W=X
zGyAIBIns}Zx)ppZ^2q)0ik^TZ`)fuQ;~Kk%RHHfe{T7i`0PKSM=vJ memoizeObservable(f: (arg: P) -> Observable >()
- fun decorated(arg: P) = cache[arg]?.let { Observable.from(it) } ?: f(arg).map {
- cache.getOrPut(arg, ::mutableListOf).add(it)
- it
- }
- return ::decorated
- }
-
- val memoizedFetchPopularManga = memoizeObservable { page: Int -> super.fetchPopularManga(page) }
-
- // Reduce number of times we call their api, user can force a call to api by relaunching the app
- override fun fetchPopularManga(page: Int) = memoizedFetchPopularManga(page)
-
- override fun popularMangaRequest(page: Int) = GET("$baseUrl/series.json", headers)
-
- override fun popularMangaParse(response: Response): MangasPage {
- val jsonResult = json.parseToJsonElement(response.body!!.string()).jsonObject
-
- val mangaList = jsonResult.entries.map { entry ->
- val jsonObj = entry.value.jsonObject
-
- SManga.create().apply {
- artist = jsonObj["artist"]!!.jsonPrimitive.content
- author = jsonObj["author"]!!.jsonPrimitive.content
- description = jsonObj["description"]!!.jsonPrimitive.content
- genre = jsonObj["genre"]!!.jsonPrimitive.content
- title = jsonObj["title"]!!.jsonPrimitive.content
- thumbnail_url = baseUrl + jsonObj["cover"]!!.jsonPrimitive.content
- url = "/series?series=" + entry.key
- status = SManga.ONGOING
- }
- }
-
- return MangasPage(mangaList, hasNextPage = false)
- }
-
- // Latest
- override fun latestUpdatesRequest(page: Int) = throw UnsupportedOperationException("Not used")
-
- override fun latestUpdatesParse(response: Response) = throw UnsupportedOperationException("Not used")
-
- // Search
- private fun getMangaId(s: String): String? {
- return s.toHttpUrlOrNull()?.let { url ->
- // allow for trailing slash
- if (url.pathSegments.size == 1 && url.pathSegments.last().isNotEmpty() || url.pathSegments.size == 2 && url.pathSegments.last().isEmpty())
- return url.queryParameter("series")
- return null
- }
- }
-
- private fun fetchBySeriesId(id: String): ObservablenYb
zPv> = fetchPopularManga(1).map { mp ->
- mp.mangas.filter { "$baseUrl${it.url}".toHttpUrlOrNull()?.queryParameter("series") == id }
- }
-
- override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable
> {
- val url = "$baseUrl${chapter.url}".toHttpUrlOrNull()!!
- val series = url.queryParameter("series")!!
- val chapternum = url.queryParameter("ch")!!
- fun chapterPages() = chapterNumberCache[series]?.get(chapternum)
- return if (chapterPages() != null) {
- Observable.just(chapterPages()!!)
- } else {
- // Has side effect of setting numPages in cache
- fetchChapterList(
- // Super hacky, url is wrong but has query parameter we need
- SManga.create().apply { this.url = chapter.url }
- ).map {
- chapterPages()
- }
- }.map { numpages ->
- (0 until numpages).toList().map {
- Page(it, "", "$baseUrl/api/image?key=$series/$chapternum/webp/$it.webp")
- }
- }
- }
-
- override fun pageListParse(response: Response) = throw UnsupportedOperationException("Not used")
-
- override fun pageListRequest(chapter: SChapter) = throw UnsupportedOperationException("Not Used")
-
- override fun imageUrlParse(response: Response): String = ""
-
- companion object {
- private val DATE_FORMATTER = SimpleDateFormat("MM/dd/yyyy", Locale.ENGLISH)
-
- const val URL_SEARCH_PREFIX = "url:"
- }
-}
diff --git a/src/en/homeheroscans/src/eu/kanade/tachiyomi/extension/en/homeheroscans/HomeHeroScansUrlActivity.kt b/src/en/homeheroscans/src/eu/kanade/tachiyomi/extension/en/homeheroscans/HomeHeroScansUrlActivity.kt
deleted file mode 100644
index 8d3db8f09..000000000
--- a/src/en/homeheroscans/src/eu/kanade/tachiyomi/extension/en/homeheroscans/HomeHeroScansUrlActivity.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package eu.kanade.tachiyomi.extension.en.homeheroscans
-
-import android.app.Activity
-import android.content.ActivityNotFoundException
-import android.content.Intent
-import android.os.Bundle
-import android.util.Log
-import kotlin.system.exitProcess
-
-class HomeHeroScansUrlActivity : Activity() {
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- val pathSegments = intent?.data?.pathSegments
-
- if (pathSegments?.size == 1) {
- val mainIntent = Intent().apply {
- action = "eu.kanade.tachiyomi.SEARCH"
- putExtra("query", "${HomeHeroScans.URL_SEARCH_PREFIX}${intent?.data?.toString()}")
- putExtra("filter", packageName)
- }
- try {
- startActivity(mainIntent)
- } catch (e: ActivityNotFoundException) {
- Log.e("HomeHeroScansUrl", e.toString())
- }
- } else {
- Log.e("HomeHeroScansUrl", "could not parse uri from intent $intent")
- }
- finish()
- exitProcess(0)
- }
-}