Remove alphabetical category sort option (#1781)

This commit is contained in:
AntsyLich
2025-02-27 13:11:41 +06:00
committed by GitHub
parent 4db3817782
commit 2b0c28938b
7 changed files with 5 additions and 89 deletions

View File

@@ -12,10 +12,9 @@ import tachiyomi.domain.category.repository.CategoryRepository
class ReorderCategory(
private val categoryRepository: CategoryRepository,
) {
private val mutex = Mutex()
suspend fun changeOrder(category: Category, newIndex: Int) = withNonCancellableContext {
suspend fun await(category: Category, newIndex: Int) = withNonCancellableContext {
mutex.withLock {
val categories = categoryRepository.getAll()
.filterNot(Category::isSystemCategory)
@@ -45,27 +44,6 @@ class ReorderCategory(
}
}
suspend fun sortAlphabetically() = withNonCancellableContext {
mutex.withLock {
val updates = categoryRepository.getAll()
.sortedBy { category -> category.name }
.mapIndexed { index, category ->
CategoryUpdate(
id = category.id,
order = index.toLong(),
)
}
try {
categoryRepository.updatePartial(updates)
Result.Success
} catch (e: Exception) {
logcat(LogPriority.ERROR, e)
Result.InternalError(e)
}
}
}
sealed interface Result {
data object Success : Result
data object Unchanged : Result