mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-04 03:14:40 -05:00
Update dependency com.pinterest.ktlint:ktlint-cli to v1.8.0 (#1786)
* Update dependency com.pinterest.ktlint:ktlint-cli to v1.8.0 * Format --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Syer10 <syer10@users.noreply.github.com>
This commit is contained in:
@@ -135,9 +135,11 @@ class SourceMutation {
|
||||
filters = updateFilterList(source, filters),
|
||||
)
|
||||
}
|
||||
|
||||
FetchSourceMangaType.POPULAR -> {
|
||||
source.getPopularManga(page)
|
||||
}
|
||||
|
||||
FetchSourceMangaType.LATEST -> {
|
||||
if (!source.supportsLatest) throw Exception("Source does not support latest")
|
||||
source.getLatestUpdates(page)
|
||||
|
||||
@@ -61,8 +61,14 @@ class TrackQuery {
|
||||
cursor: Cursor,
|
||||
): Boolean =
|
||||
when (this) {
|
||||
ID -> tracker.id > cursor.value.toInt()
|
||||
NAME -> tracker.name > cursor.value
|
||||
ID -> {
|
||||
tracker.id > cursor.value.toInt()
|
||||
}
|
||||
|
||||
NAME -> {
|
||||
tracker.name > cursor.value
|
||||
}
|
||||
|
||||
IS_LOGGED_IN -> {
|
||||
val value = cursor.value.substringAfter('-').toBooleanStrict()
|
||||
!value || tracker.isLoggedIn
|
||||
@@ -74,8 +80,14 @@ class TrackQuery {
|
||||
cursor: Cursor,
|
||||
): Boolean =
|
||||
when (this) {
|
||||
ID -> tracker.id < cursor.value.toInt()
|
||||
NAME -> tracker.name < cursor.value
|
||||
ID -> {
|
||||
tracker.id < cursor.value.toInt()
|
||||
}
|
||||
|
||||
NAME -> {
|
||||
tracker.name < cursor.value
|
||||
}
|
||||
|
||||
IS_LOGGED_IN -> {
|
||||
val value = cursor.value.substringAfter('-').toBooleanStrict()
|
||||
value || !tracker.isLoggedIn
|
||||
@@ -159,18 +171,21 @@ class TrackQuery {
|
||||
|
||||
res =
|
||||
when (orderType) {
|
||||
SortOrder.DESC, SortOrder.DESC_NULLS_FIRST, SortOrder.DESC_NULLS_LAST ->
|
||||
SortOrder.DESC, SortOrder.DESC_NULLS_FIRST, SortOrder.DESC_NULLS_LAST -> {
|
||||
when (orderBy) {
|
||||
TrackerOrderBy.ID -> res.sortedByDescending { it.id }
|
||||
TrackerOrderBy.NAME -> res.sortedByDescending { it.name }
|
||||
TrackerOrderBy.IS_LOGGED_IN -> res.sortedByDescending { it.isLoggedIn }
|
||||
}
|
||||
SortOrder.ASC, SortOrder.ASC_NULLS_FIRST, SortOrder.ASC_NULLS_LAST ->
|
||||
}
|
||||
|
||||
SortOrder.ASC, SortOrder.ASC_NULLS_FIRST, SortOrder.ASC_NULLS_LAST -> {
|
||||
when (orderBy) {
|
||||
TrackerOrderBy.ID -> res.sortedBy { it.id }
|
||||
TrackerOrderBy.NAME -> res.sortedBy { it.name }
|
||||
TrackerOrderBy.IS_LOGGED_IN -> res.sortedBy { it.isLoggedIn }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ class JavalinGraphQLRequestParser : GraphQLRequestParser<Context> {
|
||||
is GraphQLRequest -> {
|
||||
request.copy(variables = request.variables?.modifyFiles(mapItems))
|
||||
}
|
||||
|
||||
is GraphQLBatchRequest -> {
|
||||
request.copy(
|
||||
requests =
|
||||
|
||||
@@ -63,10 +63,16 @@ class CustomSchemaGeneratorHooks : FlowSubscriptionSchemaGeneratorHooks() {
|
||||
|
||||
override fun willGenerateGraphQLType(type: KType): GraphQLType? =
|
||||
when (type.classifier as? KClass<*>) {
|
||||
Long::class -> GraphQLLongAsString // encode to string for JS
|
||||
Duration::class -> GraphQLDurationAsString // encode Duration as ISO-8601 string
|
||||
// encode to string for JS
|
||||
Long::class -> GraphQLLongAsString
|
||||
|
||||
// encode Duration as ISO-8601 string
|
||||
Duration::class -> GraphQLDurationAsString
|
||||
|
||||
Cursor::class -> GraphQLCursor
|
||||
|
||||
UploadedFile::class -> GraphQLUpload
|
||||
|
||||
else -> super.willGenerateGraphQLType(type)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,9 @@ private class GraphqlDurationAsStringCoercing : Coercing<Duration, String> {
|
||||
private fun toStringImpl(input: Any): String =
|
||||
when (input) {
|
||||
is Duration -> input.toIsoString()
|
||||
|
||||
is String -> Duration.parse(input).toIsoString()
|
||||
|
||||
else -> throw CoercingSerializeException(
|
||||
"Expected a Duration or String but was ${CoercingUtil.typeName(input)}",
|
||||
)
|
||||
|
||||
@@ -31,46 +31,59 @@ data class BackupRestoreStatus(
|
||||
|
||||
fun ProtoBackupImport.BackupRestoreState.toStatus(): BackupRestoreStatus =
|
||||
when (this) {
|
||||
ProtoBackupImport.BackupRestoreState.Idle ->
|
||||
ProtoBackupImport.BackupRestoreState.Idle -> {
|
||||
BackupRestoreStatus(
|
||||
state = BackupRestoreState.IDLE,
|
||||
totalManga = 0,
|
||||
mangaProgress = 0,
|
||||
)
|
||||
is ProtoBackupImport.BackupRestoreState.Success ->
|
||||
}
|
||||
|
||||
is ProtoBackupImport.BackupRestoreState.Success -> {
|
||||
BackupRestoreStatus(
|
||||
state = BackupRestoreState.SUCCESS,
|
||||
totalManga = 0,
|
||||
mangaProgress = 0,
|
||||
)
|
||||
is ProtoBackupImport.BackupRestoreState.Failure ->
|
||||
}
|
||||
|
||||
is ProtoBackupImport.BackupRestoreState.Failure -> {
|
||||
BackupRestoreStatus(
|
||||
state = BackupRestoreState.FAILURE,
|
||||
totalManga = 0,
|
||||
mangaProgress = 0,
|
||||
)
|
||||
is ProtoBackupImport.BackupRestoreState.RestoringCategories ->
|
||||
}
|
||||
|
||||
is ProtoBackupImport.BackupRestoreState.RestoringCategories -> {
|
||||
BackupRestoreStatus(
|
||||
state = BackupRestoreState.RESTORING_CATEGORIES,
|
||||
totalManga = totalManga,
|
||||
mangaProgress = current,
|
||||
)
|
||||
is ProtoBackupImport.BackupRestoreState.RestoringMeta ->
|
||||
}
|
||||
|
||||
is ProtoBackupImport.BackupRestoreState.RestoringMeta -> {
|
||||
BackupRestoreStatus(
|
||||
state = BackupRestoreState.RESTORING_META,
|
||||
totalManga = totalManga,
|
||||
mangaProgress = current,
|
||||
)
|
||||
is ProtoBackupImport.BackupRestoreState.RestoringSettings ->
|
||||
}
|
||||
|
||||
is ProtoBackupImport.BackupRestoreState.RestoringSettings -> {
|
||||
BackupRestoreStatus(
|
||||
state = BackupRestoreState.RESTORING_SETTINGS,
|
||||
totalManga = totalManga,
|
||||
mangaProgress = current,
|
||||
)
|
||||
is ProtoBackupImport.BackupRestoreState.RestoringManga ->
|
||||
}
|
||||
|
||||
is ProtoBackupImport.BackupRestoreState.RestoringManga -> {
|
||||
BackupRestoreStatus(
|
||||
state = BackupRestoreState.RESTORING_MANGA,
|
||||
totalManga = totalManga,
|
||||
mangaProgress = current,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,12 +204,27 @@ data class GroupFilter(
|
||||
|
||||
fun filterOf(filter: SourceFilter<*>): Filter =
|
||||
when (filter) {
|
||||
is SourceFilter.Header -> HeaderFilter(filter.name)
|
||||
is SourceFilter.Separator -> SeparatorFilter(filter.name)
|
||||
is SourceFilter.Select<*> -> SelectFilter(filter.name, filter.displayValues, filter.state)
|
||||
is SourceFilter.Text -> TextFilter(filter.name, filter.state)
|
||||
is SourceFilter.CheckBox -> CheckBoxFilter(filter.name, filter.state)
|
||||
is SourceFilter.TriState ->
|
||||
is SourceFilter.Header -> {
|
||||
HeaderFilter(filter.name)
|
||||
}
|
||||
|
||||
is SourceFilter.Separator -> {
|
||||
SeparatorFilter(filter.name)
|
||||
}
|
||||
|
||||
is SourceFilter.Select<*> -> {
|
||||
SelectFilter(filter.name, filter.displayValues, filter.state)
|
||||
}
|
||||
|
||||
is SourceFilter.Text -> {
|
||||
TextFilter(filter.name, filter.state)
|
||||
}
|
||||
|
||||
is SourceFilter.CheckBox -> {
|
||||
CheckBoxFilter(filter.name, filter.state)
|
||||
}
|
||||
|
||||
is SourceFilter.TriState -> {
|
||||
TriStateFilter(
|
||||
filter.name,
|
||||
when (filter.state) {
|
||||
@@ -218,13 +233,22 @@ fun filterOf(filter: SourceFilter<*>): Filter =
|
||||
else -> TriState.IGNORE
|
||||
},
|
||||
)
|
||||
is SourceFilter.Group<*> ->
|
||||
}
|
||||
|
||||
is SourceFilter.Group<*> -> {
|
||||
GroupFilter(
|
||||
filter.name,
|
||||
filter.state.map { filterOf(it as SourceFilter<*>) },
|
||||
)
|
||||
is SourceFilter.Sort -> SortFilter(filter.name, filter.values.asList(), filter.state?.let(SortFilter::SortSelection))
|
||||
else -> throw RuntimeException("sealed class cannot have more subtypes!")
|
||||
}
|
||||
|
||||
is SourceFilter.Sort -> {
|
||||
SortFilter(filter.name, filter.values.asList(), filter.state?.let(SortFilter::SortSelection))
|
||||
}
|
||||
|
||||
else -> {
|
||||
throw RuntimeException("sealed class cannot have more subtypes!")
|
||||
}
|
||||
}
|
||||
|
||||
/*sealed interface FilterChange {
|
||||
@@ -286,25 +310,31 @@ fun updateFilterList(
|
||||
is SourceFilter.Header -> {
|
||||
// NOOP
|
||||
}
|
||||
|
||||
is SourceFilter.Separator -> {
|
||||
// NOOP
|
||||
}
|
||||
|
||||
is SourceFilter.Select<*> -> {
|
||||
filter.state = change.selectState
|
||||
?: throw Exception("Expected select state change at position ${change.position}")
|
||||
}
|
||||
|
||||
is SourceFilter.Text -> {
|
||||
filter.state = change.textState
|
||||
?: throw Exception("Expected text state change at position ${change.position}")
|
||||
}
|
||||
|
||||
is SourceFilter.CheckBox -> {
|
||||
filter.state = change.checkBoxState
|
||||
?: throw Exception("Expected checkbox state change at position ${change.position}")
|
||||
}
|
||||
|
||||
is SourceFilter.TriState -> {
|
||||
filter.state = change.triState?.ordinal
|
||||
?: throw Exception("Expected tri state change at position ${change.position}")
|
||||
}
|
||||
|
||||
is SourceFilter.Group<*> -> {
|
||||
val groupChange =
|
||||
change.groupChange
|
||||
@@ -315,20 +345,24 @@ fun updateFilterList(
|
||||
groupFilter.state = groupChange.checkBoxState
|
||||
?: throw Exception("Expected checkbox state change at position ${change.position}")
|
||||
}
|
||||
|
||||
is SourceFilter.TriState -> {
|
||||
groupFilter.state = groupChange.triState?.ordinal
|
||||
?: throw Exception("Expected tri state change at position ${change.position}")
|
||||
}
|
||||
|
||||
is SourceFilter.Text -> {
|
||||
groupFilter.state = groupChange.textState
|
||||
?: throw Exception("Expected text state change at position ${change.position}")
|
||||
}
|
||||
|
||||
is SourceFilter.Select<*> -> {
|
||||
groupFilter.state = groupChange.selectState
|
||||
?: throw Exception("Expected select state change at position ${change.position}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
is SourceFilter.Sort -> {
|
||||
filter.state = change.sortState?.run {
|
||||
SourceFilter.Sort.Selection(index, ascending)
|
||||
@@ -402,7 +436,7 @@ data class MultiSelectListPreference(
|
||||
|
||||
fun preferenceOf(preference: SourcePreference): Preference =
|
||||
when (preference) {
|
||||
is SourceSwitchPreference ->
|
||||
is SourceSwitchPreference -> {
|
||||
SwitchPreference(
|
||||
preference.key,
|
||||
preference.title?.toString(),
|
||||
@@ -412,7 +446,9 @@ fun preferenceOf(preference: SourcePreference): Preference =
|
||||
preference.currentValue as Boolean,
|
||||
preference.defaultValue as Boolean,
|
||||
)
|
||||
is SourceCheckBoxPreference ->
|
||||
}
|
||||
|
||||
is SourceCheckBoxPreference -> {
|
||||
CheckBoxPreference(
|
||||
preference.key,
|
||||
preference.title?.toString(),
|
||||
@@ -422,7 +458,9 @@ fun preferenceOf(preference: SourcePreference): Preference =
|
||||
preference.currentValue as Boolean,
|
||||
preference.defaultValue as Boolean,
|
||||
)
|
||||
is SourceEditTextPreference ->
|
||||
}
|
||||
|
||||
is SourceEditTextPreference -> {
|
||||
EditTextPreference(
|
||||
preference.key,
|
||||
preference.title?.toString(),
|
||||
@@ -435,7 +473,9 @@ fun preferenceOf(preference: SourcePreference): Preference =
|
||||
preference.dialogMessage?.toString(),
|
||||
preference.text,
|
||||
)
|
||||
is SourceListPreference ->
|
||||
}
|
||||
|
||||
is SourceListPreference -> {
|
||||
ListPreference(
|
||||
preference.key,
|
||||
preference.title?.toString(),
|
||||
@@ -447,7 +487,9 @@ fun preferenceOf(preference: SourcePreference): Preference =
|
||||
preference.entries.map { it.toString() },
|
||||
preference.entryValues.map { it.toString() },
|
||||
)
|
||||
is SourceMultiSelectListPreference ->
|
||||
}
|
||||
|
||||
is SourceMultiSelectListPreference -> {
|
||||
MultiSelectListPreference(
|
||||
preference.key,
|
||||
preference.title?.toString(),
|
||||
@@ -461,5 +503,9 @@ fun preferenceOf(preference: SourcePreference): Preference =
|
||||
preference.entries.map { it.toString() },
|
||||
preference.entryValues.map { it.toString() },
|
||||
)
|
||||
else -> throw RuntimeException("sealed class cannot have more subtypes!")
|
||||
}
|
||||
|
||||
else -> {
|
||||
throw RuntimeException("sealed class cannot have more subtypes!")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user