Fix MangAdventure deeplinks (#8334)

This commit is contained in:
ObserverOfTime 2021-07-31 20:05:55 +03:00 committed by GitHub
parent 1543a28487
commit d1d027fd91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 19 additions and 46 deletions

View File

@ -1,27 +0,0 @@
<?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.mangadventure.MangAdventureActivity"
android:theme="@android:style/Theme.NoDisplay"
android:excludeFromRecents="true">
<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="assortedscans.com"
android:pathPattern="/reader/..*"
android:scheme="https"/>
<data android:host="www.assortedscans.com"
android:pathPattern="/reader/..*"
android:scheme="https"/>
<data android:host="helveticascans.com"
android:pathPattern="/reader/..*"
android:scheme="https"/>
<data android:host="www.helveticascans.com"
android:pathPattern="/reader/..*"
android:scheme="https"/>
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -9,12 +9,12 @@
<action android:name="android.intent.action.VIEW"/> <action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/> <category android:name="android.intent.category.BROWSABLE"/>
<data android:host="arc-relight.com" <data android:host="${SOURCEHOST}"
android:pathPattern="/reader/..*" android:pathPattern="/reader/..*"
android:scheme="https"/> android:scheme="${SOURCESCHEME}" />
<data android:host="www.arc-relight.com" <data android:host="www.${SOURCEHOST}"
android:pathPattern="/reader/..*" android:pathPattern="/reader/..*"
android:scheme="https"/> android:scheme="${SOURCESCHEME}" />
</intent-filter> </intent-filter>
</activity> </activity>
</application> </application>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -8,28 +8,27 @@ import android.util.Log
import kotlin.system.exitProcess import kotlin.system.exitProcess
/** /**
* Springboard that accepts `{baseUrl}/reader/{slug}` * Springboard that accepts `{baseUrl}/reader/{slug}/`
* intents and redirects them to the main Tachiyomi process. * intents and redirects them to the main Tachiyomi process.
*/ */
class MangAdventureActivity : Activity() { class MangAdventureActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
intent?.data?.pathSegments?.takeIf { it.size > 1 }?.let { val segments = intent?.data?.pathSegments
try { if (segments != null && segments.size > 1) {
startActivity( val activity = Intent().apply {
Intent().apply {
action = "eu.kanade.tachiyomi.SEARCH" action = "eu.kanade.tachiyomi.SEARCH"
putExtra("query", MangAdventure.SLUG_QUERY + it[1]) putExtra("query", MangAdventure.SLUG_QUERY + segments[1])
putExtra("filter", packageName) putExtra("filter", packageName)
} }
) try {
startActivity(activity)
} catch (ex: ActivityNotFoundException) { } catch (ex: ActivityNotFoundException) {
Log.e("MangAdventureActivity", ex.message, ex) Log.e("MangAdventureActivity", ex.message, ex)
} }
} ?: Log.e( } else {
"MangAdventureActivity", Log.e("MangAdventureActivity", "Failed to parse URI from intent: $intent")
"Failed to parse URI from intent: $intent" }
)
finish() finish()
exitProcess(0) exitProcess(0)
} }

View File

@ -9,7 +9,7 @@ class MangAdventureGenerator : ThemeSourceGenerator {
override val themeClass = "MangAdventure" override val themeClass = "MangAdventure"
override val baseVersionCode = 3 override val baseVersionCode = 4
override val sources = listOf( override val sources = listOf(
SingleLang("Arc-Relight", "https://arc-relight.com", "en", className = "ArcRelight"), SingleLang("Arc-Relight", "https://arc-relight.com", "en", className = "ArcRelight"),
@ -18,6 +18,7 @@ class MangAdventureGenerator : ThemeSourceGenerator {
) )
companion object { companion object {
@JvmStatic fun main(args: Array<String>) = MangAdventureGenerator().createAll() @JvmStatic
fun main(args: Array<String>) = MangAdventureGenerator().createAll()
} }
} }