Make the edit notes button edit directly

This commit is contained in:
imkunet 2024-02-19 06:04:07 -05:00 committed by imkunet
parent 23be98b6d4
commit e861b97bac
No known key found for this signature in database
GPG Key ID: 32E0ECFB90A68C42
4 changed files with 21 additions and 5 deletions

View File

@ -114,6 +114,7 @@ fun MangaScreen(
onEditFetchIntervalClicked: (() -> Unit)?,
onMigrateClicked: (() -> Unit)?,
onNotesClicked: () -> Unit,
onNotesEditClicked: () -> Unit,
// For bottom action menu
onMultiBookmarkClicked: (List<Chapter>, bookmarked: Boolean) -> Unit,
@ -163,6 +164,7 @@ fun MangaScreen(
onEditIntervalClicked = onEditFetchIntervalClicked,
onMigrateClicked = onMigrateClicked,
onNotesClicked = onNotesClicked,
onNotesEditClicked = onNotesEditClicked,
onMultiBookmarkClicked = onMultiBookmarkClicked,
onMultiMarkAsReadClicked = onMultiMarkAsReadClicked,
onMarkPreviousAsReadClicked = onMarkPreviousAsReadClicked,
@ -199,6 +201,7 @@ fun MangaScreen(
onEditIntervalClicked = onEditFetchIntervalClicked,
onMigrateClicked = onMigrateClicked,
onNotesClicked = onNotesClicked,
onNotesEditClicked = onNotesEditClicked,
onMultiBookmarkClicked = onMultiBookmarkClicked,
onMultiMarkAsReadClicked = onMultiMarkAsReadClicked,
onMarkPreviousAsReadClicked = onMarkPreviousAsReadClicked,
@ -245,6 +248,7 @@ private fun MangaScreenSmallImpl(
onEditIntervalClicked: (() -> Unit)?,
onMigrateClicked: (() -> Unit)?,
onNotesClicked: () -> Unit,
onNotesEditClicked: () -> Unit,
// For bottom action menu
onMultiBookmarkClicked: (List<Chapter>, bookmarked: Boolean) -> Unit,
@ -430,7 +434,7 @@ private fun MangaScreenSmallImpl(
contentType = MangaScreenItem.NOTES_SECTION,
) {
MangaNotesSection(
onClickNotes = onNotesClicked,
onClickNotes = onNotesEditClicked,
content = state.manga.notes,
)
}
@ -501,6 +505,7 @@ fun MangaScreenLargeImpl(
onEditIntervalClicked: (() -> Unit)?,
onMigrateClicked: (() -> Unit)?,
onNotesClicked: () -> Unit,
onNotesEditClicked: () -> Unit,
// For bottom action menu
onMultiBookmarkClicked: (List<Chapter>, bookmarked: Boolean) -> Unit,
@ -662,7 +667,7 @@ fun MangaScreenLargeImpl(
onCopyTagToClipboard = onCopyTagToClipboard,
)
MangaNotesSection(
onClickNotes = onNotesClicked,
onClickNotes = onNotesEditClicked,
content = state.manga.notes,
)
}

View File

@ -165,7 +165,8 @@ class MangaScreen(
onMigrateClicked = {
navigator.push(MigrateSearchScreen(successState.manga.id))
}.takeIf { successState.manga.favorite },
onNotesClicked = { navigator.push(MangaNotesScreen(successState.manga)) },
onNotesClicked = { navigator.push(MangaNotesScreen(manga = successState.manga)) },
onNotesEditClicked = { navigator.push(MangaNotesScreen(manga = successState.manga, editing = true)) },
onMultiBookmarkClicked = screenModel::bookmarkChapters,
onMultiMarkAsReadClicked = screenModel::markChaptersRead,
onMarkPreviousAsReadClicked = screenModel::markPreviousChapterRead,

View File

@ -12,12 +12,20 @@ import eu.kanade.presentation.util.Screen
import tachiyomi.domain.manga.model.Manga
import tachiyomi.presentation.core.screens.LoadingScreen
class MangaNotesScreen(private val manga: Manga) : Screen() {
class MangaNotesScreen(
private val manga: Manga,
private val editing: Boolean = false,
) : Screen() {
@Composable
override fun Content() {
val navigator = LocalNavigator.currentOrThrow
val screenModel = rememberScreenModel { MangaNotesScreenModel(manga = manga) }
val screenModel = rememberScreenModel {
MangaNotesScreenModel(
manga = manga,
editing = editing,
)
}
val state by screenModel.state.collectAsState()
if (state is MangaNotesScreenState.Loading) {

View File

@ -12,6 +12,7 @@ import uy.kohesive.injekt.api.get
class MangaNotesScreenModel(
val manga: Manga,
editing: Boolean,
private val setMangaNotes: SetMangaNotes = Injekt.get(),
) : StateScreenModel<MangaNotesScreenState>(MangaNotesScreenState.Loading) {
@ -23,6 +24,7 @@ class MangaNotesScreenModel(
MangaNotesScreenState.Success(
manga = manga,
notes = manga.notes,
editing = editing,
)
}
}