Update linter

(cherry picked from commit ae7df4fb7fa4fc996ba26a9f6dbbb6b5277a939b)

# Conflicts:
#	app/src/main/java/eu/kanade/domain/manga/model/Manga.kt
#	app/src/main/java/eu/kanade/domain/source/model/Source.kt
#	app/src/main/java/eu/kanade/presentation/source/MigrateSourceScreen.kt
#	app/src/main/java/eu/kanade/presentation/source/SourceFilterScreen.kt
#	app/src/main/java/eu/kanade/presentation/source/SourceScreen.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceFilterPresenter.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcePresenter.kt
This commit is contained in:
arkon 2022-05-10 17:54:52 -04:00 committed by Jobobby04
parent c1c934011f
commit 24c5563a02
64 changed files with 157 additions and 154 deletions

View File

@ -19,7 +19,7 @@ class AndroidDatabaseHandler(
val db: Database, val db: Database,
private val driver: SqlDriver, private val driver: SqlDriver,
val queryDispatcher: CoroutineDispatcher = Dispatchers.IO, val queryDispatcher: CoroutineDispatcher = Dispatchers.IO,
val transactionDispatcher: CoroutineDispatcher = queryDispatcher val transactionDispatcher: CoroutineDispatcher = queryDispatcher,
) : DatabaseHandler { ) : DatabaseHandler {
val suspendingTransactionId = ThreadLocal<Int>() val suspendingTransactionId = ThreadLocal<Int>()
@ -30,21 +30,21 @@ class AndroidDatabaseHandler(
override suspend fun <T : Any> awaitList( override suspend fun <T : Any> awaitList(
inTransaction: Boolean, inTransaction: Boolean,
block: suspend Database.() -> Query<T> block: suspend Database.() -> Query<T>,
): List<T> { ): List<T> {
return dispatch(inTransaction) { block(db).executeAsList() } return dispatch(inTransaction) { block(db).executeAsList() }
} }
override suspend fun <T : Any> awaitOne( override suspend fun <T : Any> awaitOne(
inTransaction: Boolean, inTransaction: Boolean,
block: suspend Database.() -> Query<T> block: suspend Database.() -> Query<T>,
): T { ): T {
return dispatch(inTransaction) { block(db).executeAsOne() } return dispatch(inTransaction) { block(db).executeAsOne() }
} }
override suspend fun <T : Any> awaitOneOrNull( override suspend fun <T : Any> awaitOneOrNull(
inTransaction: Boolean, inTransaction: Boolean,
block: suspend Database.() -> Query<T> block: suspend Database.() -> Query<T>,
): T? { ): T? {
return dispatch(inTransaction) { block(db).executeAsOneOrNull() } return dispatch(inTransaction) { block(db).executeAsOneOrNull() }
} }
@ -64,7 +64,7 @@ class AndroidDatabaseHandler(
override fun <T : Any> subscribeToPagingSource( override fun <T : Any> subscribeToPagingSource(
countQuery: Database.() -> Query<Long>, countQuery: Database.() -> Query<Long>,
transacter: Database.() -> Transacter, transacter: Database.() -> Transacter,
queryProvider: Database.(Long, Long) -> Query<T> queryProvider: Database.(Long, Long) -> Query<T>,
): PagingSource<Long, T> { ): PagingSource<Long, T> {
return QueryPagingSource( return QueryPagingSource(
countQuery = countQuery(db), countQuery = countQuery(db),
@ -72,7 +72,7 @@ class AndroidDatabaseHandler(
dispatcher = queryDispatcher, dispatcher = queryDispatcher,
queryProvider = { limit, offset -> queryProvider = { limit, offset ->
queryProvider.invoke(db, limit, offset) queryProvider.invoke(db, limit, offset)
} },
) )
} }

View File

@ -12,17 +12,17 @@ interface DatabaseHandler {
suspend fun <T : Any> awaitList( suspend fun <T : Any> awaitList(
inTransaction: Boolean = false, inTransaction: Boolean = false,
block: suspend Database.() -> Query<T> block: suspend Database.() -> Query<T>,
): List<T> ): List<T>
suspend fun <T : Any> awaitOne( suspend fun <T : Any> awaitOne(
inTransaction: Boolean = false, inTransaction: Boolean = false,
block: suspend Database.() -> Query<T> block: suspend Database.() -> Query<T>,
): T ): T
suspend fun <T : Any> awaitOneOrNull( suspend fun <T : Any> awaitOneOrNull(
inTransaction: Boolean = false, inTransaction: Boolean = false,
block: suspend Database.() -> Query<T> block: suspend Database.() -> Query<T>,
): T? ): T?
fun <T : Any> subscribeToList(block: Database.() -> Query<T>): Flow<List<T>> fun <T : Any> subscribeToList(block: Database.() -> Query<T>): Flow<List<T>>
@ -34,6 +34,6 @@ interface DatabaseHandler {
fun <T : Any> subscribeToPagingSource( fun <T : Any> subscribeToPagingSource(
countQuery: Database.() -> Query<Long>, countQuery: Database.() -> Query<Long>,
transacter: Database.() -> Transacter, transacter: Database.() -> Transacter,
queryProvider: Database.(Long, Long) -> Query<T> queryProvider: Database.(Long, Long) -> Query<T>,
): PagingSource<Long, T> ): PagingSource<Long, T>
} }

View File

@ -95,7 +95,7 @@ private suspend fun AndroidDatabaseHandler.createTransactionContext(): Coroutine
* thread by cancelling the job. * thread by cancelling the job.
*/ */
private suspend fun CoroutineDispatcher.acquireTransactionThread( private suspend fun CoroutineDispatcher.acquireTransactionThread(
controlJob: Job controlJob: Job,
): ContinuationInterceptor { ): ContinuationInterceptor {
return suspendCancellableCoroutine { continuation -> return suspendCancellableCoroutine { continuation ->
continuation.invokeOnCancellation { continuation.invokeOnCancellation {
@ -116,8 +116,8 @@ private suspend fun CoroutineDispatcher.acquireTransactionThread(
// Couldn't acquire a thread, cancel coroutine. // Couldn't acquire a thread, cancel coroutine.
continuation.cancel( continuation.cancel(
IllegalStateException( IllegalStateException(
"Unable to acquire a thread to perform the database transaction.", ex "Unable to acquire a thread to perform the database transaction.", ex,
) ),
) )
} }
} }
@ -128,7 +128,7 @@ private suspend fun CoroutineDispatcher.acquireTransactionThread(
*/ */
private class TransactionElement( private class TransactionElement(
private val transactionThreadControlJob: Job, private val transactionThreadControlJob: Job,
val transactionDispatcher: ContinuationInterceptor val transactionDispatcher: ContinuationInterceptor,
) : CoroutineContext.Element { ) : CoroutineContext.Element {
companion object Key : CoroutineContext.Key<TransactionElement> companion object Key : CoroutineContext.Key<TransactionElement>

View File

@ -8,6 +8,6 @@ val feedSavedSearchMapper: (Long, Long, Long?, Boolean) -> FeedSavedSearch =
id = id, id = id,
source = source, source = source,
savedSearch = savedSearch, savedSearch = savedSearch,
global = global global = global,
) )
} }

View File

@ -9,6 +9,6 @@ val savedSearchMapper: (Long, Long, String, String?, String?) -> SavedSearch =
source = source, source = source,
name = name, name = name,
query = query, query = query,
filtersJson = filtersJson filtersJson = filtersJson,
) )
} }

View File

@ -13,7 +13,7 @@ val historyMapper: (Long, Long, Date?, Date?) -> History = { id, chapterId, read
} }
val historyWithRelationsMapper: (Long, Long, Long, String, String?, Float, Date?) -> HistoryWithRelations = { val historyWithRelationsMapper: (Long, Long, Long, String, String?, Float, Date?) -> HistoryWithRelations = {
historyId, mangaId, chapterId, title, thumbnailUrl, chapterNumber, readAt -> historyId, mangaId, chapterId, title, thumbnailUrl, chapterNumber, readAt ->
HistoryWithRelations( HistoryWithRelations(
id = historyId, id = historyId,
chapterId = chapterId, chapterId = chapterId,
@ -21,6 +21,6 @@ val historyWithRelationsMapper: (Long, Long, Long, String, String?, Float, Date?
title = title, title = title,
thumbnailUrl = thumbnailUrl ?: "", thumbnailUrl = thumbnailUrl ?: "",
chapterNumber = chapterNumber, chapterNumber = chapterNumber,
readAt = readAt readAt = readAt,
) )
} }

View File

@ -11,7 +11,7 @@ import eu.kanade.domain.manga.model.Manga
import eu.kanade.tachiyomi.util.system.logcat import eu.kanade.tachiyomi.util.system.logcat
class HistoryRepositoryImpl( class HistoryRepositoryImpl(
private val handler: DatabaseHandler private val handler: DatabaseHandler,
) : HistoryRepository { ) : HistoryRepository {
override fun getHistory(query: String): PagingSource<Long, HistoryWithRelations> { override fun getHistory(query: String): PagingSource<Long, HistoryWithRelations> {
@ -20,7 +20,7 @@ class HistoryRepositoryImpl(
transacter = { historyViewQueries }, transacter = { historyViewQueries },
queryProvider = { limit, offset -> queryProvider = { limit, offset ->
historyViewQueries.history(query, limit, offset, historyWithRelationsMapper) historyViewQueries.history(query, limit, offset, historyWithRelationsMapper)
} },
) )
} }

View File

@ -22,6 +22,6 @@ val mangaMapper: (Long, Long, String, String?, String?, String?, List<String>?,
status = status, status = status,
thumbnailUrl = thumbnailUrl, thumbnailUrl = thumbnailUrl,
initialized = initialized, initialized = initialized,
filteredScanlators = filteredScanlators filteredScanlators = filteredScanlators,
) )
} }

