Mangasee: Add intent filter (#12727)

* Mangasee: Add intent filter

* Update Mangasee.kt as per suggestion

Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com>

* Update multisrc/overrides/nepnep/mangasee/src/MangaSee.kt

* Remove trailing whitespaces and blank lines

* Fix missing imports

Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com>
This commit is contained in:
Wisest_wizard 2022-08-06 22:29:45 +01:00 committed by GitHub
parent 84aaf70e0e
commit 4a54a8c801
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 84 additions and 1 deletions

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="eu.kanade.tachiyomi.extension">
<application>
<activity
android:name="eu.kanade.tachiyomi.multisrc.mangasee.MangaseeUrlActivity"
android:excludeFromRecents="true"
android:exported="true"
android:theme="@android:style/Theme.NoDisplay">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="mangasee123.com"
android:pathPattern="/manga/*"
android:scheme="https" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -1,8 +1,13 @@
package eu.kanade.tachiyomi.extension.en.mangasee
import eu.kanade.tachiyomi.multisrc.nepnep.NepNep
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.asObservableSuccess
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.MangasPage
import okhttp3.OkHttpClient
import rx.Observable
import java.util.concurrent.TimeUnit
class MangaSee : NepNep("MangaSee", "https://mangasee123.com", "en") {
@ -15,4 +20,19 @@ class MangaSee : NepNep("MangaSee", "https://mangasee123.com", "en") {
.readTimeout(1, TimeUnit.MINUTES)
.writeTimeout(1, TimeUnit.MINUTES)
.build()
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
if (query.startsWith("id:")) {
val id = query.substringAfter("id:")
return client.newCall(GET("$baseUrl/manga/$id/"))
.asObservableSuccess()
.map { response ->
val manga = mangaDetailsParse(response)
manga.url = "/manga/$id/"
MangasPage(listOf(manga), false)
}
}
return super.fetchSearchManga(page, query, filters)
}
}

View File

@ -0,0 +1,38 @@
package eu.kanade.tachiyomi.multisrc.mangasee
import android.app.Activity
import android.content.ActivityNotFoundException
import android.content.Intent
import android.os.Bundle
import android.util.Log
import kotlin.system.exitProcess
/**
* Springboard that accepts https://mangasee123.com/manga/xxxxxx intents and redirects them to
* the main Tachiyomi process.
*/
class MangaseeUrlActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val pathSegments = intent?.data?.pathSegments
if (pathSegments != null && pathSegments.size > 1) {
val id = pathSegments[1]
val mainIntent = Intent().apply {
action = "eu.kanade.tachiyomi.SEARCH"
putExtra("query", "id:$id")
putExtra("filter", packageName)
}
try {
startActivity(mainIntent)
} catch (e: ActivityNotFoundException) {
Log.e("MangaseeUrlActivity", e.toString())
}
} else {
Log.e("MangaseeUrlActivity", "could not parse uri from intent $intent")
}
finish()
exitProcess(0)
}
}

View File

@ -12,7 +12,7 @@ class NepNepGenerator : ThemeSourceGenerator {
override val baseVersionCode: Int = 11
override val sources = listOf(
SingleLang("MangaSee", "https://mangasee123.com", "en", overrideVersionCode = 20),
SingleLang("MangaSee", "https://mangasee123.com", "en", overrideVersionCode = 21),
SingleLang("MangaLife", "https://manga4life.com", "en", overrideVersionCode = 16),
)