nedius 270e70125c
Rewrite LibGroup to use new api (#3219)
* Rewrote LibGroup to use api instead of parsing document

* apply suggestions

* quick fixes

* change preferences variable to functions

* Make getToken sync

* safe & load token

* return new token when refreshing
2024-07-14 14:39:15 +01:00

42 lines
1.3 KiB
Kotlin

package eu.kanade.tachiyomi.multisrc.libgroup
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://xxxxlib.me/xxx intents and redirects them to
* the main tachiyomi process. The idea is to not install the intent filter unless
* you have this extension installed, but still let the main tachiyomi app control
* things.
*/
class LibUrlActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val pathSegments = intent?.data?.pathSegments
if (pathSegments != null && pathSegments.size > 0) {
val titleid = pathSegments[2]
val mainIntent = Intent().apply {
action = "eu.kanade.tachiyomi.SEARCH"
putExtra("query", "${LibGroup.PREFIX_SLUG_SEARCH}$titleid")
putExtra("filter", packageName)
}
try {
startActivity(mainIntent)
} catch (e: ActivityNotFoundException) {
Log.e("LibUrlActivity", e.toString())
}
} else {
Log.e("LibUrlActivity", "could not parse uri from intent $intent")
}
finish()
exitProcess(0)
}
}