From dd5e9b17f1f78418251191608e419d800ca68e7f Mon Sep 17 00:00:00 2001 From: Secozzi Date: Wed, 8 May 2024 15:39:58 +0200 Subject: [PATCH 01/14] Fixed dev UI preview (#10385) The TachiyomiTheme introduced a dependency-injection construct that didn't exist at the time of rendering previews, so I've changed the preview function to use a preview version of the theme that uses declarative configuration over dependency injection Co-authored-by: Caleb Morris <347395+CalebMorris@users.noreply.github.com> --- .../presentation/components/EmptyScreen.kt | 6 ++-- .../kanade/presentation/crash/CrashScreen.kt | 4 +-- .../components/MissingItemCountListItem.kt | 4 +-- .../presentation/history/HistoryDialogs.kt | 4 +-- .../history/anime/AnimeHistoryScreen.kt | 4 +-- .../anime/components/AnimeHistoryItem.kt | 4 +-- .../history/manga/MangaHistoryScreen.kt | 4 +-- .../manga/components/MangaHistoryItem.kt | 4 +-- .../library/components/LibraryBadges.kt | 4 +-- .../presentation/more/NewUpdateScreen.kt | 4 +-- .../more/onboarding/GuidesStep.kt | 4 +-- .../widget/AppThemePreferenceWidget.kt | 7 ++++- .../more/settings/widget/InfoWidget.kt | 4 +-- .../settings/widget/SwitchPreferenceWidget.kt | 4 +-- .../settings/widget/TextPreferenceWidget.kt | 4 +-- .../presentation/reader/ChapterTransition.kt | 12 +++---- .../reader/OrientationSelectDialog.kt | 4 +-- .../presentation/reader/PageIndicatorText.kt | 4 +-- .../reader/ReadingModeSelectDialog.kt | 4 +-- .../reader/components/ModeSelectionDialog.kt | 4 +-- .../presentation/theme/TachiyomiTheme.kt | 31 ++++++++++++++++--- .../track/TrackInfoDialogSelector.kt | 4 +-- .../track/anime/AnimeTrackInfoDialogHome.kt | 4 +-- .../track/anime/AnimeTrackerSearch.kt | 4 +-- .../track/components/TrackLogoIcon.kt | 4 +-- .../track/manga/MangaTrackInfoDialogHome.kt | 4 +-- .../track/manga/MangaTrackerSearch.kt | 4 +-- 27 files changed, 87 insertions(+), 61 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/components/EmptyScreen.kt b/app/src/main/java/eu/kanade/presentation/components/EmptyScreen.kt index ddcf22cb43..5355318a96 100644 --- a/app/src/main/java/eu/kanade/presentation/components/EmptyScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/components/EmptyScreen.kt @@ -6,7 +6,7 @@ import androidx.compose.material.icons.outlined.Refresh import androidx.compose.material3.Surface import androidx.compose.runtime.Composable import androidx.compose.ui.tooling.preview.PreviewLightDark -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import kotlinx.collections.immutable.persistentListOf import tachiyomi.i18n.MR import tachiyomi.presentation.core.screens.EmptyScreen @@ -15,7 +15,7 @@ import tachiyomi.presentation.core.screens.EmptyScreenAction @PreviewLightDark @Composable private fun NoActionPreview() { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface { EmptyScreen( stringRes = MR.strings.empty_screen, @@ -27,7 +27,7 @@ private fun NoActionPreview() { @PreviewLightDark @Composable private fun WithActionPreview() { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface { EmptyScreen( stringRes = MR.strings.empty_screen, diff --git a/app/src/main/java/eu/kanade/presentation/crash/CrashScreen.kt b/app/src/main/java/eu/kanade/presentation/crash/CrashScreen.kt index a27472c453..4fb22201a5 100644 --- a/app/src/main/java/eu/kanade/presentation/crash/CrashScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/crash/CrashScreen.kt @@ -14,7 +14,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.tooling.preview.PreviewLightDark -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import eu.kanade.tachiyomi.util.CrashLogUtil import kotlinx.coroutines.launch import tachiyomi.i18n.MR @@ -66,7 +66,7 @@ fun CrashScreen( @PreviewLightDark @Composable private fun CrashScreenPreview() { - TachiyomiTheme { + TachiyomiPreviewTheme { CrashScreen(exception = RuntimeException("Dummy")) {} } } diff --git a/app/src/main/java/eu/kanade/presentation/entries/components/MissingItemCountListItem.kt b/app/src/main/java/eu/kanade/presentation/entries/components/MissingItemCountListItem.kt index 5facc81a47..34092a9d04 100644 --- a/app/src/main/java/eu/kanade/presentation/entries/components/MissingItemCountListItem.kt +++ b/app/src/main/java/eu/kanade/presentation/entries/components/MissingItemCountListItem.kt @@ -11,7 +11,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.PreviewLightDark -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.i18n.pluralStringResource @@ -44,7 +44,7 @@ fun MissingItemCountListItem( @PreviewLightDark @Composable private fun Preview() { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface { MissingItemCountListItem(count = 42) } diff --git a/app/src/main/java/eu/kanade/presentation/history/HistoryDialogs.kt b/app/src/main/java/eu/kanade/presentation/history/HistoryDialogs.kt index 96df879ed2..44975c1351 100644 --- a/app/src/main/java/eu/kanade/presentation/history/HistoryDialogs.kt +++ b/app/src/main/java/eu/kanade/presentation/history/HistoryDialogs.kt @@ -12,7 +12,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.tooling.preview.PreviewLightDark -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.LabeledCheckbox import tachiyomi.presentation.core.components.material.padding @@ -102,7 +102,7 @@ fun HistoryDeleteAllDialog( @PreviewLightDark @Composable private fun HistoryDeleteDialogPreview() { - TachiyomiTheme { + TachiyomiPreviewTheme { HistoryDeleteDialog( onDismissRequest = {}, onDelete = {}, diff --git a/app/src/main/java/eu/kanade/presentation/history/anime/AnimeHistoryScreen.kt b/app/src/main/java/eu/kanade/presentation/history/anime/AnimeHistoryScreen.kt index 30123ed2c9..2c01590d66 100644 --- a/app/src/main/java/eu/kanade/presentation/history/anime/AnimeHistoryScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/history/anime/AnimeHistoryScreen.kt @@ -11,7 +11,7 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.tooling.preview.PreviewParameter import eu.kanade.presentation.components.relativeDateText import eu.kanade.presentation.history.anime.components.AnimeHistoryItem -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import eu.kanade.tachiyomi.ui.history.anime.AnimeHistoryScreenModel import tachiyomi.domain.history.anime.model.AnimeHistoryWithRelations import tachiyomi.i18n.MR @@ -114,7 +114,7 @@ internal fun HistoryScreenPreviews( @PreviewParameter(AnimeHistoryScreenModelStateProvider::class) historyState: AnimeHistoryScreenModel.State, ) { - TachiyomiTheme { + TachiyomiPreviewTheme { AnimeHistoryScreen( state = historyState, snackbarHostState = SnackbarHostState(), diff --git a/app/src/main/java/eu/kanade/presentation/history/anime/components/AnimeHistoryItem.kt b/app/src/main/java/eu/kanade/presentation/history/anime/components/AnimeHistoryItem.kt index f1ce1161d2..d0bf8eeac3 100644 --- a/app/src/main/java/eu/kanade/presentation/history/anime/components/AnimeHistoryItem.kt +++ b/app/src/main/java/eu/kanade/presentation/history/anime/components/AnimeHistoryItem.kt @@ -23,7 +23,7 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import eu.kanade.presentation.entries.components.ItemCover -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import eu.kanade.presentation.util.formatEpisodeNumber import eu.kanade.tachiyomi.util.lang.toTimestampString import tachiyomi.domain.history.anime.model.AnimeHistoryWithRelations @@ -101,7 +101,7 @@ private fun HistoryItemPreviews( @PreviewParameter(AnimeHistoryWithRelationsProvider::class) historyWithRelations: AnimeHistoryWithRelations, ) { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface { AnimeHistoryItem( history = historyWithRelations, diff --git a/app/src/main/java/eu/kanade/presentation/history/manga/MangaHistoryScreen.kt b/app/src/main/java/eu/kanade/presentation/history/manga/MangaHistoryScreen.kt index e6c175e13d..5021f56240 100644 --- a/app/src/main/java/eu/kanade/presentation/history/manga/MangaHistoryScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/history/manga/MangaHistoryScreen.kt @@ -11,7 +11,7 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.tooling.preview.PreviewParameter import eu.kanade.presentation.components.relativeDateText import eu.kanade.presentation.history.manga.components.MangaHistoryItem -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import eu.kanade.tachiyomi.ui.history.manga.MangaHistoryScreenModel import tachiyomi.domain.history.manga.model.MangaHistoryWithRelations import tachiyomi.i18n.MR @@ -114,7 +114,7 @@ internal fun HistoryScreenPreviews( @PreviewParameter(MangaHistoryScreenModelStateProvider::class) historyState: MangaHistoryScreenModel.State, ) { - TachiyomiTheme { + TachiyomiPreviewTheme { MangaHistoryScreen( state = historyState, snackbarHostState = SnackbarHostState(), diff --git a/app/src/main/java/eu/kanade/presentation/history/manga/components/MangaHistoryItem.kt b/app/src/main/java/eu/kanade/presentation/history/manga/components/MangaHistoryItem.kt index 0a0563d4f9..1f9a8cd533 100644 --- a/app/src/main/java/eu/kanade/presentation/history/manga/components/MangaHistoryItem.kt +++ b/app/src/main/java/eu/kanade/presentation/history/manga/components/MangaHistoryItem.kt @@ -23,7 +23,7 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import eu.kanade.presentation.entries.components.ItemCover -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import eu.kanade.presentation.util.formatChapterNumber import eu.kanade.tachiyomi.util.lang.toTimestampString import tachiyomi.domain.history.manga.model.MangaHistoryWithRelations @@ -101,7 +101,7 @@ internal fun HistoryItemPreviews( @PreviewParameter(MangaHistoryWithRelationsProvider::class) historyWithRelations: MangaHistoryWithRelations, ) { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface { MangaHistoryItem( history = historyWithRelations, diff --git a/app/src/main/java/eu/kanade/presentation/library/components/LibraryBadges.kt b/app/src/main/java/eu/kanade/presentation/library/components/LibraryBadges.kt index a19300f6ac..a46724ed35 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/LibraryBadges.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/LibraryBadges.kt @@ -6,7 +6,7 @@ import androidx.compose.material.icons.outlined.Folder import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.tooling.preview.PreviewLightDark -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import tachiyomi.presentation.core.components.Badge @Composable @@ -50,7 +50,7 @@ internal fun LanguageBadge( @PreviewLightDark @Composable private fun BadgePreview() { - TachiyomiTheme { + TachiyomiPreviewTheme { Column { DownloadsBadge(count = 10) UnviewedBadge(count = 10) diff --git a/app/src/main/java/eu/kanade/presentation/more/NewUpdateScreen.kt b/app/src/main/java/eu/kanade/presentation/more/NewUpdateScreen.kt index 96fd421ddc..3d561b0c36 100644 --- a/app/src/main/java/eu/kanade/presentation/more/NewUpdateScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/NewUpdateScreen.kt @@ -19,7 +19,7 @@ import com.halilibo.richtext.markdown.Markdown import com.halilibo.richtext.ui.RichTextStyle import com.halilibo.richtext.ui.material3.RichText import com.halilibo.richtext.ui.string.RichTextStringStyle -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.i18n.stringResource @@ -69,7 +69,7 @@ fun NewUpdateScreen( @PreviewLightDark @Composable private fun NewUpdateScreenPreview() { - TachiyomiTheme { + TachiyomiPreviewTheme { NewUpdateScreen( versionName = "v0.99.9", changelogInfo = """ diff --git a/app/src/main/java/eu/kanade/presentation/more/onboarding/GuidesStep.kt b/app/src/main/java/eu/kanade/presentation/more/onboarding/GuidesStep.kt index 6692689411..02ccb2813b 100644 --- a/app/src/main/java/eu/kanade/presentation/more/onboarding/GuidesStep.kt +++ b/app/src/main/java/eu/kanade/presentation/more/onboarding/GuidesStep.kt @@ -13,7 +13,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalUriHandler import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.dp -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.i18n.stringResource @@ -61,7 +61,7 @@ const val GETTING_STARTED_URL = "https://aniyomi.org/docs/guides/getting-started @PreviewLightDark @Composable private fun GuidesStepPreview() { - TachiyomiTheme { + TachiyomiPreviewTheme { GuidesStep( onRestoreBackup = {}, ).Content() diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemePreferenceWidget.kt b/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemePreferenceWidget.kt index c6a4b70250..72bb00a18f 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemePreferenceWidget.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemePreferenceWidget.kt @@ -42,15 +42,19 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.dp import androidx.core.app.ActivityCompat +import eu.kanade.domain.ui.UiPreferences import eu.kanade.domain.ui.model.AppTheme import eu.kanade.presentation.entries.components.ItemCover import eu.kanade.presentation.theme.TachiyomiTheme import eu.kanade.tachiyomi.util.system.DeviceUtil import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable +import tachiyomi.core.preference.InMemoryPreferenceStore import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.util.secondaryItemAlpha +import uy.kohesive.injekt.Injekt +import uy.kohesive.injekt.api.fullType @Composable internal fun AppThemePreferenceWidget( @@ -258,7 +262,8 @@ fun AppThemePreviewItem( @Composable private fun AppThemesListPreview() { var appTheme by remember { mutableStateOf(AppTheme.DEFAULT) } - TachiyomiTheme { + Injekt.addSingleton(fullType(), UiPreferences(InMemoryPreferenceStore())) + TachiyomiTheme(appTheme = appTheme) { Surface { AppThemesList( currentTheme = appTheme, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/widget/InfoWidget.kt b/app/src/main/java/eu/kanade/presentation/more/settings/widget/InfoWidget.kt index 5d9d8db853..46fee1e1c7 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/widget/InfoWidget.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/widget/InfoWidget.kt @@ -12,7 +12,7 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.PreviewLightDark -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.i18n.stringResource @@ -43,7 +43,7 @@ internal fun InfoWidget(text: String) { @PreviewLightDark @Composable private fun InfoWidgetPreview() { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface { InfoWidget(text = stringResource(MR.strings.download_ahead_info)) } diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/widget/SwitchPreferenceWidget.kt b/app/src/main/java/eu/kanade/presentation/more/settings/widget/SwitchPreferenceWidget.kt index bc026d3ba8..41690242de 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/widget/SwitchPreferenceWidget.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/widget/SwitchPreferenceWidget.kt @@ -10,7 +10,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.tooling.preview.PreviewLightDark -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme @Composable fun SwitchPreferenceWidget( @@ -40,7 +40,7 @@ fun SwitchPreferenceWidget( @PreviewLightDark @Composable private fun SwitchPreferenceWidgetPreview() { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface { Column { SwitchPreferenceWidget( diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/widget/TextPreferenceWidget.kt b/app/src/main/java/eu/kanade/presentation/more/settings/widget/TextPreferenceWidget.kt index 05bd7f85dd..f3423d8e4e 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/widget/TextPreferenceWidget.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/widget/TextPreferenceWidget.kt @@ -13,7 +13,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.tooling.preview.PreviewLightDark -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import tachiyomi.presentation.core.util.secondaryItemAlpha @Composable @@ -62,7 +62,7 @@ fun TextPreferenceWidget( @PreviewLightDark @Composable private fun TextPreferenceWidgetPreview() { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface { Column { TextPreferenceWidget( diff --git a/app/src/main/java/eu/kanade/presentation/reader/ChapterTransition.kt b/app/src/main/java/eu/kanade/presentation/reader/ChapterTransition.kt index 1bdff37d93..807bd34ff1 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/ChapterTransition.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/ChapterTransition.kt @@ -33,7 +33,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import eu.kanade.tachiyomi.data.database.models.manga.toDomainChapter import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter @@ -310,7 +310,7 @@ private val FakeChapterLongTitle = previewChapter( @PreviewLightDark @Composable private fun TransitionTextPreview() { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface(modifier = Modifier.padding(48.dp)) { ChapterTransition( transition = ChapterTransition.Next( @@ -327,7 +327,7 @@ private fun TransitionTextPreview() { @PreviewLightDark @Composable private fun TransitionTextLongTitlePreview() { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface(modifier = Modifier.padding(48.dp)) { ChapterTransition( transition = ChapterTransition.Next( @@ -344,7 +344,7 @@ private fun TransitionTextLongTitlePreview() { @PreviewLightDark @Composable private fun TransitionTextWithGapPreview() { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface(modifier = Modifier.padding(48.dp)) { ChapterTransition( transition = ChapterTransition.Next( @@ -361,7 +361,7 @@ private fun TransitionTextWithGapPreview() { @PreviewLightDark @Composable private fun TransitionTextNoNextPreview() { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface(modifier = Modifier.padding(48.dp)) { ChapterTransition( transition = ChapterTransition.Next(ReaderChapter(FakeChapter), null), @@ -375,7 +375,7 @@ private fun TransitionTextNoNextPreview() { @PreviewLightDark @Composable private fun TransitionTextNoPreviousPreview() { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface(modifier = Modifier.padding(48.dp)) { ChapterTransition( transition = ChapterTransition.Prev(ReaderChapter(FakeChapter), null), diff --git a/app/src/main/java/eu/kanade/presentation/reader/OrientationSelectDialog.kt b/app/src/main/java/eu/kanade/presentation/reader/OrientationSelectDialog.kt index 82c9989564..20c154cce2 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/OrientationSelectDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/OrientationSelectDialog.kt @@ -16,7 +16,7 @@ import dev.icerock.moko.resources.StringResource import eu.kanade.domain.entries.manga.model.readerOrientation import eu.kanade.presentation.components.AdaptiveSheet import eu.kanade.presentation.reader.components.ModeSelectionDialog -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import eu.kanade.tachiyomi.ui.reader.setting.ReaderOrientation import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel import tachiyomi.i18n.MR @@ -85,7 +85,7 @@ private fun DialogContent( @PreviewLightDark @Composable private fun DialogContentPreview() { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface { Column { DialogContent( diff --git a/app/src/main/java/eu/kanade/presentation/reader/PageIndicatorText.kt b/app/src/main/java/eu/kanade/presentation/reader/PageIndicatorText.kt index 48998d165d..fc1b6f7167 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/PageIndicatorText.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/PageIndicatorText.kt @@ -12,7 +12,7 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.sp -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme @Composable fun PageIndicatorText( @@ -52,7 +52,7 @@ fun PageIndicatorText( @PreviewLightDark @Composable private fun PageIndicatorTextPreview() { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface { PageIndicatorText(currentPage = 10, totalPages = 69) } diff --git a/app/src/main/java/eu/kanade/presentation/reader/ReadingModeSelectDialog.kt b/app/src/main/java/eu/kanade/presentation/reader/ReadingModeSelectDialog.kt index 50b5333acd..7d9fd928d7 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/ReadingModeSelectDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/ReadingModeSelectDialog.kt @@ -18,7 +18,7 @@ import dev.icerock.moko.resources.StringResource import eu.kanade.domain.entries.manga.model.readingMode import eu.kanade.presentation.components.AdaptiveSheet import eu.kanade.presentation.reader.components.ModeSelectionDialog -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode import tachiyomi.i18n.MR @@ -83,7 +83,7 @@ private fun DialogContent( @PreviewLightDark @Composable private fun DialogContentPreview() { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface { Column { DialogContent( diff --git a/app/src/main/java/eu/kanade/presentation/reader/components/ModeSelectionDialog.kt b/app/src/main/java/eu/kanade/presentation/reader/components/ModeSelectionDialog.kt index 683534e9af..c6286bf22d 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/components/ModeSelectionDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/components/ModeSelectionDialog.kt @@ -19,7 +19,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.dp -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.SettingsItemsPaddings import tachiyomi.presentation.core.components.material.padding @@ -70,7 +70,7 @@ fun ModeSelectionDialog( @PreviewLightDark @Composable private fun Preview() { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface { Column { ModeSelectionDialog( diff --git a/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt b/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt index 18e07e1a05..75b91978cc 100644 --- a/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt +++ b/app/src/main/java/eu/kanade/presentation/theme/TachiyomiTheme.kt @@ -34,9 +34,30 @@ fun TachiyomiTheme( appTheme: AppTheme? = null, amoled: Boolean? = null, content: @Composable () -> Unit, +) { + val uiPreferences = Injekt.get() + BaseTachiyomiTheme( + appTheme = appTheme ?: uiPreferences.appTheme().get(), + isAmoled = amoled ?: uiPreferences.themeDarkAmoled().get(), + content = content, + ) +} + +@Composable +fun TachiyomiPreviewTheme( + appTheme: AppTheme = AppTheme.DEFAULT, + isAmoled: Boolean = false, + content: @Composable () -> Unit, +) = BaseTachiyomiTheme(appTheme, isAmoled, content) + +@Composable +private fun BaseTachiyomiTheme( + appTheme: AppTheme, + isAmoled: Boolean, + content: @Composable () -> Unit, ) { MaterialTheme( - colorScheme = getThemeColorScheme(appTheme, amoled), + colorScheme = getThemeColorScheme(appTheme, isAmoled), content = content, ) } @@ -44,11 +65,11 @@ fun TachiyomiTheme( @Composable @ReadOnlyComposable private fun getThemeColorScheme( - appTheme: AppTheme?, - amoled: Boolean?, + appTheme: AppTheme, + isAmoled: Boolean, ): ColorScheme { val uiPreferences = Injekt.get() - val colorScheme = when (appTheme ?: uiPreferences.appTheme().get()) { + val colorScheme = when (appTheme) { AppTheme.DEFAULT -> TachiyomiColorScheme AppTheme.MONET -> MonetColorScheme(LocalContext.current) AppTheme.CLOUDFLARE -> CloudflareColorScheme @@ -71,6 +92,6 @@ private fun getThemeColorScheme( } return colorScheme.getColorScheme( isSystemInDarkTheme(), - amoled ?: uiPreferences.themeDarkAmoled().get(), + isAmoled, ) } diff --git a/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogSelector.kt b/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogSelector.kt index c93fc3dde4..a1f9a496f6 100644 --- a/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogSelector.kt +++ b/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogSelector.kt @@ -32,7 +32,7 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.dp import dev.icerock.moko.resources.StringResource -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentMapOf import kotlinx.collections.immutable.toImmutableList @@ -244,7 +244,7 @@ fun BaseSelector( @PreviewLightDark @Composable private fun TrackStatusSelectorPreviews() { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface { TrackStatusSelector( selection = 1, diff --git a/app/src/main/java/eu/kanade/presentation/track/anime/AnimeTrackInfoDialogHome.kt b/app/src/main/java/eu/kanade/presentation/track/anime/AnimeTrackInfoDialogHome.kt index 35dfe48187..3a9fffce5a 100644 --- a/app/src/main/java/eu/kanade/presentation/track/anime/AnimeTrackInfoDialogHome.kt +++ b/app/src/main/java/eu/kanade/presentation/track/anime/AnimeTrackInfoDialogHome.kt @@ -34,7 +34,7 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import dev.icerock.moko.resources.StringResource -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import eu.kanade.presentation.track.components.TrackLogoIcon import eu.kanade.presentation.track.manga.TrackDetailsItem import eu.kanade.presentation.track.manga.TrackInfoItemMenu @@ -255,5 +255,5 @@ private fun TrackInfoDialogHomePreviews( @PreviewParameter(AnimeTrackInfoDialogHomePreviewProvider::class) content: @Composable () -> Unit, ) { - TachiyomiTheme { content() } + TachiyomiPreviewTheme { content() } } diff --git a/app/src/main/java/eu/kanade/presentation/track/anime/AnimeTrackerSearch.kt b/app/src/main/java/eu/kanade/presentation/track/anime/AnimeTrackerSearch.kt index 912f6c2f92..a932c78f12 100644 --- a/app/src/main/java/eu/kanade/presentation/track/anime/AnimeTrackerSearch.kt +++ b/app/src/main/java/eu/kanade/presentation/track/anime/AnimeTrackerSearch.kt @@ -69,7 +69,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import eu.kanade.presentation.components.DropdownMenu import eu.kanade.presentation.entries.components.ItemCover -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import eu.kanade.tachiyomi.data.track.model.AnimeTrackSearch import eu.kanade.tachiyomi.util.system.openInBrowser import tachiyomi.i18n.MR @@ -383,7 +383,7 @@ private fun TrackerSearchPreviews( @PreviewParameter(AnimeTrackerSearchPreviewProvider::class) content: @Composable () -> Unit, ) { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface { content() } diff --git a/app/src/main/java/eu/kanade/presentation/track/components/TrackLogoIcon.kt b/app/src/main/java/eu/kanade/presentation/track/components/TrackLogoIcon.kt index 835cce95c8..4dd03ecc71 100644 --- a/app/src/main/java/eu/kanade/presentation/track/components/TrackLogoIcon.kt +++ b/app/src/main/java/eu/kanade/presentation/track/components/TrackLogoIcon.kt @@ -14,7 +14,7 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import eu.kanade.tachiyomi.data.track.Tracker import tachiyomi.presentation.core.util.clickableNoIndication @@ -49,7 +49,7 @@ private fun TrackLogoIconPreviews( @PreviewParameter(TrackLogoIconPreviewProvider::class) tracker: Tracker, ) { - TachiyomiTheme { + TachiyomiPreviewTheme { TrackLogoIcon( tracker = tracker, onClick = null, diff --git a/app/src/main/java/eu/kanade/presentation/track/manga/MangaTrackInfoDialogHome.kt b/app/src/main/java/eu/kanade/presentation/track/manga/MangaTrackInfoDialogHome.kt index 7dfa770987..6993dabb21 100644 --- a/app/src/main/java/eu/kanade/presentation/track/manga/MangaTrackInfoDialogHome.kt +++ b/app/src/main/java/eu/kanade/presentation/track/manga/MangaTrackInfoDialogHome.kt @@ -47,7 +47,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import dev.icerock.moko.resources.StringResource import eu.kanade.presentation.components.DropdownMenu -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import eu.kanade.presentation.track.components.TrackLogoIcon import eu.kanade.tachiyomi.data.track.Tracker import eu.kanade.tachiyomi.ui.entries.manga.track.MangaTrackItem @@ -326,5 +326,5 @@ private fun TrackInfoDialogHomePreviews( @PreviewParameter(MangaTrackInfoDialogHomePreviewProvider::class) content: @Composable () -> Unit, ) { - TachiyomiTheme { content() } + TachiyomiPreviewTheme { content() } } diff --git a/app/src/main/java/eu/kanade/presentation/track/manga/MangaTrackerSearch.kt b/app/src/main/java/eu/kanade/presentation/track/manga/MangaTrackerSearch.kt index da73695b50..69d8631a57 100644 --- a/app/src/main/java/eu/kanade/presentation/track/manga/MangaTrackerSearch.kt +++ b/app/src/main/java/eu/kanade/presentation/track/manga/MangaTrackerSearch.kt @@ -69,7 +69,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import eu.kanade.presentation.components.DropdownMenu import eu.kanade.presentation.entries.components.ItemCover -import eu.kanade.presentation.theme.TachiyomiTheme +import eu.kanade.presentation.theme.TachiyomiPreviewTheme import eu.kanade.tachiyomi.data.track.model.MangaTrackSearch import eu.kanade.tachiyomi.util.system.openInBrowser import tachiyomi.i18n.MR @@ -383,7 +383,7 @@ private fun TrackerSearchPreviews( @PreviewParameter(MangaTrackerSearchPreviewProvider::class) content: @Composable () -> Unit, ) { - TachiyomiTheme { + TachiyomiPreviewTheme { Surface { content() } From ee2a62a19b222b4fcf74825a92f56aed68d17bd2 Mon Sep 17 00:00:00 2001 From: Secozzi Date: Wed, 8 May 2024 16:07:59 +0200 Subject: [PATCH 02/14] Fix extension interceptors receiving compressed responses (#10388) Co-authored-by: stevenyomi <95685115+stevenyomi@users.noreply.github.com> --- .../kanade/tachiyomi/network/NetworkHelper.kt | 4 +++- .../interceptor/IgnoreGzipInterceptor.kt | 21 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 core/src/main/java/eu/kanade/tachiyomi/network/interceptor/IgnoreGzipInterceptor.kt diff --git a/core/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt b/core/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt index 1c270269fb..1ad5dabcbe 100644 --- a/core/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt +++ b/core/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt @@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.network import android.content.Context import eu.kanade.tachiyomi.network.interceptor.CloudflareInterceptor +import eu.kanade.tachiyomi.network.interceptor.IgnoreGzipInterceptor import eu.kanade.tachiyomi.network.interceptor.UncaughtExceptionInterceptor import eu.kanade.tachiyomi.network.interceptor.UserAgentInterceptor import okhttp3.Cache @@ -30,9 +31,10 @@ class NetworkHelper( maxSize = 5L * 1024 * 1024, // 5 MiB ), ) - .addInterceptor(BrotliInterceptor) .addInterceptor(UncaughtExceptionInterceptor()) .addInterceptor(UserAgentInterceptor(::defaultUserAgentProvider)) + .addNetworkInterceptor(IgnoreGzipInterceptor()) + .addNetworkInterceptor(BrotliInterceptor) if (preferences.verboseLogging().get()) { val httpLoggingInterceptor = HttpLoggingInterceptor().apply { diff --git a/core/src/main/java/eu/kanade/tachiyomi/network/interceptor/IgnoreGzipInterceptor.kt b/core/src/main/java/eu/kanade/tachiyomi/network/interceptor/IgnoreGzipInterceptor.kt new file mode 100644 index 0000000000..f1331a5766 --- /dev/null +++ b/core/src/main/java/eu/kanade/tachiyomi/network/interceptor/IgnoreGzipInterceptor.kt @@ -0,0 +1,21 @@ +package eu.kanade.tachiyomi.network.interceptor + +import okhttp3.Interceptor +import okhttp3.Response + +/** + * To use [okhttp3.brotli.BrotliInterceptor] as a network interceptor, + * add [IgnoreGzipInterceptor] right before it. + * + * This nullifies the transparent gzip of [okhttp3.internal.http.BridgeInterceptor] + * so gzip and Brotli are explicitly handled by the [okhttp3.brotli.BrotliInterceptor]. + */ +class IgnoreGzipInterceptor : Interceptor { + override fun intercept(chain: Interceptor.Chain): Response { + var request = chain.request() + if (request.header("Accept-Encoding") == "gzip") { + request = request.newBuilder().removeHeader("Accept-Encoding").build() + } + return chain.proceed(request) + } +} From 28e70ffd5d68f1c09fb72477927476f616307e5f Mon Sep 17 00:00:00 2001 From: Secozzi Date: Wed, 8 May 2024 16:14:23 +0200 Subject: [PATCH 03/14] Use transaction on restore to go brr. (#10375) refactor: use transaction to go brr. This improve the restore speed on fresh db and non fresh db. Co-authored-by: KaiserBh <41852205+kaiserbh@users.noreply.github.com> --- .../backup/restore/restorers/AnimeRestorer.kt | 32 +++++++++--------- .../backup/restore/restorers/MangaRestorer.kt | 33 ++++++++++--------- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/AnimeRestorer.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/AnimeRestorer.kt index 9dac081ee4..aa88fdb8d9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/AnimeRestorer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/AnimeRestorer.kt @@ -57,22 +57,24 @@ class AnimeRestorer( backupAnime: BackupAnime, backupCategories: List, ) { - val dbAnime = findExistingAnime(backupAnime) - val anime = backupAnime.getAnimeImpl() - val restoredAnime = if (dbAnime == null) { - restoreNewAnime(anime) - } else { - restoreExistingAnime(anime, dbAnime) - } + handler.await(inTransaction = true) { + val dbAnime = findExistingAnime(backupAnime) + val anime = backupAnime.getAnimeImpl() + val restoredAnime = if (dbAnime == null) { + restoreNewAnime(anime) + } else { + restoreExistingAnime(anime, dbAnime) + } - restoreAnimeDetails( - anime = restoredAnime, - episodes = backupAnime.episodes, - categories = backupAnime.categories, - backupCategories = backupCategories, - history = backupAnime.history + backupAnime.brokenHistory.map { it.toBackupHistory() }, - tracks = backupAnime.tracking, - ) + restoreAnimeDetails( + anime = restoredAnime, + episodes = backupAnime.episodes, + categories = backupAnime.categories, + backupCategories = backupCategories, + history = backupAnime.history + backupAnime.brokenHistory.map { it.toBackupHistory() }, + tracks = backupAnime.tracking, + ) + } } private suspend fun findExistingAnime(backupAnime: BackupAnime): Anime? { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt index 2932ba050d..f0e255359c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt @@ -57,22 +57,25 @@ class MangaRestorer( backupManga: BackupManga, backupCategories: List, ) { - val dbManga = findExistingManga(backupManga) - val manga = backupManga.getMangaImpl() - val restoredManga = if (dbManga == null) { - restoreNewManga(manga) - } else { - restoreExistingManga(manga, dbManga) - } + handler.await(inTransaction = true) { + val dbManga = findExistingManga(backupManga) + val manga = backupManga.getMangaImpl() + val restoredManga = if (dbManga == null) { + restoreNewManga(manga) + } else { + restoreExistingManga(manga, dbManga) + } - restoreMangaDetails( - manga = restoredManga, - chapters = backupManga.chapters, - categories = backupManga.categories, - backupCategories = backupCategories, - history = backupManga.history + backupManga.brokenHistory.map { it.toBackupHistory() }, - tracks = backupManga.tracking, - ) + + restoreMangaDetails( + manga = restoredManga, + chapters = backupManga.chapters, + categories = backupManga.categories, + backupCategories = backupCategories, + history = backupManga.history + backupManga.brokenHistory.map { it.toBackupHistory() }, + tracks = backupManga.tracking, + ) + } } private suspend fun findExistingManga(backupManga: BackupManga): Manga? { From 6ea76e0dbce341a1d78f2bce7652939de86d72f9 Mon Sep 17 00:00:00 2001 From: Secozzi Date: Wed, 8 May 2024 16:18:39 +0200 Subject: [PATCH 04/14] [download-cache] Fixed init logic to skip when cache file is missing (#10362) There are several possible causes of the cache file to not exist, including user action. By skipping these couple steps during initialization when the file is missing, a renew action is allowed to start and the cache will rebuild and hopefully work as expected. Co-authored-by: Caleb Morris <347395+CalebMorris@users.noreply.github.com> --- .../data/download/anime/AnimeDownloadCache.kt | 11 +++++++---- .../data/download/manga/MangaDownloadCache.kt | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadCache.kt index 176099cd6f..b40686e781 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/anime/AnimeDownloadCache.kt @@ -94,12 +94,15 @@ class AnimeDownloadCache( scope.launch { rootDownloadsDirLock.withLock { try { - val diskCache = diskCacheFile.inputStream().use { - ProtoBuf.decodeFromByteArray(it.readBytes()) + if (diskCacheFile.exists()) { + val diskCache = diskCacheFile.inputStream().use { + ProtoBuf.decodeFromByteArray(it.readBytes()) + } + rootDownloadsDir = diskCache + lastRenew = System.currentTimeMillis() } - rootDownloadsDir = diskCache - lastRenew = System.currentTimeMillis() } catch (e: Throwable) { + logcat(LogPriority.ERROR, e) { "Failed to initialize disk cache" } diskCacheFile.delete() } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadCache.kt index ecf28e5a0b..54cece8bbb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/manga/MangaDownloadCache.kt @@ -105,12 +105,15 @@ class MangaDownloadCache( scope.launch { rootDownloadsDirLock.withLock { try { - val diskCache = diskCacheFile.inputStream().use { - ProtoBuf.decodeFromByteArray(it.readBytes()) + if (diskCacheFile.exists()) { + val diskCache = diskCacheFile.inputStream().use { + ProtoBuf.decodeFromByteArray(it.readBytes()) + } + rootDownloadsDir = diskCache + lastRenew = System.currentTimeMillis() } - rootDownloadsDir = diskCache - lastRenew = System.currentTimeMillis() } catch (e: Throwable) { + logcat(LogPriority.ERROR, e) { "Failed to initialize disk cache" } diskCacheFile.delete() } } From 9fb5e81702a8bfa570061383365fa3dde4f87d28 Mon Sep 17 00:00:00 2001 From: "Weblate (bot)" Date: Fri, 12 Jan 2024 00:24:00 +0100 Subject: [PATCH 05/14] Translations update from Hosted Weblate (#10386) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Weblate translations Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/cs/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/de/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/el/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/eo/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/es/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/fil/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/fr/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/hr/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/id/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ja/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ko/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ms/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ne/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pt/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pt_BR/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ru/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sv/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/te/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/th/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/tr/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/zh_Hans/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/zh_Hant/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/tachiyomi-plurals-xml/cs/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/tachiyomi-plurals-xml/de/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/tachiyomi-plurals-xml/el/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/tachiyomi-plurals-xml/hr/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/tachiyomi-plurals-xml/ja/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/tachiyomi-plurals-xml/ms/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/tachiyomi-plurals-xml/ne/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/tachiyomi-plurals-xml/pt/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/tachiyomi-plurals-xml/zh_Hans/ Translation: Tachiyomi/Tachiyomi plurals.xml Translation: Tachiyomi/Tachiyomi strings.xml Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com> Co-authored-by: Andreas E Co-authored-by: CodeSpoof Co-authored-by: Crazyom Co-authored-by: Daedren Co-authored-by: DarKCroX Co-authored-by: Dexroneum Co-authored-by: Gianluca Starke Co-authored-by: ID-86 Co-authored-by: InfinityDouki56 Co-authored-by: Khori Hutama Co-authored-by: Kirito ._ Co-authored-by: Lyfja Co-authored-by: Lzmxya Co-authored-by: Manjul Tamrakar Co-authored-by: Milo Ivir Co-authored-by: Oğuz Ersen Co-authored-by: Paavalen Lingachetti Co-authored-by: Pitpe11 Co-authored-by: Radoŝ Porka Co-authored-by: Sup Kelelawar Co-authored-by: Swyter Co-authored-by: Uzuki Shimamura Co-authored-by: Zero O Co-authored-by: altinat Co-authored-by: dan-malprod Co-authored-by: jinu147 Co-authored-by: orkan gökçe alaz aşina Co-authored-by: stevenlele (cherry picked from commit 6e822dfd5b12a1560bb79723008ed3146ce0bcc0) --- i18n/src/commonMain/resources/MR/eo/strings.xml | 10 +++++----- i18n/src/commonMain/resources/MR/ja/plurals.xml | 3 +++ i18n/src/commonMain/resources/MR/ms/plurals.xml | 3 +++ i18n/src/commonMain/resources/MR/pt/strings.xml | 4 ++-- i18n/src/commonMain/resources/MR/te/strings.xml | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/i18n/src/commonMain/resources/MR/eo/strings.xml b/i18n/src/commonMain/resources/MR/eo/strings.xml index 9d3009097e..81d2eeb7e0 100644 --- a/i18n/src/commonMain/resources/MR/eo/strings.xml +++ b/i18n/src/commonMain/resources/MR/eo/strings.xml @@ -7,13 +7,13 @@ Agordoj Pli Nomo - Neniuj ĝisdatigoj + Neniuj lastatempaj ĝisdatigoj Neniu elŝuto Asistado - Konektprogramaro Informaĵo + Informoj de aldonaĵo Aldonaĵoj Migri - Arkivi kaj restaŭri + Savkopii kaj restaŭri Retejo Uzantnomo Pasvorto @@ -51,7 +51,7 @@ Biblioteka kontribuoj Kategorioj Via biblioteko malplenas - Neniu legita laste + Neniu legita lastatempe Kaŝi enhavon de sciigoj Neniam Ĉiam @@ -345,7 +345,7 @@ Laŭ elŝuta dato Elekti inverse Defaŭlte - Vi havas neniun kategorion. Tuŝeti la butonon kun plus por krei unu por organizi vian bibliotekon. + Vi havas neniun kategorion. Tuŝeti la butonon kun plus, por krei unu kaj organizi vian bibliotekon. Kromaĵaj ĝisdatigoj Elŝutilo Por ĉi-serion diff --git a/i18n/src/commonMain/resources/MR/ja/plurals.xml b/i18n/src/commonMain/resources/MR/ja/plurals.xml index 6f580782e0..2e250027a6 100644 --- a/i18n/src/commonMain/resources/MR/ja/plurals.xml +++ b/i18n/src/commonMain/resources/MR/ja/plurals.xml @@ -45,4 +45,7 @@ %d日 + + %dリポジトリ + \ No newline at end of file diff --git a/i18n/src/commonMain/resources/MR/ms/plurals.xml b/i18n/src/commonMain/resources/MR/ms/plurals.xml index 59560ccea6..2883523c20 100644 --- a/i18n/src/commonMain/resources/MR/ms/plurals.xml +++ b/i18n/src/commonMain/resources/MR/ms/plurals.xml @@ -45,4 +45,7 @@ %d hari + + %d repositori + \ No newline at end of file diff --git a/i18n/src/commonMain/resources/MR/pt/strings.xml b/i18n/src/commonMain/resources/MR/pt/strings.xml index 32cb1eb88a..2c860e84fa 100644 --- a/i18n/src/commonMain/resources/MR/pt/strings.xml +++ b/i18n/src/commonMain/resources/MR/pt/strings.xml @@ -683,11 +683,11 @@ Próxima atualização esperada Definido para atualizar a cada Pulado, pois nenhum lançamento é esperado para hoje - Deletar dowloand + Apagar download Selecionado Não selecionado Mais opções - Rolar para cima + Navegar para cima Desbloquear %s Dados e armazenamento Categorias de Mangá diff --git a/i18n/src/commonMain/resources/MR/te/strings.xml b/i18n/src/commonMain/resources/MR/te/strings.xml index eeeba4b543..667c73ca4c 100644 --- a/i18n/src/commonMain/resources/MR/te/strings.xml +++ b/i18n/src/commonMain/resources/MR/te/strings.xml @@ -160,7 +160,7 @@ సిరీస్ పైన పెట్టండి అన్వేషించండి… ఇప్పుడు కాదు - "ఏదైనా తెరవండి" + ఏదైనా తెరవండి అంతర్గత లోపం: మరింత సమాచారం కోసం క్రాష్ లాగ్‌లను తనిఖీ చేయండి థీమ్, తేదీ మరియు సమయ ఆకృతి లోపాలూ From 104291a83c3f55ba1526d8625dc206e1bf205035 Mon Sep 17 00:00:00 2001 From: Secozzi Date: Wed, 8 May 2024 16:36:05 +0200 Subject: [PATCH 06/14] Minor extension repo enhancements - Shortcut to settings from extensions tab - Don't show error toast anymore if nothing's loaded - Ability to copy extension repo URL to clipboard Co-authored-by: arkon <4098258+arkon@users.noreply.github.com> --- .../presentation/components/TabbedScreen.kt | 2 +- .../components/ExtensionReposContent.kt | 25 ++++++++++++++++++- .../extension/anime/api/AnimeExtensionApi.kt | 10 +------- .../extension/manga/api/MangaExtensionApi.kt | 10 +------- .../anime/extension/AnimeExtensionsTab.kt | 12 +++++---- .../manga/extension/MangaExtensionsTab.kt | 10 +++++--- 6 files changed, 40 insertions(+), 29 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/components/TabbedScreen.kt b/app/src/main/java/eu/kanade/presentation/components/TabbedScreen.kt index bbd8fbcb8b..d9b41f3b2b 100644 --- a/app/src/main/java/eu/kanade/presentation/components/TabbedScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/components/TabbedScreen.kt @@ -133,7 +133,7 @@ data class TabContent( val titleRes: StringResource, val badgeNumber: Int? = null, val searchEnabled: Boolean = false, - val actions: ImmutableList = persistentListOf(), + val actions: ImmutableList = persistentListOf(), val content: @Composable (contentPadding: PaddingValues, snackbarHostState: SnackbarHostState) -> Unit, val numberTitle: Int = 0, val cancelAction: () -> Unit = {}, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt index 3d4772836e..be6a04ff60 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt @@ -9,6 +9,7 @@ import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyListState import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.outlined.Label +import androidx.compose.material.icons.outlined.ContentCopy import androidx.compose.material.icons.outlined.Delete import androidx.compose.material3.ElevatedCard import androidx.compose.material3.Icon @@ -18,8 +19,13 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import eu.kanade.tachiyomi.util.system.copyToClipboard import kotlinx.collections.immutable.ImmutableSet +import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.padding +import tachiyomi.presentation.core.i18n.stringResource + @Composable fun ExtensionReposContent( @@ -53,6 +59,8 @@ private fun ExtensionRepoListItem( onDelete: () -> Unit, modifier: Modifier = Modifier, ) { + val context = LocalContext.current + ElevatedCard( modifier = modifier, ) { @@ -74,8 +82,23 @@ private fun ExtensionRepoListItem( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.End, ) { + IconButton( + onClick = { + val url = "$repo/index.min.json" + context.copyToClipboard(url, url) + }, + ) { + Icon( + imageVector = Icons.Outlined.ContentCopy, + contentDescription = stringResource(MR.strings.action_copy_to_clipboard), + ) + } + IconButton(onClick = onDelete) { - Icon(imageVector = Icons.Outlined.Delete, contentDescription = null) + Icon( + imageVector = Icons.Outlined.Delete, + contentDescription = stringResource(MR.strings.action_delete), + ) } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/anime/api/AnimeExtensionApi.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/anime/api/AnimeExtensionApi.kt index e920d52a73..54a2080b3e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/anime/api/AnimeExtensionApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/anime/api/AnimeExtensionApi.kt @@ -37,18 +37,10 @@ internal class AnimeExtensionApi { suspend fun findExtensions(): List { return withIOContext { - val extensions = buildList { + buildList { addAll(getExtensions(OFFICIAL_ANIYOMI_REPO_BASE_URL)) sourcePreferences.animeExtensionRepos().get().map { addAll(getExtensions(it)) } } - - // Sanity check - a small number of extensions probably means something broke - // with the repo generator - if (extensions.size < 50) { - throw Exception() - } - - extensions } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/manga/api/MangaExtensionApi.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/manga/api/MangaExtensionApi.kt index c734466eb7..8e888a1d99 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/manga/api/MangaExtensionApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/manga/api/MangaExtensionApi.kt @@ -36,15 +36,7 @@ internal class MangaExtensionApi { suspend fun findExtensions(): List { return withIOContext { - val extensions = sourcePreferences.mangaExtensionRepos().get().flatMap { getExtensions(it) } - - // Sanity check - a small number of extensions probably means something broke - // with the repo generator - if (extensions.isEmpty()) { - throw Exception() - } - - extensions + sourcePreferences.mangaExtensionRepos().get().flatMap { getExtensions(it) } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/anime/extension/AnimeExtensionsTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/anime/extension/AnimeExtensionsTab.kt index 27aeffe11e..ac0eaabb29 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/anime/extension/AnimeExtensionsTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/anime/extension/AnimeExtensionsTab.kt @@ -1,7 +1,5 @@ package eu.kanade.tachiyomi.ui.browse.anime.extension -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.outlined.Translate import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue @@ -10,6 +8,7 @@ import cafe.adriel.voyager.navigator.currentOrThrow import eu.kanade.presentation.browse.anime.AnimeExtensionScreen import eu.kanade.presentation.components.AppBar import eu.kanade.presentation.components.TabContent +import eu.kanade.presentation.more.settings.screen.browse.AnimeExtensionReposScreen import eu.kanade.tachiyomi.extension.anime.model.AnimeExtension import eu.kanade.tachiyomi.ui.browse.anime.extension.details.AnimeExtensionDetailsScreen import eu.kanade.tachiyomi.ui.webview.WebViewScreen @@ -29,15 +28,18 @@ fun animeExtensionsTab( badgeNumber = state.updates.takeIf { it > 0 }, searchEnabled = true, actions = persistentListOf( - AppBar.Action( + AppBar.OverflowAction( title = stringResource(MR.strings.action_filter), - icon = Icons.Outlined.Translate, onClick = { navigator.push( - eu.kanade.tachiyomi.ui.browse.anime.extension.AnimeExtensionFilterScreen(), + AnimeExtensionFilterScreen(), ) }, ), + AppBar.OverflowAction( + title = stringResource(MR.strings.label_extension_repos), + onClick = { navigator.push(AnimeExtensionReposScreen()) }, + ), ), content = { contentPadding, _ -> AnimeExtensionScreen( diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/manga/extension/MangaExtensionsTab.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/manga/extension/MangaExtensionsTab.kt index 1371d2b0f8..df65393531 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/manga/extension/MangaExtensionsTab.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/manga/extension/MangaExtensionsTab.kt @@ -1,7 +1,5 @@ package eu.kanade.tachiyomi.ui.browse.manga.extension -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.outlined.Translate import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue @@ -10,6 +8,7 @@ import cafe.adriel.voyager.navigator.currentOrThrow import eu.kanade.presentation.browse.manga.MangaExtensionScreen import eu.kanade.presentation.components.AppBar import eu.kanade.presentation.components.TabContent +import eu.kanade.presentation.more.settings.screen.browse.MangaExtensionReposScreen import eu.kanade.tachiyomi.extension.manga.model.MangaExtension import eu.kanade.tachiyomi.ui.browse.manga.extension.details.MangaExtensionDetailsScreen import eu.kanade.tachiyomi.ui.webview.WebViewScreen @@ -29,11 +28,14 @@ fun mangaExtensionsTab( badgeNumber = state.updates.takeIf { it > 0 }, searchEnabled = true, actions = persistentListOf( - AppBar.Action( + AppBar.OverflowAction( title = stringResource(MR.strings.action_filter), - icon = Icons.Outlined.Translate, onClick = { navigator.push(MangaExtensionFilterScreen()) }, ), + AppBar.OverflowAction( + title = stringResource(MR.strings.label_extension_repos), + onClick = { navigator.push(MangaExtensionReposScreen()) }, + ), ), content = { contentPadding, _ -> MangaExtensionScreen( From 5f5915b25cc588561fdf34a416ed2c2538c387a0 Mon Sep 17 00:00:00 2001 From: Secozzi Date: Wed, 8 May 2024 16:38:52 +0200 Subject: [PATCH 07/14] Fixed tap controls not working when zoomed in (#10378) Co-authored-by: Paloys <40764414+Paloys@users.noreply.github.com> Co-authored-by: arkon <4098258+arkon@users.noreply.github.com> --- .../tachiyomi/ui/reader/viewer/pager/PagerViewer.kt | 9 ++++++++- .../tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt index ef4b8b3235..284da59669 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt @@ -102,7 +102,14 @@ abstract class PagerViewer(val activity: ReaderActivity) : Viewer { }, ) pager.tapListener = { event -> - val pos = PointF(event.x / pager.width, event.y / pager.height) + val viewPosition = IntArray(2) + pager.getLocationOnScreen(viewPosition) + val viewPositionRelativeToWindow = IntArray(2) + pager.getLocationInWindow(viewPositionRelativeToWindow) + val pos = PointF( + (event.rawX - viewPosition[0] + viewPositionRelativeToWindow[0]) / pager.width, + (event.rawY - viewPosition[1] + viewPositionRelativeToWindow[1]) / pager.height, + ) when (config.navigator.getAction(pos)) { NavigationRegion.MENU -> activity.toggleMenu() NavigationRegion.NEXT -> moveToNext() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt index 12dc201e87..9737f22df5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt @@ -111,7 +111,14 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr }, ) recycler.tapListener = { event -> - val pos = PointF(event.y / recycler.width, event.y / recycler.height) + val viewPosition = IntArray(2) + recycler.getLocationOnScreen(viewPosition) + val viewPositionRelativeToWindow = IntArray(2) + recycler.getLocationInWindow(viewPositionRelativeToWindow) + val pos = PointF( + (event.rawX - viewPosition[0] + viewPositionRelativeToWindow[0]) / recycler.width, + (event.rawY - viewPosition[1] + viewPositionRelativeToWindow[1]) / recycler.height, + ) when (config.navigator.getAction(pos)) { NavigationRegion.MENU -> activity.toggleMenu() NavigationRegion.NEXT, NavigationRegion.RIGHT -> scrollDown() From 93d4315722e75f0117ee0c4f07f1ad1e035fd170 Mon Sep 17 00:00:00 2001 From: Secozzi Date: Wed, 8 May 2024 16:48:02 +0200 Subject: [PATCH 08/14] Update Compose compiler and Kotlin Co-authored-by: arkon <4098258+arkon@users.noreply.github.com> --- gradle/compose.versions.toml | 2 +- gradle/kotlinx.versions.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/compose.versions.toml b/gradle/compose.versions.toml index 0503a9e8d4..3fa4daa3f6 100644 --- a/gradle/compose.versions.toml +++ b/gradle/compose.versions.toml @@ -1,5 +1,5 @@ [versions] -compiler = "1.5.7" +compiler = "1.5.8" compose-bom = "2023.12.00-alpha04" accompanist = "0.33.2-alpha" diff --git a/gradle/kotlinx.versions.toml b/gradle/kotlinx.versions.toml index 924590cd74..114c2a35a8 100644 --- a/gradle/kotlinx.versions.toml +++ b/gradle/kotlinx.versions.toml @@ -1,5 +1,5 @@ [versions] -kotlin_version = "1.9.21" +kotlin_version = "1.9.22" serialization_version = "1.6.2" xml_serialization_version = "0.86.3" From 6f5172f904e0131190631d48fa8078249f7deb39 Mon Sep 17 00:00:00 2001 From: Secozzi Date: Wed, 8 May 2024 16:53:41 +0200 Subject: [PATCH 09/14] Better message for empty extensions list Co-authored-by: arkon <4098258+arkon@users.noreply.github.com> --- .../browse/anime/AnimeExtensionsScreen.kt | 14 ++++++++++++++ .../browse/manga/MangaExtensionsScreen.kt | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/app/src/main/java/eu/kanade/presentation/browse/anime/AnimeExtensionsScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/anime/AnimeExtensionsScreen.kt index ddd0603fa2..e5be41c43c 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/anime/AnimeExtensionsScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/anime/AnimeExtensionsScreen.kt @@ -38,6 +38,8 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp +import cafe.adriel.voyager.navigator.LocalNavigator +import cafe.adriel.voyager.navigator.currentOrThrow import eu.kanade.core.util.fastDistinctBy import eu.kanade.presentation.browse.BaseBrowseItem import eu.kanade.presentation.browse.anime.components.AnimeExtensionIcon @@ -45,6 +47,7 @@ import eu.kanade.presentation.browse.manga.ExtensionHeader import eu.kanade.presentation.browse.manga.ExtensionTrustDialog import eu.kanade.presentation.components.WarningBanner import eu.kanade.presentation.entries.components.DotSeparatorNoSpaceText +import eu.kanade.presentation.more.settings.screen.browse.AnimeExtensionReposScreen import eu.kanade.presentation.util.rememberRequestPackageInstallsPermissionState import eu.kanade.tachiyomi.extension.InstallStep import eu.kanade.tachiyomi.extension.anime.model.AnimeExtension @@ -52,6 +55,7 @@ import eu.kanade.tachiyomi.ui.browse.anime.extension.AnimeExtensionUiModel import eu.kanade.tachiyomi.ui.browse.anime.extension.AnimeExtensionsScreenModel import eu.kanade.tachiyomi.util.system.LocaleHelper import eu.kanade.tachiyomi.util.system.launchRequestPackageInstallsPermission +import kotlinx.collections.immutable.persistentListOf import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.FastScrollLazyColumn import tachiyomi.presentation.core.components.material.PullRefresh @@ -59,6 +63,7 @@ import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.topSmallPaddingValues import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.screens.EmptyScreen +import tachiyomi.presentation.core.screens.EmptyScreenAction import tachiyomi.presentation.core.screens.LoadingScreen import tachiyomi.presentation.core.util.plus import tachiyomi.presentation.core.util.secondaryItemAlpha @@ -79,6 +84,8 @@ fun AnimeExtensionScreen( onClickUpdateAll: () -> Unit, onRefresh: () -> Unit, ) { + val navigator = LocalNavigator.currentOrThrow + PullRefresh( refreshing = state.isRefreshing, onRefresh = onRefresh, @@ -95,6 +102,13 @@ fun AnimeExtensionScreen( EmptyScreen( stringRes = msg, modifier = Modifier.padding(contentPadding), + actions = persistentListOf( + EmptyScreenAction( + stringRes = MR.strings.label_extension_repos, + icon = Icons.Outlined.Settings, + onClick = { navigator.push(AnimeExtensionReposScreen()) }, + ), + ), ) } else -> { diff --git a/app/src/main/java/eu/kanade/presentation/browse/manga/MangaExtensionsScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/manga/MangaExtensionsScreen.kt index 3eaf77f683..52ecc009fe 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/manga/MangaExtensionsScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/manga/MangaExtensionsScreen.kt @@ -40,12 +40,15 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp +import cafe.adriel.voyager.navigator.LocalNavigator +import cafe.adriel.voyager.navigator.currentOrThrow import dev.icerock.moko.resources.StringResource import eu.kanade.core.util.fastDistinctBy import eu.kanade.presentation.browse.BaseBrowseItem import eu.kanade.presentation.browse.manga.components.MangaExtensionIcon import eu.kanade.presentation.components.WarningBanner import eu.kanade.presentation.entries.components.DotSeparatorNoSpaceText +import eu.kanade.presentation.more.settings.screen.browse.MangaExtensionReposScreen import eu.kanade.presentation.util.rememberRequestPackageInstallsPermissionState import eu.kanade.tachiyomi.extension.InstallStep import eu.kanade.tachiyomi.extension.manga.model.MangaExtension @@ -53,6 +56,7 @@ import eu.kanade.tachiyomi.ui.browse.manga.extension.MangaExtensionUiModel import eu.kanade.tachiyomi.ui.browse.manga.extension.MangaExtensionsScreenModel import eu.kanade.tachiyomi.util.system.LocaleHelper import eu.kanade.tachiyomi.util.system.launchRequestPackageInstallsPermission +import kotlinx.collections.immutable.persistentListOf import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.FastScrollLazyColumn import tachiyomi.presentation.core.components.material.PullRefresh @@ -60,6 +64,7 @@ import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.topSmallPaddingValues import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.screens.EmptyScreen +import tachiyomi.presentation.core.screens.EmptyScreenAction import tachiyomi.presentation.core.screens.LoadingScreen import tachiyomi.presentation.core.theme.header import tachiyomi.presentation.core.util.plus @@ -81,6 +86,8 @@ fun MangaExtensionScreen( onClickUpdateAll: () -> Unit, onRefresh: () -> Unit, ) { + val navigator = LocalNavigator.currentOrThrow + PullRefresh( refreshing = state.isRefreshing, onRefresh = onRefresh, @@ -97,6 +104,13 @@ fun MangaExtensionScreen( EmptyScreen( stringRes = msg, modifier = Modifier.padding(contentPadding), + actions = persistentListOf( + EmptyScreenAction( + stringRes = MR.strings.label_extension_repos, + icon = Icons.Outlined.Settings, + onClick = { navigator.push(MangaExtensionReposScreen()) }, + ), + ), ) } else -> { From 2883adc8ae32155134c20132957fba8ba8f59418 Mon Sep 17 00:00:00 2001 From: "Weblate (bot)" Date: Sat, 13 Jan 2024 15:17:12 +0100 Subject: [PATCH 10/14] Translations update from Hosted Weblate (#10393) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Weblate translations Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/bg/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ca/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/de/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/fil/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/hr/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/id/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/it/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ru/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/uk/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/tachiyomi-plurals-xml/bg/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/tachiyomi-plurals-xml/de/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/tachiyomi-plurals-xml/eo/ Translate-URL: https://hosted.weblate.org/projects/tachiyomi/tachiyomi-plurals-xml/fil/ Translation: Tachiyomi/Tachiyomi plurals.xml Translation: Tachiyomi/Tachiyomi strings.xml Co-authored-by: Boyan Alexiev Co-authored-by: Denis \"Samilton Co-authored-by: Dexroneum Co-authored-by: Eduard Ereza Martínez Co-authored-by: Giorgio Sanna Co-authored-by: Lyfja Co-authored-by: Milo Ivir Co-authored-by: Radoŝ Porka Co-authored-by: Shiratori Co-authored-by: TheKingTermux (cherry picked from commit 899bd269567e5b2aa0c9e7ccded3cb49f151cc11) --- .../commonMain/resources/MR/bg/strings.xml | 4 ++-- .../commonMain/resources/MR/eo/plurals.xml | 20 +++++++++++++++++-- .../commonMain/resources/MR/it/strings.xml | 2 +- .../commonMain/resources/MR/ru/strings.xml | 2 +- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/i18n/src/commonMain/resources/MR/bg/strings.xml b/i18n/src/commonMain/resources/MR/bg/strings.xml index c18c66f920..c749e82e51 100644 --- a/i18n/src/commonMain/resources/MR/bg/strings.xml +++ b/i18n/src/commonMain/resources/MR/bg/strings.xml @@ -316,7 +316,7 @@ Възстановяването неуспешно Възстановяването е в процес Съхраняването неуспешно - Копието вече се запазва + Архивирането вече е в ход %02d мин, %02d сек Странично разстояние Четене @@ -331,7 +331,7 @@ Никога Винаги Заключи при неактивност - Изисквай отключване + Изискване на отключване Сигурност Уведомления Система на абонаментите diff --git a/i18n/src/commonMain/resources/MR/eo/plurals.xml b/i18n/src/commonMain/resources/MR/eo/plurals.xml index 3512d105ee..e5d077a719 100644 --- a/i18n/src/commonMain/resources/MR/eo/plurals.xml +++ b/i18n/src/commonMain/resources/MR/eo/plurals.xml @@ -9,7 +9,7 @@ %d kategorioj - 1 ĉapitro + %1$s ĉapitro %1$s ĉapitroj @@ -33,7 +33,7 @@ %d ŝanĝspuriloj - 1 restas + %1$s restas %1$s restas @@ -68,4 +68,20 @@ + + 1 tago + %d tagoj + + + Sekva ĉapitro + Sekvaj %d ĉapitroj + + + Mankas %1$s ĉapitro + Mankas %1$s ĉapitroj + + + Sekva nelegita ĉapitro + Sekvaj %d nelegitaj ĉapitroj + \ No newline at end of file diff --git a/i18n/src/commonMain/resources/MR/it/strings.xml b/i18n/src/commonMain/resources/MR/it/strings.xml index 04e720232c..8c7a566bb8 100644 --- a/i18n/src/commonMain/resources/MR/it/strings.xml +++ b/i18n/src/commonMain/resources/MR/it/strings.xml @@ -680,7 +680,7 @@ Fuori dal periodo di rilascio previsto Intervalli Stima ogni - Intervallo di recupero personalizzato + Intervallo di aggiornamento personalizzato Prossimo aggiornamento previsto Imposta l\'aggiornamento ogni Saltato perché oggi non era previsto alcun rilascio diff --git a/i18n/src/commonMain/resources/MR/ru/strings.xml b/i18n/src/commonMain/resources/MR/ru/strings.xml index 3a6a25e94c..4cccb03eb3 100644 --- a/i18n/src/commonMain/resources/MR/ru/strings.xml +++ b/i18n/src/commonMain/resources/MR/ru/strings.xml @@ -533,7 +533,7 @@ Не удалось получить доступные расширения Политика конфиденциальности Пропускать серии с непрочитанными главами - Для помощи в исправлении ошибок библиотеки нажать %1$s + Для помощи в исправлении ошибок библиотеки, нажмите %1$s Сохранить как архив CBZ Отменено Перерыв From b214ec16ae7064ea2ba68c33662500aa6de8fdfd Mon Sep 17 00:00:00 2001 From: Secozzi Date: Wed, 8 May 2024 17:14:30 +0200 Subject: [PATCH 11/14] Use newer build tools Co-authored-by: arkon <4098258+arkon@users.noreply.github.com> --- app/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index f7e2c976ea..640276f629 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -16,6 +16,7 @@ val SUPPORTED_ABIS = setOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64") android { namespace = "eu.kanade.tachiyomi" + buildToolsVersion = "34.0.0" defaultConfig { applicationId = "xyz.jmir.tachiyomi.mi" From 36113c7f6cf6d689595788972225116ffd434b66 Mon Sep 17 00:00:00 2001 From: Secozzi Date: Wed, 8 May 2024 17:16:04 +0200 Subject: [PATCH 12/14] Install build-tools 29.0.3 Co-authored-by: arkon <4098258+arkon@users.noreply.github.com> --- .github/workflows/build_push.yml | 4 ++++ app/build.gradle.kts | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_push.yml b/.github/workflows/build_push.yml index 4b473c5333..b7059b5dcf 100644 --- a/.github/workflows/build_push.yml +++ b/.github/workflows/build_push.yml @@ -27,6 +27,10 @@ jobs: - name: Validate Gradle Wrapper uses: gradle/wrapper-validation-action@v1 + - name: Setup Android SDK + run: | + ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "build-tools;29.0.3" + - name: Set up JDK uses: actions/setup-java@v4 with: diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 640276f629..f7e2c976ea 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -16,7 +16,6 @@ val SUPPORTED_ABIS = setOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64") android { namespace = "eu.kanade.tachiyomi" - buildToolsVersion = "34.0.0" defaultConfig { applicationId = "xyz.jmir.tachiyomi.mi" From e0eacb22a21f885dab0411271cbcc8faa7599e3e Mon Sep 17 00:00:00 2001 From: Secozzi Date: Wed, 8 May 2024 18:32:30 +0200 Subject: [PATCH 13/14] lint(lint): lint --- .../settings/screen/browse/components/ExtensionReposContent.kt | 1 - .../tachiyomi/data/backup/restore/restorers/MangaRestorer.kt | 1 - 2 files changed, 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt index be6a04ff60..7d837b32d1 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt @@ -26,7 +26,6 @@ import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.i18n.stringResource - @Composable fun ExtensionReposContent( repos: ImmutableSet, diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt index f0e255359c..03f7875b18 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt @@ -66,7 +66,6 @@ class MangaRestorer( restoreExistingManga(manga, dbManga) } - restoreMangaDetails( manga = restoredManga, chapters = backupManga.chapters, From 49cf1de42d22e02f8ef56a4873c7b2801822475b Mon Sep 17 00:00:00 2001 From: jmir1 Date: Fri, 10 May 2024 10:26:47 +0200 Subject: [PATCH 14/14] fix: Remove useless build tools from workflow --- .github/workflows/build_push.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build_push.yml b/.github/workflows/build_push.yml index b7059b5dcf..4b473c5333 100644 --- a/.github/workflows/build_push.yml +++ b/.github/workflows/build_push.yml @@ -27,10 +27,6 @@ jobs: - name: Validate Gradle Wrapper uses: gradle/wrapper-validation-action@v1 - - name: Setup Android SDK - run: | - ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "build-tools;29.0.3" - - name: Set up JDK uses: actions/setup-java@v4 with: