mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-20 10:09:43 +02:00
Add tests for MissingChapters function
This commit is contained in:
@@ -65,7 +65,7 @@ import eu.kanade.tachiyomi.ui.manga.chapterDecimalFormat
|
||||
import eu.kanade.tachiyomi.util.lang.toRelativeString
|
||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||
import tachiyomi.domain.chapter.model.Chapter
|
||||
import tachiyomi.domain.chapter.service.countMissingChapters
|
||||
import tachiyomi.domain.chapter.service.missingChaptersCount
|
||||
import tachiyomi.domain.manga.model.Manga
|
||||
import tachiyomi.domain.source.model.StubSource
|
||||
import tachiyomi.presentation.core.components.LazyColumn
|
||||
@@ -394,7 +394,7 @@ private fun MangaScreenSmallImpl(
|
||||
ChapterHeader(
|
||||
enabled = chapters.fastAll { !it.selected },
|
||||
chapterCount = chapters.size,
|
||||
missingChapterCount = countMissingChapters(chapters.map { it.chapter.chapterNumber }),
|
||||
missingChapterCount = chapters.map { it.chapter.chapterNumber }.missingChaptersCount(),
|
||||
onClick = onFilterClicked,
|
||||
)
|
||||
}
|
||||
@@ -606,7 +606,7 @@ fun MangaScreenLargeImpl(
|
||||
ChapterHeader(
|
||||
enabled = chapters.fastAll { !it.selected },
|
||||
chapterCount = chapters.size,
|
||||
missingChapterCount = countMissingChapters(chapters.map { it.chapter.chapterNumber }),
|
||||
missingChapterCount = chapters.map { it.chapter.chapterNumber }.missingChaptersCount(),
|
||||
onClick = onFilterButtonClicked,
|
||||
)
|
||||
}
|
||||
|
@@ -14,13 +14,13 @@ import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import eu.kanade.tachiyomi.R
|
||||
import tachiyomi.presentation.core.util.secondaryItemAlpha
|
||||
import tachiyomi.presentation.core.components.material.SecondaryItemAlpha
|
||||
|
||||
@Composable
|
||||
fun ChapterHeader(
|
||||
enabled: Boolean,
|
||||
chapterCount: Int?,
|
||||
missingChapterCount: Int?,
|
||||
missingChapterCount: Int,
|
||||
onClick: () -> Unit,
|
||||
) {
|
||||
Column(
|
||||
@@ -48,19 +48,16 @@ fun ChapterHeader(
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun MissingChaptersWarning(count: Int?) {
|
||||
val text = when {
|
||||
count == null -> stringResource(R.string.missing_chapters_unknown)
|
||||
count > 0 -> pluralStringResource(id = R.plurals.missing_chapters, count = count, count)
|
||||
else -> return
|
||||
private fun MissingChaptersWarning(count: Int) {
|
||||
if (count == 0) {
|
||||
return
|
||||
}
|
||||
|
||||
Text(
|
||||
modifier = Modifier.secondaryItemAlpha(),
|
||||
text = text,
|
||||
text = pluralStringResource(id = R.plurals.missing_chapters, count = count, count),
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.error,
|
||||
color = MaterialTheme.colorScheme.error.copy(alpha = SecondaryItemAlpha),
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user