Compare commits

...

5 Commits

Author SHA1 Message Date
perokhe
2fe942ff15
Merge 3d8f6dd310 into 1e570bc965 2024-09-17 19:32:26 +08:00
renovate[bot]
1e570bc965
fix(deps): update dependency me.zhanghai.android.libarchive:library to v1.1.1 (#1229)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-17 14:48:00 +06:00
Roshan Varughese
9cc7d42dd9
Re-enable fetching chapters list for entries with licenced status (#1230)
Enable Licensed
2024-09-17 14:47:04 +06:00
MajorTanya
f5c6d2e1a6
Fix Kitsu synopsis nullability (#1233)
This time, the Kitsu API docs are silent on whether this field (or
any other field) can be null/undefined/etc, but it can happen and
caused an error during search and update. This change just ensures the
attribute is nullable and is set to an empty String when it is null.
2024-09-17 14:46:37 +06:00
perokhe
3d8f6dd310 Hide smart update icon when disabled 2024-07-21 12:42:10 -06:00
8 changed files with 34 additions and 36 deletions

View File

@ -84,6 +84,7 @@ fun MangaScreen(
state: MangaScreenModel.State.Success,
snackbarHostState: SnackbarHostState,
nextUpdate: Instant?,
isUpdateIntervalEnabled: Boolean,
isTabletUi: Boolean,
chapterSwipeStartAction: LibraryPreferences.ChapterSwipeAction,
chapterSwipeEndAction: LibraryPreferences.ChapterSwipeAction,
@ -139,6 +140,7 @@ fun MangaScreen(
state = state,
snackbarHostState = snackbarHostState,
nextUpdate = nextUpdate,
isUpdateIntervalEnabled = isUpdateIntervalEnabled,
chapterSwipeStartAction = chapterSwipeStartAction,
chapterSwipeEndAction = chapterSwipeEndAction,
onBackClicked = onBackClicked,
@ -176,6 +178,7 @@ fun MangaScreen(
chapterSwipeStartAction = chapterSwipeStartAction,
chapterSwipeEndAction = chapterSwipeEndAction,
nextUpdate = nextUpdate,
isUpdateIntervalEnabled = isUpdateIntervalEnabled,
onBackClicked = onBackClicked,
onChapterClicked = onChapterClicked,
onDownloadChapter = onDownloadChapter,
@ -212,6 +215,7 @@ private fun MangaScreenSmallImpl(
state: MangaScreenModel.State.Success,
snackbarHostState: SnackbarHostState,
nextUpdate: Instant?,
isUpdateIntervalEnabled: Boolean,
chapterSwipeStartAction: LibraryPreferences.ChapterSwipeAction,
chapterSwipeEndAction: LibraryPreferences.ChapterSwipeAction,
onBackClicked: () -> Unit,
@ -396,6 +400,7 @@ private fun MangaScreenSmallImpl(
favorite = state.manga.favorite,
trackingCount = state.trackingCount,
nextUpdate = nextUpdate,
isUpdateIntervalEnabled = isUpdateIntervalEnabled,
isUserIntervalMode = state.manga.fetchInterval < 0,
onAddToLibraryClicked = onAddToLibraryClicked,
onWebViewClicked = onWebViewClicked,
@ -456,6 +461,7 @@ fun MangaScreenLargeImpl(
state: MangaScreenModel.State.Success,
snackbarHostState: SnackbarHostState,
nextUpdate: Instant?,
isUpdateIntervalEnabled: Boolean,
chapterSwipeStartAction: LibraryPreferences.ChapterSwipeAction,
chapterSwipeEndAction: LibraryPreferences.ChapterSwipeAction,
onBackClicked: () -> Unit,
@ -628,6 +634,7 @@ fun MangaScreenLargeImpl(
favorite = state.manga.favorite,
trackingCount = state.trackingCount,
nextUpdate = nextUpdate,
isUpdateIntervalEnabled = isUpdateIntervalEnabled,
isUserIntervalMode = state.manga.fetchInterval < 0,
onAddToLibraryClicked = onAddToLibraryClicked,
onWebViewClicked = onWebViewClicked,

View File

@ -157,11 +157,13 @@ fun MangaInfoBox(
}
}
@Suppress("CyclomaticComplexMethod")
@Composable
fun MangaActionRow(
favorite: Boolean,
trackingCount: Int,
nextUpdate: Instant?,
isUpdateIntervalEnabled: Boolean,
isUserIntervalMode: Boolean,
onAddToLibraryClicked: () -> Unit,
onWebViewClicked: (() -> Unit)?,
@ -195,20 +197,22 @@ fun MangaActionRow(
onClick = onAddToLibraryClicked,
onLongClick = onEditCategory,
)
MangaActionButton(
title = when (nextUpdateDays) {
null -> stringResource(MR.strings.not_applicable)
0 -> stringResource(MR.strings.manga_interval_expected_update_soon)
else -> pluralStringResource(
MR.plurals.day,
count = nextUpdateDays,
nextUpdateDays,
)
},
icon = Icons.Default.HourglassEmpty,
color = if (isUserIntervalMode) MaterialTheme.colorScheme.primary else defaultActionButtonColor,
onClick = { onEditIntervalClicked?.invoke() },
)
if (nextUpdateDays != null || isUpdateIntervalEnabled) {
MangaActionButton(
title = when (nextUpdateDays) {
null -> stringResource(MR.strings.not_applicable)
0 -> stringResource(MR.strings.manga_interval_expected_update_soon)
else -> pluralStringResource(
MR.plurals.day,
count = nextUpdateDays,
nextUpdateDays,
)
},
icon = Icons.Default.HourglassEmpty,
color = if (isUserIntervalMode) MaterialTheme.colorScheme.primary else defaultActionButtonColor,
onClick = { onEditIntervalClicked?.invoke() },
)
}
MangaActionButton(
title = if (trackingCount == 0) {
stringResource(MR.strings.manga_tracking_tab)

View File

@ -2,7 +2,6 @@ package eu.kanade.presentation.util
import android.content.Context
import eu.kanade.tachiyomi.network.HttpException
import eu.kanade.tachiyomi.source.online.LicensedMangaChaptersException
import eu.kanade.tachiyomi.util.system.isOnline
import tachiyomi.core.common.i18n.stringResource
import tachiyomi.data.source.NoResultsException
@ -25,7 +24,6 @@ val Throwable.formattedMessage: String
is NoResultsException -> return stringResource(MR.strings.no_results_found)
is SourceNotInstalledException -> return stringResource(MR.strings.loader_not_implemented_error)
is LicensedMangaChaptersException -> return stringResource(MR.strings.licensed_manga_chapters_error)
}
return when (val className = this::class.simpleName) {
"Exception", "IOException" -> message ?: className

View File

@ -25,7 +25,7 @@ data class KitsuListSearchResult(
title = manga.canonicalTitle
total_chapters = manga.chapterCount ?: 0
cover_url = manga.posterImage?.original ?: ""
summary = manga.synopsis
summary = manga.synopsis ?: ""
tracking_url = KitsuApi.mangaUrl(remote_id)
publishing_status = manga.status
publishing_type = manga.mangaType ?: ""
@ -73,7 +73,7 @@ data class KitsuListSearchItemIncludedAttributes(
val chapterCount: Long?,
val mangaType: String?,
val posterImage: KitsuSearchItemCover?,
val synopsis: String,
val synopsis: String?,
val startDate: String?,
val status: String,
)

View File

@ -118,6 +118,7 @@ class MangaScreen(
state = successState,
snackbarHostState = screenModel.snackbarHostState,
nextUpdate = successState.manga.expectedNextUpdate,
isUpdateIntervalEnabled = screenModel.isUpdateIntervalEnabled,
isTabletUi = isTabletUi(),
chapterSwipeStartAction = screenModel.chapterSwipeStartAction,
chapterSwipeEndAction = screenModel.chapterSwipeEndAction,

View File

@ -32,7 +32,7 @@ jsoup = "org.jsoup:jsoup:1.18.1"
disklrucache = "com.jakewharton:disklrucache:2.0.2"
unifile = "com.github.tachiyomiorg:unifile:e0def6b3dc"
libarchive = "me.zhanghai.android.libarchive:library:1.1.0"
libarchive = "me.zhanghai.android.libarchive:library:1.1.1"
sqlite-framework = { module = "androidx.sqlite:sqlite-framework", version.ref = "sqlite" }
sqlite-ktx = { module = "androidx.sqlite:sqlite-ktx", version.ref = "sqlite" }

View File

@ -647,7 +647,6 @@
<!-- missing prompt after Compose rewrite #7901 -->
<string name="no_more_results">No more results</string>
<string name="no_results_found">No results found</string>
<string name="licensed_manga_chapters_error">Licensed - No chapters to show</string>
<string name="local_source">Local source</string>
<string name="other_source">Other</string>
<string name="last_used_source">Last used</string>

View File

@ -251,28 +251,19 @@ abstract class HttpSource : CatalogueSource {
*
* @param manga the manga to update.
* @return the chapters for the manga.
* @throws LicensedMangaChaptersException if a manga is licensed and therefore no chapters are available.
*/
@Suppress("DEPRECATION")
override suspend fun getChapterList(manga: SManga): List<SChapter> {
if (manga.status == SManga.LICENSED) {
throw LicensedMangaChaptersException()
}
return fetchChapterList(manga).awaitSingle()
}
@Deprecated("Use the non-RxJava API instead", replaceWith = ReplaceWith("getChapterList"))
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
return if (manga.status != SManga.LICENSED) {
client.newCall(chapterListRequest(manga))
.asObservableSuccess()
.map { response ->
chapterListParse(response)
}
} else {
Observable.error(LicensedMangaChaptersException())
}
return client.newCall(chapterListRequest(manga))
.asObservableSuccess()
.map { response ->
chapterListParse(response)
}
}
/**
@ -472,5 +463,3 @@ abstract class HttpSource : CatalogueSource {
*/
override fun getFilterList() = FilterList()
}
class LicensedMangaChaptersException : RuntimeException()