mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-04 11:24:35 -05:00
Implement Non-Final 1.5 Extensions API (#699)
* Implement non-final 1.5 extensions API * Bump lib version max * Add visibility to preferences * Add preference visibility
This commit is contained in:
@@ -14,7 +14,6 @@ import suwayomi.tachidesk.graphql.types.preferenceOf
|
||||
import suwayomi.tachidesk.graphql.types.updateFilterList
|
||||
import suwayomi.tachidesk.manga.impl.MangaList.insertOrGet
|
||||
import suwayomi.tachidesk.manga.impl.Source
|
||||
import suwayomi.tachidesk.manga.impl.util.lang.awaitSingle
|
||||
import suwayomi.tachidesk.manga.impl.util.source.GetCatalogueSource
|
||||
import suwayomi.tachidesk.manga.model.table.MangaTable
|
||||
import suwayomi.tachidesk.server.JavalinSetup.future
|
||||
@@ -50,18 +49,18 @@ class SourceMutation {
|
||||
val source = GetCatalogueSource.getCatalogueSourceOrNull(sourceId)!!
|
||||
val mangasPage = when (type) {
|
||||
FetchSourceMangaType.SEARCH -> {
|
||||
source.fetchSearchManga(
|
||||
source.getSearchManga(
|
||||
page = page,
|
||||
query = query.orEmpty(),
|
||||
filters = updateFilterList(source, filters)
|
||||
).awaitSingle()
|
||||
)
|
||||
}
|
||||
FetchSourceMangaType.POPULAR -> {
|
||||
source.fetchPopularManga(page).awaitSingle()
|
||||
source.getPopularManga(page)
|
||||
}
|
||||
FetchSourceMangaType.LATEST -> {
|
||||
if (!source.supportsLatest) throw Exception("Source does not support latest")
|
||||
source.fetchLatestUpdates(page).awaitSingle()
|
||||
source.getLatestUpdates(page)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -299,6 +299,7 @@ data class SwitchPreference(
|
||||
val key: String,
|
||||
val title: String,
|
||||
val summary: String?,
|
||||
val visible: Boolean,
|
||||
val currentValue: Boolean?,
|
||||
val default: Boolean
|
||||
) : Preference
|
||||
@@ -307,6 +308,7 @@ data class CheckBoxPreference(
|
||||
val key: String,
|
||||
val title: String,
|
||||
val summary: String?,
|
||||
val visible: Boolean,
|
||||
val currentValue: Boolean?,
|
||||
val default: Boolean
|
||||
) : Preference
|
||||
@@ -315,6 +317,7 @@ data class EditTextPreference(
|
||||
val key: String,
|
||||
val title: String?,
|
||||
val summary: String?,
|
||||
val visible: Boolean,
|
||||
val currentValue: String?,
|
||||
val default: String?,
|
||||
val dialogTitle: String?,
|
||||
@@ -326,6 +329,7 @@ data class ListPreference(
|
||||
val key: String,
|
||||
val title: String?,
|
||||
val summary: String?,
|
||||
val visible: Boolean,
|
||||
val currentValue: String?,
|
||||
val default: String?,
|
||||
val entries: List<String>,
|
||||
@@ -336,6 +340,7 @@ data class MultiSelectListPreference(
|
||||
val key: String,
|
||||
val title: String?,
|
||||
val summary: String?,
|
||||
val visible: Boolean,
|
||||
val currentValue: List<String>?,
|
||||
val default: List<String>?,
|
||||
val dialogTitle: String?,
|
||||
@@ -350,13 +355,15 @@ fun preferenceOf(preference: SourcePreference): Preference {
|
||||
preference.key,
|
||||
preference.title.toString(),
|
||||
preference.summary?.toString(),
|
||||
preference.visible,
|
||||
preference.currentValue as Boolean,
|
||||
preference.defaultValue as Boolean
|
||||
preference.defaultValue as Boolean,
|
||||
)
|
||||
is SourceCheckBoxPreference -> CheckBoxPreference(
|
||||
preference.key,
|
||||
preference.title.toString(),
|
||||
preference.summary?.toString(),
|
||||
preference.visible,
|
||||
preference.currentValue as Boolean,
|
||||
preference.defaultValue as Boolean
|
||||
)
|
||||
@@ -364,6 +371,7 @@ fun preferenceOf(preference: SourcePreference): Preference {
|
||||
preference.key,
|
||||
preference.title?.toString(),
|
||||
preference.summary?.toString(),
|
||||
preference.visible,
|
||||
(preference.currentValue as CharSequence?)?.toString(),
|
||||
(preference.defaultValue as CharSequence?)?.toString(),
|
||||
preference.dialogTitle?.toString(),
|
||||
@@ -374,6 +382,7 @@ fun preferenceOf(preference: SourcePreference): Preference {
|
||||
preference.key,
|
||||
preference.title?.toString(),
|
||||
preference.summary?.toString(),
|
||||
preference.visible,
|
||||
(preference.currentValue as CharSequence?)?.toString(),
|
||||
(preference.defaultValue as CharSequence?)?.toString(),
|
||||
preference.entries.map { it.toString() },
|
||||
@@ -383,6 +392,7 @@ fun preferenceOf(preference: SourcePreference): Preference {
|
||||
preference.key,
|
||||
preference.title?.toString(),
|
||||
preference.summary?.toString(),
|
||||
preference.visible,
|
||||
(preference.currentValue as Collection<*>?)?.map { it.toString() },
|
||||
(preference.defaultValue as Collection<*>?)?.map { it.toString() },
|
||||
preference.dialogTitle?.toString(),
|
||||
|
||||
Reference in New Issue
Block a user