Minor cleanup to ResolvableSource
This commit is contained in:
parent
fcba2306e9
commit
7326598475
1 changed files with 10 additions and 8 deletions
|
@ -5,29 +5,31 @@ import eu.kanade.tachiyomi.source.model.SChapter
|
|||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
|
||||
/**
|
||||
* A source that may handle opening an SManga for a given URI.
|
||||
* A source that may handle opening an SManga or SChapter for a given URI.
|
||||
*
|
||||
* @since extensions-lib 1.5
|
||||
*/
|
||||
interface ResolvableSource : Source {
|
||||
|
||||
/**
|
||||
* Returns the UriType of the uri input.
|
||||
* Returns Unknown if unable to resolve the URI
|
||||
* Returns what the given URI may open.
|
||||
* Returns [UriType.Unknown] if the source is not able to resolve the URI.
|
||||
*
|
||||
* @since extensions-lib 1.5
|
||||
*/
|
||||
fun getUriType(uri: String): UriType
|
||||
|
||||
/**
|
||||
* Called if canHandleUri is true. Returns the corresponding SManga, if possible.
|
||||
* Called if [getUriType] is [UriType.Manga].
|
||||
* Returns the corresponding SManga, if possible.
|
||||
*
|
||||
* @since extensions-lib 1.5
|
||||
*/
|
||||
suspend fun getManga(uri: String): SManga?
|
||||
|
||||
/**
|
||||
* Called if canHandleUri is true. Returns the corresponding SChapter, if possible.
|
||||
* Called if [getUriType] is [UriType.Chapter].
|
||||
* Returns the corresponding SChapter, if possible.
|
||||
*
|
||||
* @since extensions-lib 1.5
|
||||
*/
|
||||
|
@ -35,7 +37,7 @@ interface ResolvableSource : Source {
|
|||
}
|
||||
|
||||
sealed interface UriType {
|
||||
object Manga : UriType
|
||||
object Chapter : UriType
|
||||
object Unknown : UriType
|
||||
data object Manga : UriType
|
||||
data object Chapter : UriType
|
||||
data object Unknown : UriType
|
||||
}
|
||||
|
|
Reference in a new issue