Address misc. build warnings
This commit is contained in:
@@ -12,10 +12,10 @@ class CreateCategoryWithName(
|
||||
private val categoryRepository: CategoryRepository,
|
||||
) {
|
||||
|
||||
suspend fun await(name: String): Result = withContext(NonCancellable) await@{
|
||||
suspend fun await(name: String): Result = withContext(NonCancellable) {
|
||||
val categories = categoryRepository.getAll()
|
||||
if (categories.anyWithName(name)) {
|
||||
return@await Result.NameAlreadyExistsError
|
||||
return@withContext Result.NameAlreadyExistsError
|
||||
}
|
||||
|
||||
val nextOrder = categories.maxOfOrNull { it.order }?.plus(1) ?: 0
|
||||
|
||||
@@ -11,12 +11,12 @@ class DeleteCategory(
|
||||
private val categoryRepository: CategoryRepository,
|
||||
) {
|
||||
|
||||
suspend fun await(categoryId: Long) = withContext(NonCancellable) await@{
|
||||
suspend fun await(categoryId: Long) = withContext(NonCancellable) {
|
||||
try {
|
||||
categoryRepository.delete(categoryId)
|
||||
} catch (e: Exception) {
|
||||
logcat(LogPriority.ERROR, e)
|
||||
return@await Result.InternalError(e)
|
||||
return@withContext Result.InternalError(e)
|
||||
}
|
||||
|
||||
val categories = categoryRepository.getAll()
|
||||
|
||||
@@ -13,10 +13,10 @@ class RenameCategory(
|
||||
private val categoryRepository: CategoryRepository,
|
||||
) {
|
||||
|
||||
suspend fun await(categoryId: Long, name: String) = withContext(NonCancellable) await@{
|
||||
suspend fun await(categoryId: Long, name: String) = withContext(NonCancellable) {
|
||||
val categories = categoryRepository.getAll()
|
||||
if (categories.anyWithName(name)) {
|
||||
return@await Result.NameAlreadyExistsError
|
||||
return@withContext Result.NameAlreadyExistsError
|
||||
}
|
||||
|
||||
val update = CategoryUpdate(
|
||||
|
||||
@@ -12,12 +12,12 @@ class ReorderCategory(
|
||||
private val categoryRepository: CategoryRepository,
|
||||
) {
|
||||
|
||||
suspend fun await(categoryId: Long, newPosition: Int) = withContext(NonCancellable) await@{
|
||||
suspend fun await(categoryId: Long, newPosition: Int) = withContext(NonCancellable) {
|
||||
val categories = categoryRepository.getAll().filterNot(Category::isSystemCategory)
|
||||
|
||||
val currentIndex = categories.indexOfFirst { it.id == categoryId }
|
||||
if (currentIndex == newPosition) {
|
||||
return@await Result.Unchanged
|
||||
return@withContext Result.Unchanged
|
||||
}
|
||||
|
||||
val reorderedCategories = categories.toMutableList()
|
||||
|
||||
@@ -27,11 +27,11 @@ class SetReadStatus(
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun await(read: Boolean, vararg values: Chapter): Result = withContext(NonCancellable) f@{
|
||||
suspend fun await(read: Boolean, vararg values: Chapter): Result = withContext(NonCancellable) {
|
||||
val chapters = values.filterNot { it.read == read }
|
||||
|
||||
if (chapters.isEmpty()) {
|
||||
return@f Result.NoChapters
|
||||
return@withContext Result.NoChapters
|
||||
}
|
||||
|
||||
val manga = chapters.fold(mutableSetOf<Manga>()) { acc, chapter ->
|
||||
@@ -49,15 +49,15 @@ class SetReadStatus(
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
logcat(LogPriority.ERROR, e)
|
||||
return@f Result.InternalError(e)
|
||||
return@withContext Result.InternalError(e)
|
||||
}
|
||||
|
||||
if (read && preferences.removeAfterMarkedAsRead()) {
|
||||
manga.forEach { manga ->
|
||||
manga.forEach {
|
||||
deleteDownload.awaitAll(
|
||||
manga = manga,
|
||||
manga = it,
|
||||
values = chapters
|
||||
.filter { manga.id == it.mangaId }
|
||||
.filter { chapter -> it.id == chapter.mangaId }
|
||||
.toTypedArray(),
|
||||
)
|
||||
}
|
||||
@@ -66,8 +66,8 @@ class SetReadStatus(
|
||||
Result.Success
|
||||
}
|
||||
|
||||
suspend fun await(mangaId: Long, read: Boolean): Result = withContext(NonCancellable) f@{
|
||||
return@f await(
|
||||
suspend fun await(mangaId: Long, read: Boolean): Result = withContext(NonCancellable) {
|
||||
await(
|
||||
read = read,
|
||||
values = chapterRepository
|
||||
.getChapterByMangaId(mangaId)
|
||||
|
||||
Reference in New Issue
Block a user