Remove alphabetical category sort option (#1781)

(cherry picked from commit 2b0c28938bfd74577d2ff0736b2cc72f4e4705cf)

# Conflicts:
#	CHANGELOG.md
#	app/src/main/java/eu/kanade/presentation/category/CategoryScreen.kt
This commit is contained in:
AntsyLich
2025-02-27 13:11:41 +06:00
committed by Jobobby04
parent 949a2a95ad
commit f60cb9bb64
6 changed files with 2 additions and 89 deletions
@@ -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