View File

@ -6,7 +6,7 @@ import eu.kanade.domain.manga.repository.MangaRepository
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
class MangaRepositoryImpl( class MangaRepositoryImpl(
private val databaseHandler: DatabaseHandler private val databaseHandler: DatabaseHandler,
) : MangaRepository { ) : MangaRepository {
override fun getFavoritesBySourceId(sourceId: Long): Flow<List<Manga>> { override fun getFavoritesBySourceId(sourceId: Long): Flow<List<Manga>> {

View File

@ -8,7 +8,7 @@ val sourceMapper: (eu.kanade.tachiyomi.source.Source) -> Source = { source ->
source.id, source.id,
source.lang, source.lang,
source.name, source.name,
false false,
) )
} }

View File

@ -11,7 +11,7 @@ import kotlinx.coroutines.flow.map
class SourceRepositoryImpl( class SourceRepositoryImpl(
private val sourceManager: SourceManager, private val sourceManager: SourceManager,
private val handler: DatabaseHandler private val handler: DatabaseHandler,
) : SourceRepository { ) : SourceRepository {
override fun getSources(): Flow<List<Source>> { override fun getSources(): Flow<List<Source>> {

View File

@ -12,5 +12,5 @@ data class Chapter(
val name: String, val name: String,
val dateUpload: Long, val dateUpload: Long,
val chapterNumber: Float, val chapterNumber: Float,
val scanlator: String? val scanlator: String?,
) )

View File

@ -3,7 +3,7 @@ package eu.kanade.domain.history.interactor
import eu.kanade.domain.history.repository.HistoryRepository import eu.kanade.domain.history.repository.HistoryRepository
class DeleteHistoryTable( class DeleteHistoryTable(
private val repository: HistoryRepository private val repository: HistoryRepository,
) { ) {
suspend fun await(): Boolean { suspend fun await(): Boolean {

View File

@ -8,12 +8,12 @@ import eu.kanade.domain.history.repository.HistoryRepository
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
class GetHistory( class GetHistory(
private val repository: HistoryRepository private val repository: HistoryRepository,
) { ) {
fun subscribe(query: String): Flow<PagingData<HistoryWithRelations>> { fun subscribe(query: String): Flow<PagingData<HistoryWithRelations>> {
return Pager( return Pager(
PagingConfig(pageSize = 25) PagingConfig(pageSize = 25),
) { ) {
repository.getHistory(query) repository.getHistory(query)
}.flow }.flow

View File

@ -4,7 +4,7 @@ import eu.kanade.domain.chapter.model.Chapter
import eu.kanade.domain.history.repository.HistoryRepository import eu.kanade.domain.history.repository.HistoryRepository
class GetNextChapterForManga( class GetNextChapterForManga(
private val repository: HistoryRepository private val repository: HistoryRepository,
) { ) {
suspend fun await(mangaId: Long, chapterId: Long): Chapter? { suspend fun await(mangaId: Long, chapterId: Long): Chapter? {

View File

@ -4,7 +4,7 @@ import eu.kanade.domain.history.model.HistoryWithRelations
import eu.kanade.domain.history.repository.HistoryRepository import eu.kanade.domain.history.repository.HistoryRepository
class RemoveHistoryById( class RemoveHistoryById(
private val repository: HistoryRepository private val repository: HistoryRepository,
) { ) {
suspend fun await(history: HistoryWithRelations) { suspend fun await(history: HistoryWithRelations) {

View File

@ -3,7 +3,7 @@ package eu.kanade.domain.history.interactor
import eu.kanade.domain.history.repository.HistoryRepository import eu.kanade.domain.history.repository.HistoryRepository
class RemoveHistoryByMangaId( class RemoveHistoryByMangaId(
private val repository: HistoryRepository private val repository: HistoryRepository,
) { ) {
suspend fun await(mangaId: Long) { suspend fun await(mangaId: Long) {

View File

@ -5,5 +5,5 @@ import java.util.Date
data class History( data class History(
val id: Long?, val id: Long?,
val chapterId: Long, val chapterId: Long,
val readAt: Date? val readAt: Date?,
) )

View File

@ -9,5 +9,5 @@ data class HistoryWithRelations(
val title: String, val title: String,
val thumbnailUrl: String, val thumbnailUrl: String,
val chapterNumber: Float, val chapterNumber: Float,
val readAt: Date? val readAt: Date?,
) )

View File

@ -5,7 +5,7 @@ import eu.kanade.domain.manga.repository.MangaRepository
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
class GetFavoritesBySourceId( class GetFavoritesBySourceId(
private val mangaRepository: MangaRepository private val mangaRepository: MangaRepository,
) { ) {
fun subscribe(sourceId: Long): Flow<List<Manga>> { fun subscribe(sourceId: Long): Flow<List<Manga>> {

View File

@ -52,7 +52,7 @@ class GetEnabledSources(
val source = it.copy( val source = it.copy(
pin = flag, pin = flag,
isExcludedFromDataSaver = it.id.toString() in excludedFromDataSaver, isExcludedFromDataSaver = it.id.toString() in excludedFromDataSaver,
categories = categories categories = categories,
) )
val toFlatten = mutableListOf(source) val toFlatten = mutableListOf(source)
if (source.id == lastUsedSource) { if (source.id == lastUsedSource) {

View File

@ -17,19 +17,19 @@ class GetLanguagesWithSources(
return combine( return combine(
preferences.enabledLanguages().asFlow(), preferences.enabledLanguages().asFlow(),
preferences.disabledSources().asFlow(), preferences.disabledSources().asFlow(),
repository.getOnlineSources() repository.getOnlineSources(),
) { enabledLanguage, disabledSource, onlineSources -> ) { enabledLanguage, disabledSource, onlineSources ->
val sortedSources = onlineSources.filterNot { it.id in BlacklistedSources.HIDDEN_SOURCES }.sortedWith( val sortedSources = onlineSources.filterNot { it.id in BlacklistedSources.HIDDEN_SOURCES }.sortedWith(
compareBy<Source> { it.id.toString() in disabledSource } compareBy<Source> { it.id.toString() in disabledSource }
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name } .thenBy(String.CASE_INSENSITIVE_ORDER) { it.name },
) )
sortedSources.groupBy { it.lang } sortedSources.groupBy { it.lang }
.toSortedMap( .toSortedMap(
compareBy( compareBy(
{ it !in enabledLanguage }, { it !in enabledLanguage },
{ LocaleHelper.getDisplayName(it) } { LocaleHelper.getDisplayName(it) },
) ),
) )
} }
} }

View File

@ -6,7 +6,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
class GetShowLatest( class GetShowLatest(
private val preferences: PreferencesHelper private val preferences: PreferencesHelper,
) { ) {
fun subscribe(mode: SourceController.Mode): Flow<Boolean> { fun subscribe(mode: SourceController.Mode): Flow<Boolean> {

View File

@ -4,7 +4,7 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
class GetSourceCategories( class GetSourceCategories(
private val preferences: PreferencesHelper private val preferences: PreferencesHelper,
) { ) {
fun subscribe(): Flow<Set<String>> { fun subscribe(): Flow<Set<String>> {

View File

@ -11,14 +11,14 @@ import java.util.Locale
class GetSourcesWithFavoriteCount( class GetSourcesWithFavoriteCount(
private val repository: SourceRepository, private val repository: SourceRepository,
private val preferences: PreferencesHelper private val preferences: PreferencesHelper,
) { ) {
fun subscribe(): Flow<List<Pair<Source, Long>>> { fun subscribe(): Flow<List<Pair<Source, Long>>> {
return combine( return combine(
preferences.migrationSortingDirection().asFlow(), preferences.migrationSortingDirection().asFlow(),
preferences.migrationSortingMode().asFlow(), preferences.migrationSortingMode().asFlow(),
repository.getSourcesWithFavoriteCount() repository.getSourcesWithFavoriteCount(),
) { direction, mode, list -> ) { direction, mode, list ->
list.sortedWith(sortFn(direction, mode)) list.sortedWith(sortFn(direction, mode))
} }
@ -26,7 +26,7 @@ class GetSourcesWithFavoriteCount(
private fun sortFn( private fun sortFn(
direction: SetMigrateSorting.Direction, direction: SetMigrateSorting.Direction,
sorting: SetMigrateSorting.Mode sorting: SetMigrateSorting.Mode,
): java.util.Comparator<Pair<Source, Long>> { ): java.util.Comparator<Pair<Source, Long>> {
val locale = Locale.getDefault() val locale = Locale.getDefault()
val collator = Collator.getInstance(locale).apply { val collator = Collator.getInstance(locale).apply {

View File

@ -3,7 +3,7 @@ package eu.kanade.domain.source.interactor
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
class SetMigrateSorting( class SetMigrateSorting(
private val preferences: PreferencesHelper private val preferences: PreferencesHelper,
) { ) {
fun await(mode: Mode, isAscending: Boolean) { fun await(mode: Mode, isAscending: Boolean) {

View File

@ -6,7 +6,7 @@ import eu.kanade.tachiyomi.util.preference.minusAssign
import eu.kanade.tachiyomi.util.preference.plusAssign import eu.kanade.tachiyomi.util.preference.plusAssign
class SetSourceCategories( class SetSourceCategories(
private val preferences: PreferencesHelper private val preferences: PreferencesHelper,
) { ) {
fun await(source: Source, sourceCategories: List<String>) { fun await(source: Source, sourceCategories: List<String>) {

View File

@ -6,7 +6,7 @@ import eu.kanade.tachiyomi.util.preference.minusAssign
import eu.kanade.tachiyomi.util.preference.plusAssign import eu.kanade.tachiyomi.util.preference.plusAssign
class ToggleExcludeFromDataSaver( class ToggleExcludeFromDataSaver(
private val preferences: PreferencesHelper private val preferences: PreferencesHelper,
) { ) {
fun await(source: Source) { fun await(source: Source) {

View File

@ -5,7 +5,7 @@ import eu.kanade.tachiyomi.util.preference.minusAssign
import eu.kanade.tachiyomi.util.preference.plusAssign import eu.kanade.tachiyomi.util.preference.plusAssign
class ToggleLanguage( class ToggleLanguage(
val preferences: PreferencesHelper val preferences: PreferencesHelper,
) { ) {
fun await(language: String) { fun await(language: String) {

View File

@ -6,7 +6,7 @@ import eu.kanade.tachiyomi.util.preference.minusAssign
import eu.kanade.tachiyomi.util.preference.plusAssign import eu.kanade.tachiyomi.util.preference.plusAssign
class ToggleSource( class ToggleSource(
private val preferences: PreferencesHelper private val preferences: PreferencesHelper,
) { ) {
fun await(source: Source) { fun await(source: Source) {

View File

@ -6,7 +6,7 @@ import eu.kanade.tachiyomi.util.preference.minusAssign
import eu.kanade.tachiyomi.util.preference.plusAssign import eu.kanade.tachiyomi.util.preference.plusAssign
class ToggleSourcePin( class ToggleSourcePin(
private val preferences: PreferencesHelper private val preferences: PreferencesHelper,
) { ) {
fun await(source: Source) { fun await(source: Source) {

View File

@ -6,7 +6,7 @@ import eu.kanade.tachiyomi.util.preference.minusAssign
import eu.kanade.tachiyomi.util.preference.plusAssign import eu.kanade.tachiyomi.util.preference.plusAssign
class ToggleSources( class ToggleSources(
private val preferences: PreferencesHelper private val preferences: PreferencesHelper,
) { ) {
fun await(isEnable: Boolean, sources: List<Source>) { fun await(isEnable: Boolean, sources: List<Source>) {

View File

@ -29,7 +29,7 @@ fun EmptyScreen(
) { ) {
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize(),
) { ) {
AndroidView( AndroidView(
factory = { context -> factory = { context ->

View File

@ -23,7 +23,7 @@ enum class MangaCover(private val ratio: Float) {
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
data: String?, data: String?,
contentDescription: String? = null, contentDescription: String? = null,
shape: Shape? = null shape: Shape? = null,
) { ) {
AsyncImage( AsyncImage(
model = data, model = data,

View File

@ -42,7 +42,7 @@ fun PreferenceRow(
subtitle: String? = null, subtitle: String? = null,
action: @Composable (() -> Unit)? = null, action: @Composable (() -> Unit)? = null,
// SY --> // SY -->
subtitleAnnotated: AnnotatedString? = null subtitleAnnotated: AnnotatedString? = null,
// SY <-- // SY <--
) { ) {
val height = if (subtitle != null /* SY --> */ || subtitleAnnotated != null/* SY <-- */) 72.dp else 56.dp val height = if (subtitle != null /* SY --> */ || subtitleAnnotated != null/* SY <-- */) 72.dp else 56.dp
@ -60,7 +60,7 @@ fun PreferenceRow(
onLongClick = onLongClick, onLongClick = onLongClick,
onClick = onClick, onClick = onClick,
), ),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically,
) { ) {
if (painter != null) { if (painter != null) {
Icon( Icon(
@ -75,7 +75,7 @@ fun PreferenceRow(
Column( Column(
Modifier Modifier
.padding(horizontal = horizontalPadding) .padding(horizontal = horizontalPadding)
.weight(1f) .weight(1f),
) { ) {
Text( Text(
text = title, text = title,
@ -114,7 +114,7 @@ fun SwitchPreference(
subtitle: String? = null, subtitle: String? = null,
painter: Painter? = null, painter: Painter? = null,
// SY --> // SY -->
subtitleAnnotated: AnnotatedString? = null subtitleAnnotated: AnnotatedString? = null,
// SY <-- // SY <--
) { ) {
PreferenceRow( PreferenceRow(
@ -129,7 +129,7 @@ fun SwitchPreference(
}, },
onClick = { preference.value = !preference.value }, onClick = { preference.value = !preference.value },
// SY --> // SY -->
subtitleAnnotated = subtitleAnnotated subtitleAnnotated = subtitleAnnotated,
// SY <-- // SY <--
) )
} }

View File

@ -88,7 +88,7 @@ fun HistoryContent(
onClickResume: (HistoryWithRelations) -> Unit, onClickResume: (HistoryWithRelations) -> Unit,
onClickDelete: (HistoryWithRelations, Boolean) -> Unit, onClickDelete: (HistoryWithRelations, Boolean) -> Unit,
preferences: PreferencesHelper = Injekt.get(), preferences: PreferencesHelper = Injekt.get(),
nestedScroll: NestedScrollConnection nestedScroll: NestedScrollConnection,
) { ) {
if (history.loadState.refresh is LoadState.Loading) { if (history.loadState.refresh is LoadState.Loading) {
LoadingScreen() LoadingScreen()
@ -118,7 +118,7 @@ fun HistoryContent(
.animateItemPlacement(), .animateItemPlacement(),
date = item.date, date = item.date,
relativeTime = relativeTime, relativeTime = relativeTime,
dateFormat = dateFormat dateFormat = dateFormat,
) )
} }
is HistoryUiModel.Item -> { is HistoryUiModel.Item -> {
@ -142,7 +142,7 @@ fun HistoryContent(
onClickDelete(removeState, all) onClickDelete(removeState, all)
setRemoveState(null) setRemoveState(null)
}, },
onNegative = { setRemoveState(null) } onNegative = { setRemoveState(null) },
) )
} }
} }
@ -160,12 +160,12 @@ fun HistoryHeader(
text = date.toRelativeString( text = date.toRelativeString(
LocalContext.current, LocalContext.current,
relativeTime, relativeTime,
dateFormat dateFormat,
), ),
style = MaterialTheme.typography.bodyMedium.copy( style = MaterialTheme.typography.bodyMedium.copy(
color = MaterialTheme.colorScheme.onSurfaceVariant, color = MaterialTheme.colorScheme.onSurfaceVariant,
fontWeight = FontWeight.SemiBold, fontWeight = FontWeight.SemiBold,
) ),
) )
} }
@ -200,7 +200,7 @@ fun HistoryItem(
text = history.title, text = history.title,
maxLines = 2, maxLines = 2,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
style = textStyle.copy(fontWeight = FontWeight.SemiBold) style = textStyle.copy(fontWeight = FontWeight.SemiBold),
) )
Row { Row {
Text( Text(
@ -232,7 +232,7 @@ fun HistoryItem(
@Composable @Composable
fun RemoveHistoryDialog( fun RemoveHistoryDialog(
onPositive: (Boolean) -> Unit, onPositive: (Boolean) -> Unit,
onNegative: () -> Unit onNegative: () -> Unit,
) { ) {
val (removeEverything, removeEverythingState) = remember { mutableStateOf(false) } val (removeEverything, removeEverythingState) = remember { mutableStateOf(false) }
@ -250,9 +250,9 @@ fun RemoveHistoryDialog(
interactionSource = remember { MutableInteractionSource() }, interactionSource = remember { MutableInteractionSource() },
indication = null, indication = null,
value = removeEverything, value = removeEverything,
onValueChange = removeEverythingState onValueChange = removeEverythingState,
), ),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically,
) { ) {
Checkbox( Checkbox(
checked = removeEverything, checked = removeEverything,
@ -260,7 +260,7 @@ fun RemoveHistoryDialog(
) )
Text( Text(
modifier = Modifier.padding(start = 4.dp), modifier = Modifier.padding(start = 4.dp),
text = stringResource(id = R.string.dialog_with_checkbox_reset) text = stringResource(id = R.string.dialog_with_checkbox_reset),
) )
} }
} }

View File

@ -33,7 +33,7 @@ fun BaseMangaListItem(
.clickable(onClick = onClickItem) .clickable(onClick = onClickItem)
.height(56.dp) .height(56.dp)
.padding(horizontal = horizontalPadding), .padding(horizontal = horizontalPadding),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically,
) { ) {
cover() cover()
content() content()
@ -47,7 +47,7 @@ private val defaultCover: @Composable RowScope.(Manga, () -> Unit) -> Unit = { m
.padding(vertical = 8.dp) .padding(vertical = 8.dp)
.clickable(onClick = onClick) .clickable(onClick = onClick)
.fillMaxHeight(), .fillMaxHeight(),
data = manga.thumbnailUrl data = manga.thumbnailUrl,
) )
} }
@ -59,7 +59,7 @@ private val defaultContent: @Composable RowScope.(Manga) -> Unit = {
.padding(start = horizontalPadding), .padding(start = horizontalPadding),
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
maxLines = 1, maxLines = 1,
style = MaterialTheme.typography.bodyMedium style = MaterialTheme.typography.bodyMedium,
) )
} }
} }

View File

@ -18,7 +18,7 @@ import eu.kanade.tachiyomi.R
fun LogoHeader() { fun LogoHeader() {
Column { Column {
Surface( Surface(
modifier = Modifier.fillMaxWidth() modifier = Modifier.fillMaxWidth(),
) { ) {
Icon( Icon(
painter = painterResource(R.drawable.ic_tachi), painter = painterResource(R.drawable.ic_tachi),

View File

@ -25,7 +25,7 @@ fun MigrateMangaScreen(
nestedScrollInterop: NestedScrollConnection, nestedScrollInterop: NestedScrollConnection,
presenter: MigrationMangaPresenter, presenter: MigrationMangaPresenter,
onClickItem: (Manga) -> Unit, onClickItem: (Manga) -> Unit,
onClickCover: (Manga) -> Unit onClickCover: (Manga) -> Unit,
) { ) {
val state by presenter.state.collectAsState() val state by presenter.state.collectAsState()
@ -48,7 +48,7 @@ fun MigrateMangaContent(
nestedScrollInterop: NestedScrollConnection, nestedScrollInterop: NestedScrollConnection,
list: List<Manga>, list: List<Manga>,
onClickItem: (Manga) -> Unit, onClickItem: (Manga) -> Unit,
onClickCover: (Manga) -> Unit onClickCover: (Manga) -> Unit,
) { ) {
if (list.isEmpty()) { if (list.isEmpty()) {
EmptyScreen(textResource = R.string.migrate_empty_screen) EmptyScreen(textResource = R.string.migrate_empty_screen)
@ -62,7 +62,7 @@ fun MigrateMangaContent(
MigrateMangaItem( MigrateMangaItem(
manga = manga, manga = manga,
onClickItem = onClickItem, onClickItem = onClickItem,
onClickCover = onClickCover onClickCover = onClickCover,
) )
} }
} }
@ -73,12 +73,12 @@ fun MigrateMangaItem(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
manga: Manga, manga: Manga,
onClickItem: (Manga) -> Unit, onClickItem: (Manga) -> Unit,
onClickCover: (Manga) -> Unit onClickCover: (Manga) -> Unit,
) { ) {
BaseMangaListItem( BaseMangaListItem(
modifier = modifier, modifier = modifier,
manga = manga, manga = manga,
onClickItem = { onClickItem(manga) }, onClickItem = { onClickItem(manga) },
onClickCover = { onClickCover(manga) } onClickCover = { onClickCover(manga) },
) )
} }

View File

@ -47,7 +47,7 @@ fun MigrateSourceScreen(
list = (state as MigrateSourceState.Success).sources, list = (state as MigrateSourceState.Success).sources,
onClickItem = onClickItem, onClickItem = onClickItem,
onLongClickItem = onLongClickItem, onLongClickItem = onLongClickItem,
onClickAll = onClickAll onClickAll = onClickAll,
) )
} }
} }
@ -75,7 +75,7 @@ fun MigrateSourceList(
modifier = Modifier modifier = Modifier
.animateItemPlacement() .animateItemPlacement()
.padding(horizontal = horizontalPadding, vertical = 8.dp), .padding(horizontal = horizontalPadding, vertical = 8.dp),
style = MaterialTheme.typography.header style = MaterialTheme.typography.header,
) )
} }
@ -83,7 +83,7 @@ fun MigrateSourceList(
items = list, items = list,
key = { (source, _) -> key = { (source, _) ->
source.id source.id
} },
) { (source, count) -> ) { (source, count) ->
MigrateSourceItem( MigrateSourceItem(
modifier = Modifier.animateItemPlacement(), modifier = Modifier.animateItemPlacement(),
@ -91,7 +91,7 @@ fun MigrateSourceList(
count = count, count = count,
onClickItem = { onClickItem(source) }, onClickItem = { onClickItem(source) },
onLongClickItem = { onLongClickItem(source) }, onLongClickItem = { onLongClickItem(source) },
onClickAll = { onClickAll(source) } onClickAll = { onClickAll(source) },
) )
} }
} }
@ -118,10 +118,10 @@ fun MigrateSourceItem(
Text( Text(
text = stringResource(id = R.string.all), text = stringResource(id = R.string.all),
style = LocalTextStyle.current.copy( style = LocalTextStyle.current.copy(
color = MaterialTheme.colorScheme.primary color = MaterialTheme.colorScheme.primary,
) ),
) )
} }
} },
) )
} }

View File

@ -92,7 +92,7 @@ fun SourceFilterContent(
is FilterUiModel.Header, is FilterUiModel.ToggleHeader -> it.hashCode() is FilterUiModel.Header, is FilterUiModel.ToggleHeader -> it.hashCode()
is FilterUiModel.Item -> it.source.key() is FilterUiModel.Item -> it.source.key()
} }
} },
) { model -> ) { model ->
when (model) { when (model) {
is FilterUiModel.Header -> { is FilterUiModel.Header -> {
@ -100,7 +100,7 @@ fun SourceFilterContent(
modifier = Modifier.animateItemPlacement(), modifier = Modifier.animateItemPlacement(),
language = model.language, language = model.language,
isEnabled = model.isEnabled, isEnabled = model.isEnabled,
onClickItem = onClickLang onClickItem = onClickLang,
) )
} }
// SY --> // SY -->
@ -110,7 +110,7 @@ fun SourceFilterContent(
isEnabled = model.isEnabled, isEnabled = model.isEnabled,
onClickItem = { onClickItem = {
onClickSources(!model.isEnabled, model.sources) onClickSources(!model.isEnabled, model.sources)
} },
) )
} }
// SY <-- // SY <--
@ -118,7 +118,7 @@ fun SourceFilterContent(
modifier = Modifier.animateItemPlacement(), modifier = Modifier.animateItemPlacement(),
source = model.source, source = model.source,
isEnabled = model.isEnabled, isEnabled = model.isEnabled,
onClickItem = onClickSource onClickItem = onClickSource,
) )
} }
} }
@ -130,7 +130,7 @@ fun SourceFilterHeader(
modifier: Modifier, modifier: Modifier,
language: String, language: String,
isEnabled: Boolean, isEnabled: Boolean,
onClickItem: (String) -> Unit onClickItem: (String) -> Unit,
) { ) {
PreferenceRow( PreferenceRow(
modifier = modifier, modifier = modifier,
@ -147,7 +147,7 @@ fun SourceFilterHeader(
fun SourceFilterToggle( fun SourceFilterToggle(
modifier: Modifier, modifier: Modifier,
isEnabled: Boolean, isEnabled: Boolean,
onClickItem: () -> Unit onClickItem: () -> Unit,
) { ) {
PreferenceRow( PreferenceRow(
modifier = modifier, modifier = modifier,
@ -156,7 +156,7 @@ fun SourceFilterToggle(
Switch(checked = isEnabled, onCheckedChange = null) Switch(checked = isEnabled, onCheckedChange = null)
}, },
onClick = { onClickItem() }, onClick = { onClickItem() },
painter = remember { ColorPainter(Color.Transparent) } painter = remember { ColorPainter(Color.Transparent) },
) )
} }
@ -167,7 +167,7 @@ fun SourceFilterItem(
modifier: Modifier, modifier: Modifier,
source: Source, source: Source,
isEnabled: Boolean, isEnabled: Boolean,
onClickItem: (Source) -> Unit onClickItem: (Source) -> Unit,
) { ) {
BaseSourceItem( BaseSourceItem(
modifier = modifier, modifier = modifier,
@ -176,6 +176,6 @@ fun SourceFilterItem(
onClickItem = { onClickItem(source) }, onClickItem = { onClickItem(source) },
action = { action = {
Checkbox(checked = isEnabled, onCheckedChange = null) Checkbox(checked = isEnabled, onCheckedChange = null)
} },
) )
} }

View File

@ -59,7 +59,7 @@ fun SourceScreen(
onClickLatest: (Source) -> Unit, onClickLatest: (Source) -> Unit,
onClickPin: (Source) -> Unit, onClickPin: (Source) -> Unit,
onClickSetCategories: (Source, List<String>) -> Unit, onClickSetCategories: (Source, List<String>) -> Unit,
onClickToggleDataSaver: (Source) -> Unit onClickToggleDataSaver: (Source) -> Unit,
) { ) {
val state by presenter.state.collectAsState() val state by presenter.state.collectAsState()
@ -77,7 +77,7 @@ fun SourceScreen(
onClickLatest = onClickLatest, onClickLatest = onClickLatest,
onClickPin = onClickPin, onClickPin = onClickPin,
onClickSetCategories = onClickSetCategories, onClickSetCategories = onClickSetCategories,
onClickToggleDataSaver = onClickToggleDataSaver onClickToggleDataSaver = onClickToggleDataSaver,
) )
} }
} }
@ -94,7 +94,7 @@ fun SourceList(
onClickLatest: (Source) -> Unit, onClickLatest: (Source) -> Unit,
onClickPin: (Source) -> Unit, onClickPin: (Source) -> Unit,
onClickSetCategories: (Source, List<String>) -> Unit, onClickSetCategories: (Source, List<String>) -> Unit,
onClickToggleDataSaver: (Source) -> Unit onClickToggleDataSaver: (Source) -> Unit,
) { ) {
if (list.isEmpty()) { if (list.isEmpty()) {
EmptyScreen(textResource = R.string.source_empty_screen) EmptyScreen(textResource = R.string.source_empty_screen)
@ -123,14 +123,14 @@ fun SourceList(
is SourceUiModel.Header -> it.hashCode() is SourceUiModel.Header -> it.hashCode()
is SourceUiModel.Item -> it.source.key() is SourceUiModel.Item -> it.source.key()
} }
} },
) { model -> ) { model ->
when (model) { when (model) {
is SourceUiModel.Header -> { is SourceUiModel.Header -> {
SourceHeader( SourceHeader(
modifier = Modifier.animateItemPlacement(), modifier = Modifier.animateItemPlacement(),
language = model.language, language = model.language,
isCategory = model.isCategory isCategory = model.isCategory,
) )
} }
is SourceUiModel.Item -> SourceItem( is SourceUiModel.Item -> SourceItem(
@ -168,7 +168,7 @@ fun SourceList(
onClickToggleDataSaver(sourceState) onClickToggleDataSaver(sourceState)
setSourceState(null) setSourceState(null)
}, },
onDismiss = { setSourceState(null) } onDismiss = { setSourceState(null) },
) )
} }
if (sourceCategoriesState != null) { if (sourceCategoriesState != null) {
@ -213,7 +213,7 @@ fun SourceItem(
onClickItem: (Source) -> Unit, onClickItem: (Source) -> Unit,
onLongClickItem: (Source) -> Unit, onLongClickItem: (Source) -> Unit,
onClickLatest: (Source) -> Unit, onClickLatest: (Source) -> Unit,
onClickPin: (Source) -> Unit onClickPin: (Source) -> Unit,
) { ) {
BaseSourceItem( BaseSourceItem(
modifier = modifier, modifier = modifier,
@ -226,8 +226,8 @@ fun SourceItem(
Text( Text(
text = stringResource(id = R.string.latest), text = stringResource(id = R.string.latest),
style = LocalTextStyle.current.copy( style = LocalTextStyle.current.copy(
color = MaterialTheme.colorScheme.primary color = MaterialTheme.colorScheme.primary,
) ),
) )
} }
} }
@ -235,7 +235,7 @@ fun SourceItem(
if (showPin) { if (showPin) {
SourcePinButton( SourcePinButton(
isPinned = Pin.Pinned in source.pin, isPinned = Pin.Pinned in source.pin,
onClick = { onClickPin(source) } onClick = { onClickPin(source) },
) )
} }
// SY <-- // SY <--
@ -245,7 +245,7 @@ fun SourceItem(
@Composable @Composable
fun SourceIcon( fun SourceIcon(
source: Source source: Source,
) { ) {
val icon = source.icon val icon = source.icon
val modifier = Modifier val modifier = Modifier
@ -269,7 +269,7 @@ fun SourceIcon(
@Composable @Composable
fun SourcePinButton( fun SourcePinButton(
isPinned: Boolean, isPinned: Boolean,
onClick: () -> Unit onClick: () -> Unit,
) { ) {
val icon = if (isPinned) Icons.Filled.PushPin else Icons.Outlined.PushPin val icon = if (isPinned) Icons.Filled.PushPin else Icons.Outlined.PushPin
val tint = if (isPinned) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onBackground val tint = if (isPinned) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onBackground
@ -277,7 +277,7 @@ fun SourcePinButton(
Icon( Icon(
imageVector = icon, imageVector = icon,
contentDescription = "", contentDescription = "",
tint = tint tint = tint,
) )
} }
} }
@ -303,7 +303,7 @@ fun SourceOptionsDialog(
modifier = Modifier modifier = Modifier
.clickable(onClick = onClickPin) .clickable(onClick = onClickPin)
.fillMaxWidth() .fillMaxWidth()
.padding(vertical = 16.dp) .padding(vertical = 16.dp),
) )
if (source.id != LocalSource.ID) { if (source.id != LocalSource.ID) {
Text( Text(
@ -311,7 +311,7 @@ fun SourceOptionsDialog(
modifier = Modifier modifier = Modifier
.clickable(onClick = onClickDisable) .clickable(onClick = onClickDisable)
.fillMaxWidth() .fillMaxWidth()
.padding(vertical = 16.dp) .padding(vertical = 16.dp),
) )
} }
// SY --> // SY -->
@ -320,7 +320,7 @@ fun SourceOptionsDialog(
modifier = Modifier modifier = Modifier
.clickable(onClick = onClickSetCategories) .clickable(onClick = onClickSetCategories)
.fillMaxWidth() .fillMaxWidth()
.padding(vertical = 16.dp) .padding(vertical = 16.dp),
) )
Text( Text(
text = if (source.isExcludedFromDataSaver) { text = if (source.isExcludedFromDataSaver) {

View File

@ -32,10 +32,10 @@ fun BaseSourceItem(
modifier = modifier modifier = modifier
.combinedClickable( .combinedClickable(
onClick = onClickItem, onClick = onClickItem,
onLongClick = onLongClickItem onLongClick = onLongClickItem,
) )
.padding(horizontal = horizontalPadding, vertical = 8.dp), .padding(horizontal = horizontalPadding, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically,
) { ) {
icon.invoke(this, source) icon.invoke(this, source)
content.invoke(this, source, showLanguageInContent) content.invoke(this, source, showLanguageInContent)
@ -51,20 +51,20 @@ private val defaultContent: @Composable RowScope.(Source, Boolean) -> Unit = { s
Column( Column(
modifier = Modifier modifier = Modifier
.padding(horizontal = horizontalPadding) .padding(horizontal = horizontalPadding)
.weight(1f) .weight(1f),
) { ) {
Text( Text(
text = source.name, text = source.name,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
style = MaterialTheme.typography.bodyMedium style = MaterialTheme.typography.bodyMedium,
) )
if (showLanguageInContent) { if (showLanguageInContent) {
Text( Text(
text = LocaleHelper.getDisplayName(source.lang), text = LocaleHelper.getDisplayName(source.lang),
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
style = MaterialTheme.typography.bodySmall style = MaterialTheme.typography.bodySmall,
) )
} }
} }

View File

@ -45,7 +45,7 @@ class AppModule(val app: Application) : InjektModule {
.callback(DbOpenCallback()) .callback(DbOpenCallback())
.name(DbOpenCallback.DATABASE_NAME) .name(DbOpenCallback.DATABASE_NAME)
.noBackupDirectory(false) .noBackupDirectory(false)
.build() .build(),
) )
} }
@ -58,11 +58,11 @@ class AppModule(val app: Application) : InjektModule {
driver = get(), driver = get(),
historyAdapter = History.Adapter( historyAdapter = History.Adapter(
history_last_readAdapter = dateAdapter, history_last_readAdapter = dateAdapter,
history_time_readAdapter = dateAdapter history_time_readAdapter = dateAdapter,
), ),
mangasAdapter = Mangas.Adapter( mangasAdapter = Mangas.Adapter(
genreAdapter = listOfStringsAdapter genreAdapter = listOfStringsAdapter,
) ),
) )
} }

View File

@ -26,7 +26,7 @@ class DbOpenCallback : SupportSQLiteOpenHelper.Callback(Database.Schema.version)
Database.Schema.migrate( Database.Schema.migrate(
driver = AndroidSqliteDriver(database = db, cacheSize = 1), driver = AndroidSqliteDriver(database = db, cacheSize = 1),
oldVersion = oldVersion, oldVersion = oldVersion,
newVersion = newVersion newVersion = newVersion,
) )
} }
} }

View File

@ -49,7 +49,7 @@ class MigrationMangaController : ComposeController<MigrationMangaPresenter> {
}, },
onClickCover = { onClickCover = {
router.pushController(MangaController(it.id)) router.pushController(MangaController(it.id))
} },
) )
} }

View File

@ -15,7 +15,7 @@ import uy.kohesive.injekt.api.get
class MigrationMangaPresenter( class MigrationMangaPresenter(
private val sourceId: Long, private val sourceId: Long,
private val getFavoritesBySourceId: GetFavoritesBySourceId = Injekt.get() private val getFavoritesBySourceId: GetFavoritesBySourceId = Injekt.get(),
) : BasePresenter<MigrationMangaController>() { ) : BasePresenter<MigrationMangaController>() {
private val _state: MutableStateFlow<MigrateMangaState> = MutableStateFlow(MigrateMangaState.Loading) private val _state: MutableStateFlow<MigrateMangaState> = MutableStateFlow(MigrateMangaState.Loading)
val state: StateFlow<MigrateMangaState> = _state.asStateFlow() val state: StateFlow<MigrateMangaState> = _state.asStateFlow()

View File

@ -37,8 +37,8 @@ class SearchController(
Injekt.get<DatabaseHelper>().getManga(mangaId).executeAsBlocking(), Injekt.get<DatabaseHelper>().getManga(mangaId).executeAsBlocking(),
sources.map { Injekt.get<SourceManager>().getOrStub(it) }.filterIsInstance<CatalogueSource>(), sources.map { Injekt.get<SourceManager>().getOrStub(it) }.filterIsInstance<CatalogueSource>(),
) { ) {
this.targetController = targetController this.targetController = targetController
} }
@Suppress("unused") @Suppress("unused")
constructor(bundle: Bundle) : this( constructor(bundle: Bundle) : this(

View File

@ -43,8 +43,8 @@ class MigrationSourcesController : ComposeController<MigrationSourcesPresenter>(
}.pushController( }.pushController(
MigrationMangaController( MigrationMangaController(
source.id, source.id,
source.name source.name,
) ),
) )
}, },
onLongClickItem = { source -> onLongClickItem = { source ->
@ -87,12 +87,14 @@ class MigrationSourcesController : ComposeController<MigrationSourcesPresenter>(
true true
} }
R.id.asc_alphabetical, R.id.asc_alphabetical,
R.id.desc_alphabetical -> { R.id.desc_alphabetical,
-> {
presenter.setAlphabeticalSorting(itemId == R.id.asc_alphabetical) presenter.setAlphabeticalSorting(itemId == R.id.asc_alphabetical)
true true
} }
R.id.asc_count, R.id.asc_count,
R.id.desc_count -> { R.id.desc_count,
-> {
presenter.setTotalSorting(itemId == R.id.asc_count) presenter.setTotalSorting(itemId == R.id.asc_count)
true true
} }

View File

@ -16,7 +16,7 @@ import uy.kohesive.injekt.api.get
class MigrationSourcesPresenter( class MigrationSourcesPresenter(
private val getSourcesWithFavoriteCount: GetSourcesWithFavoriteCount = Injekt.get(), private val getSourcesWithFavoriteCount: GetSourcesWithFavoriteCount = Injekt.get(),
private val setMigrateSorting: SetMigrateSorting = Injekt.get() private val setMigrateSorting: SetMigrateSorting = Injekt.get(),
) : BasePresenter<MigrationSourcesController>() { ) : BasePresenter<MigrationSourcesController>() {
private val _state: MutableStateFlow<MigrateSourceState> = MutableStateFlow(MigrateSourceState.Loading) private val _state: MutableStateFlow<MigrateSourceState> = MutableStateFlow(MigrateSourceState.Loading)

View File

@ -74,7 +74,7 @@ class SourceController(bundle: Bundle? = null) : SearchableComposeController<Sou
SmartSearchController.ARG_SOURCE_ID to source.id, SmartSearchController.ARG_SOURCE_ID to source.id,
SmartSearchController.ARG_SMART_SEARCH_CONFIG to smartSearchConfig, SmartSearchController.ARG_SMART_SEARCH_CONFIG to smartSearchConfig,
), ),
) ),
) )
} }
preferences.useNewSourceNavigation().get() -> openSource(source, SourceFeedController(source.id)) preferences.useNewSourceNavigation().get() -> openSource(source, SourceFeedController(source.id))

View File

@ -53,8 +53,8 @@ class SourceFilterPresenter(
val toggleHeader = listOf( val toggleHeader = listOf(
FilterUiModel.ToggleHeader( FilterUiModel.ToggleHeader(
it.value, it.value,
it.value.none { (id) -> id.toString() in disabledSources } it.value.none { (id) -> id.toString() in disabledSources },
) ),
) )
// SY <-- // SY <--
@ -62,7 +62,7 @@ class SourceFilterPresenter(
header + toggleHeader + it.value.map { source -> header + toggleHeader + it.value.map { source ->
FilterUiModel.Item( FilterUiModel.Item(
source, source,
source.id.toString() !in preferences.disabledSources().get() source.id.toString() !in preferences.disabledSources().get(),
) )
} }
} }

View File

@ -53,7 +53,7 @@ class SourcePresenter(
getSourceCategories.subscribe(), getSourceCategories.subscribe(),
getShowLatest.subscribe(controllerMode), getShowLatest.subscribe(controllerMode),
flowOf(controllerMode == SourceController.Mode.CATALOGUE), flowOf(controllerMode == SourceController.Mode.CATALOGUE),
::collectLatestSources ::collectLatestSources,
) )
.catch { exception -> .catch { exception ->
_state.value = SourceState.Error(exception) _state.value = SourceState.Error(exception)
@ -99,7 +99,7 @@ class SourcePresenter(
uiModels, uiModels,
categories.sortedWith(compareByDescending(String.CASE_INSENSITIVE_ORDER) { it }), categories.sortedWith(compareByDescending(String.CASE_INSENSITIVE_ORDER) { it }),
showLatest, showLatest,
showPin showPin,
) )
} }
@ -132,6 +132,6 @@ sealed class SourceState {
val uiModels: List<SourceUiModel>, val uiModels: List<SourceUiModel>,
val sourceCategories: List<String>, val sourceCategories: List<String>,
val showLatest: Boolean, val showLatest: Boolean,
val showPin: Boolean val showPin: Boolean,
) : SourceState() ) : SourceState()
} }

View File

@ -124,7 +124,7 @@ open class BrowseSourceController(bundle: Bundle) :
query, query,
smartSearchConfig, smartSearchConfig,
savedSearch, savedSearch,
filterList filterList,
) )
constructor( constructor(
@ -140,7 +140,7 @@ open class BrowseSourceController(bundle: Bundle) :
query, query,
smartSearchConfig, smartSearchConfig,
savedSearch, savedSearch,
filterList filterList,
) )
private val preferences: PreferencesHelper by injectLazy() private val preferences: PreferencesHelper by injectLazy()

View File

@ -130,7 +130,7 @@ open class SourceFeedPresenter(
_id = null, _id = null,
source = source.id, source = source.id,
saved_search = savedSearchId, saved_search = savedSearchId,
global = false global = false,
) )
} }
} }

View File

@ -86,14 +86,14 @@ class SettingsMainController : BasicComposeController() {
SettingsSection( SettingsSection(
titleRes = R.string.pref_category_eh, titleRes = R.string.pref_category_eh,
painter = painterResource(R.drawable.eh_ic_ehlogo_red_24dp), painter = painterResource(R.drawable.eh_ic_ehlogo_red_24dp),
onClick = { router.pushController(SettingsEhController()) } onClick = { router.pushController(SettingsEhController()) },
) )
} else null, } else null,
if (MdUtil.getEnabledMangaDexs(preferences).isNotEmpty()) { if (MdUtil.getEnabledMangaDexs(preferences).isNotEmpty()) {
SettingsSection( SettingsSection(
titleRes = R.string.pref_category_mangadex, titleRes = R.string.pref_category_mangadex,
painter = painterResource(R.drawable.ic_tracker_mangadex_logo_24dp), painter = painterResource(R.drawable.ic_tracker_mangadex_logo_24dp),
onClick = { router.pushController(SettingsMangaDexController()) } onClick = { router.pushController(SettingsMangaDexController()) },
) )
} else null, } else null,
// SY <-- // SY <--

View File

@ -26,7 +26,7 @@ fun syncChaptersWithSource(
db: DatabaseHelper, db: DatabaseHelper,
rawSourceChapters: List<SChapter>, rawSourceChapters: List<SChapter>,
manga: Manga, manga: Manga,
source: Source source: Source,
): Pair<List<Chapter>, List<Chapter>> { ): Pair<List<Chapter>, List<Chapter>> {
if (rawSourceChapters.isEmpty()) { if (rawSourceChapters.isEmpty()) {
throw NoChaptersException() throw NoChaptersException()

View File

@ -91,7 +91,8 @@ class TachiyomiBottomNavigationView @JvmOverloads constructor(
currentAnimator = null currentAnimator = null
postInvalidate() postInvalidate()
} }
}) },
)
} }
internal class SavedState : AbsSavedState { internal class SavedState : AbsSavedState {

View File

@ -25,7 +25,7 @@ class ThemesPreferenceAdapter(private val clickListener: OnItemClickListener) :
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ThemeViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ThemeViewHolder {
val themeResIds = ThemingDelegate.getThemeResIds(themes[viewType], preferences.themeDarkAmoled().get()) val themeResIds = ThemingDelegate.getThemeResIds(themes[viewType], preferences.themeDarkAmoled().get())
val themedContext = themeResIds.fold(parent.context) { val themedContext = themeResIds.fold(parent.context) {
context, themeResId -> context, themeResId ->
ContextThemeWrapper(context, themeResId) ContextThemeWrapper(context, themeResId)
} }

View File

@ -416,7 +416,7 @@ object EXHMigrations {
source = it.substringBefore(':').toLongOrNull() ?: return@forEach, source = it.substringBefore(':').toLongOrNull() ?: return@forEach,
name = content["name"]!!.jsonPrimitive.content, name = content["name"]!!.jsonPrimitive.content,
query = content["query"]!!.jsonPrimitive.contentOrNull?.nullIfBlank(), query = content["query"]!!.jsonPrimitive.contentOrNull?.nullIfBlank(),
filters_json = Json.encodeToString(content["filters"]!!.jsonArray) filters_json = Json.encodeToString(content["filters"]!!.jsonArray),
) )
} }
} }

View File

@ -84,7 +84,7 @@ class SettingsDebugController : BasicComposeController() {
Box( Box(
Modifier Modifier
.fillMaxSize() .fillMaxSize()
.nestedScroll(nestedScrollInterop) .nestedScroll(nestedScrollInterop),
) { ) {
var running by remember { mutableStateOf(false) } var running by remember { mutableStateOf(false) }
var result by remember { mutableStateOf<Pair<String, String>?>(null) } var result by remember { mutableStateOf<Pair<String, String>?>(null) }
@ -94,7 +94,7 @@ class SettingsDebugController : BasicComposeController() {
text = "Functions", text = "Functions",
color = MaterialTheme.colorScheme.primary, color = MaterialTheme.colorScheme.primary,
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyMedium,
modifier = Modifier.padding(16.dp) modifier = Modifier.padding(16.dp),
) )
} }
items(functions.orEmpty()) { (func, name) -> items(functions.orEmpty()) { (func, name) ->
@ -123,7 +123,7 @@ class SettingsDebugController : BasicComposeController() {
text = "Toggles", text = "Toggles",
color = MaterialTheme.colorScheme.primary, color = MaterialTheme.colorScheme.primary,
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyMedium,
modifier = Modifier.padding(16.dp) modifier = Modifier.padding(16.dp),
) )
} }
items(toggles) { (name, pref, default) -> items(toggles) { (name, pref, default) ->
@ -134,7 +134,7 @@ class SettingsDebugController : BasicComposeController() {
.capitalize(Locale.getDefault()), .capitalize(Locale.getDefault()),
subtitleAnnotated = if (pref.value != default) { subtitleAnnotated = if (pref.value != default) {
AnnotatedString("MODIFIED", SpanStyle(color = Color.Red)) AnnotatedString("MODIFIED", SpanStyle(color = Color.Red))
} else null } else null,
) )
} }
item { item {
@ -145,7 +145,7 @@ class SettingsDebugController : BasicComposeController() {
running && result == null, running && result == null,
enter = fadeIn(), enter = fadeIn(),
exit = fadeOut(), exit = fadeOut(),
modifier = Modifier.fillMaxSize() modifier = Modifier.fillMaxSize(),
) { ) {
Box( Box(
Modifier Modifier
@ -158,7 +158,7 @@ class SettingsDebugController : BasicComposeController() {
} }
} }
}, },
contentAlignment = Alignment.Center contentAlignment = Alignment.Center,
) { ) {
CircularProgressIndicator() CircularProgressIndicator()
} }
@ -174,7 +174,7 @@ class SettingsDebugController : BasicComposeController() {
SelectionContainer { SelectionContainer {
Text(text = result?.second.orEmpty()) Text(text = result?.second.orEmpty())
} }
} },
) )
} }
} }

View File

@ -27,7 +27,7 @@ object EHTags {
Character.getTags(), Character.getTags(),
Group.getTags(), Group.getTags(),
Artist.getTags(), Artist.getTags(),
Artist2.getTags() Artist2.getTags(),
).flatten().flatten() ).flatten().flatten()
fun getNamespaces0Tags() = listOf( fun getNamespaces0Tags() = listOf(

View File

@ -13,6 +13,6 @@ interface TagList {
getTags1(), getTags1(),
getTags2(), getTags2(),
getTags3(), getTags3(),
getTags4() getTags4(),
) )
} }

View File

@ -111,5 +111,5 @@ conductor = ["conductor-core","conductor-viewpager","conductor-support-preferenc
shizuku = ["shizuku-api","shizuku-provider"] shizuku = ["shizuku-api","shizuku-provider"]
[plugins] [plugins]
kotlinter = { id = "org.jmailen.kotlinter", version = "3.6.0"} kotlinter = { id = "org.jmailen.kotlinter", version = "3.10.0"}
versionsx = { id = "com.github.ben-manes.versions", version = "0.42.0"} versionsx = { id = "com.github.ben-manes.versions", version = "0.42.0"}