Revert module changes (closes #1129)

This commit is contained in:
Eugene Cheung 2019-05-24 23:03:28 -04:00
parent 084960736e
commit e267352b13
No known key found for this signature in database
GPG Key ID: E1FD745328866B0A
11 changed files with 66 additions and 63 deletions

View File

@ -1,37 +0,0 @@
package eu.kanade.tachiyomi.lib.urlhandler
import android.app.Activity
import android.content.ActivityNotFoundException
import android.content.Intent
import android.os.Bundle
import android.util.Log
abstract class UrlHandlerActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val pathSegments = intent?.data?.pathSegments
if (pathSegments != null && pathSegments.size > 1) {
val query = getQueryFromPathSegments(pathSegments)
val mainIntent = Intent().apply {
action = "eu.kanade.tachiyomi.SEARCH"
putExtra("query", query)
putExtra("filter", packageName)
}
try {
startActivity(mainIntent)
} catch (e: ActivityNotFoundException) {
Log.e(localClassName, e.toString())
}
} else {
Log.e(localClassName, "Could not parse uri from intent: $intent")
}
finish()
System.exit(0)
}
abstract fun getQueryFromPathSegments(pathSegments: List<String>): String
}

View File

@ -24,6 +24,6 @@ repositories {
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compileOnly "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compileOnly 'com.squareup.okhttp3:okhttp:3.10.0'
}

View File

@ -1,3 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="eu.kanade.tachiyomi.lib">
package="eu.kanade.tachiyomi.lib.ratelimit">
</manifest>

View File

@ -6,8 +6,8 @@ new File(rootDir, "src").eachDir { dir ->
}
}
include ':extension-lib'
project(':extension-lib').projectDir = new File("lib/extension-lib")
include ':lib-ratelimit'
project(':lib-ratelimit').projectDir = new File("lib/ratelimit")
include ':duktape-stub'
project(':duktape-stub').projectDir = new File("lib/duktape-stub")

View File

@ -5,12 +5,12 @@ ext {
appName = 'Tachiyomi: MangaDex'
pkgNameSuffix = 'all.mangadex'
extClass = '.MangadexFactory'
extVersionCode = 59
extVersionCode = 60
libVersion = '1.2'
}
dependencies {
implementation project(':extension-lib')
implementation project(':lib-ratelimit')
compileOnly project(':preference-stub')
compileOnly 'com.google.code.gson:gson:2.8.2'
compileOnly 'com.github.salomonbrys.kotson:kotson:2.5.0'

View File

@ -1,6 +1,10 @@
package eu.kanade.tachiyomi.extension.all.mangadex
import eu.kanade.tachiyomi.lib.urlhandler.UrlHandlerActivity
import android.app.Activity
import android.content.ActivityNotFoundException
import android.content.Intent
import android.os.Bundle
import android.util.Log
/**
* Springboard that accepts https://mangadex.com/title/xxx intents and redirects them to
@ -11,11 +15,30 @@ import eu.kanade.tachiyomi.lib.urlhandler.UrlHandlerActivity
* Main goal was to make it easier to open manga in Tachiyomi in spite of the DDoS blocking
* the usual search screen from working.
*/
class MangadexUrlActivity : UrlHandlerActivity() {
class MangadexUrlActivity : Activity() {
override fun getQueryFromPathSegments(pathSegments: List<String>): String {
val id = pathSegments[1]
return "${Mangadex.PREFIX_ID_SEARCH}$id"
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val pathSegments = intent?.data?.pathSegments
if (pathSegments != null && pathSegments.size > 1) {
val titleid = pathSegments[1]
val mainIntent = Intent().apply {
action = "eu.kanade.tachiyomi.SEARCH"
putExtra("query", "${Mangadex.PREFIX_ID_SEARCH}$titleid")
putExtra("filter", packageName)
}
try {
startActivity(mainIntent)
} catch (e: ActivityNotFoundException) {
Log.e("MangadexUrlActivity", e.toString())
}
} else {
Log.e("MangadexUrlActivity", "could not parse uri from intent $intent")
}
finish()
System.exit(0)
}
}

View File

@ -5,12 +5,8 @@ ext {
appName = 'Tachiyomi: NHentai'
pkgNameSuffix = 'all.nhentai'
extClass = '.NHEnglish; .NHJapanese; .NHChinese'
extVersionCode = 12
extVersionCode = 13
libVersion = '1.2'
}
dependencies {
implementation project(':extension-lib')
}
apply from: "$rootDir/common.gradle"

View File

@ -1,16 +1,37 @@
package eu.kanade.tachiyomi.extension.all.nhentai
import eu.kanade.tachiyomi.lib.urlhandler.UrlHandlerActivity
import android.app.Activity
import android.content.ActivityNotFoundException
import android.content.Intent
import android.os.Bundle
import android.util.Log
/**
* Springboard that accepts https://nhentai.net/g/xxxxxx intents and redirects them to
* the main Tachiyomi process.
*/
class NHUrlActivity : UrlHandlerActivity() {
class NHUrlActivity : 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", "${NHentai.PREFIX_ID_SEARCH}$id")
putExtra("filter", packageName)
}
override fun getQueryFromPathSegments(pathSegments: List<String>): String {
val id = pathSegments[1]
return "${NHentai.PREFIX_ID_SEARCH}$id"
try {
startActivity(mainIntent)
} catch (e: ActivityNotFoundException) {
Log.e("NHUrlActivity", e.toString())
}
} else {
Log.e("NHUrlActivity", "could not parse uri from intent $intent")
}
finish()
System.exit(0)
}
}

View File

@ -5,12 +5,12 @@ ext {
appName = 'Tachiyomi: Mintmanga'
pkgNameSuffix = 'ru.mintmanga'
extClass = '.Mintmanga'
extVersionCode = 11
extVersionCode = 12
libVersion = '1.2'
}
dependencies {
implementation project(':extension-lib')
implementation project(':lib-ratelimit')
}
apply from: "$rootDir/common.gradle"

View File

@ -5,12 +5,12 @@ ext {
appName = 'Tachiyomi: Readmanga'
pkgNameSuffix = 'ru.readmanga'
extClass = '.Readmanga'
extVersionCode = 11
extVersionCode = 12
libVersion = '1.2'
}
dependencies {
implementation project(':extension-lib')
implementation project(':lib-ratelimit')
}
apply from: "$rootDir/common.gradle"