mirror of
https://github.com/mihonapp/mihon.git
synced 2025-01-06 08:17:12 +01:00
Make the edit notes button edit directly
This commit is contained in:
parent
23be98b6d4
commit
e861b97bac
@ -114,6 +114,7 @@ fun MangaScreen(
|
|||||||
onEditFetchIntervalClicked: (() -> Unit)?,
|
onEditFetchIntervalClicked: (() -> Unit)?,
|
||||||
onMigrateClicked: (() -> Unit)?,
|
onMigrateClicked: (() -> Unit)?,
|
||||||
onNotesClicked: () -> Unit,
|
onNotesClicked: () -> Unit,
|
||||||
|
onNotesEditClicked: () -> Unit,
|
||||||
|
|
||||||
// For bottom action menu
|
// For bottom action menu
|
||||||
onMultiBookmarkClicked: (List<Chapter>, bookmarked: Boolean) -> Unit,
|
onMultiBookmarkClicked: (List<Chapter>, bookmarked: Boolean) -> Unit,
|
||||||
@ -163,6 +164,7 @@ fun MangaScreen(
|
|||||||
onEditIntervalClicked = onEditFetchIntervalClicked,
|
onEditIntervalClicked = onEditFetchIntervalClicked,
|
||||||
onMigrateClicked = onMigrateClicked,
|
onMigrateClicked = onMigrateClicked,
|
||||||
onNotesClicked = onNotesClicked,
|
onNotesClicked = onNotesClicked,
|
||||||
|
onNotesEditClicked = onNotesEditClicked,
|
||||||
onMultiBookmarkClicked = onMultiBookmarkClicked,
|
onMultiBookmarkClicked = onMultiBookmarkClicked,
|
||||||
onMultiMarkAsReadClicked = onMultiMarkAsReadClicked,
|
onMultiMarkAsReadClicked = onMultiMarkAsReadClicked,
|
||||||
onMarkPreviousAsReadClicked = onMarkPreviousAsReadClicked,
|
onMarkPreviousAsReadClicked = onMarkPreviousAsReadClicked,
|
||||||
@ -199,6 +201,7 @@ fun MangaScreen(
|
|||||||
onEditIntervalClicked = onEditFetchIntervalClicked,
|
onEditIntervalClicked = onEditFetchIntervalClicked,
|
||||||
onMigrateClicked = onMigrateClicked,
|
onMigrateClicked = onMigrateClicked,
|
||||||
onNotesClicked = onNotesClicked,
|
onNotesClicked = onNotesClicked,
|
||||||
|
onNotesEditClicked = onNotesEditClicked,
|
||||||
onMultiBookmarkClicked = onMultiBookmarkClicked,
|
onMultiBookmarkClicked = onMultiBookmarkClicked,
|
||||||
onMultiMarkAsReadClicked = onMultiMarkAsReadClicked,
|
onMultiMarkAsReadClicked = onMultiMarkAsReadClicked,
|
||||||
onMarkPreviousAsReadClicked = onMarkPreviousAsReadClicked,
|
onMarkPreviousAsReadClicked = onMarkPreviousAsReadClicked,
|
||||||
@ -245,6 +248,7 @@ private fun MangaScreenSmallImpl(
|
|||||||
onEditIntervalClicked: (() -> Unit)?,
|
onEditIntervalClicked: (() -> Unit)?,
|
||||||
onMigrateClicked: (() -> Unit)?,
|
onMigrateClicked: (() -> Unit)?,
|
||||||
onNotesClicked: () -> Unit,
|
onNotesClicked: () -> Unit,
|
||||||
|
onNotesEditClicked: () -> Unit,
|
||||||
|
|
||||||
// For bottom action menu
|
// For bottom action menu
|
||||||
onMultiBookmarkClicked: (List<Chapter>, bookmarked: Boolean) -> Unit,
|
onMultiBookmarkClicked: (List<Chapter>, bookmarked: Boolean) -> Unit,
|
||||||
@ -430,7 +434,7 @@ private fun MangaScreenSmallImpl(
|
|||||||
contentType = MangaScreenItem.NOTES_SECTION,
|
contentType = MangaScreenItem.NOTES_SECTION,
|
||||||
) {
|
) {
|
||||||
MangaNotesSection(
|
MangaNotesSection(
|
||||||
onClickNotes = onNotesClicked,
|
onClickNotes = onNotesEditClicked,
|
||||||
content = state.manga.notes,
|
content = state.manga.notes,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -501,6 +505,7 @@ fun MangaScreenLargeImpl(
|
|||||||
onEditIntervalClicked: (() -> Unit)?,
|
onEditIntervalClicked: (() -> Unit)?,
|
||||||
onMigrateClicked: (() -> Unit)?,
|
onMigrateClicked: (() -> Unit)?,
|
||||||
onNotesClicked: () -> Unit,
|
onNotesClicked: () -> Unit,
|
||||||
|
onNotesEditClicked: () -> Unit,
|
||||||
|
|
||||||
// For bottom action menu
|
// For bottom action menu
|
||||||
onMultiBookmarkClicked: (List<Chapter>, bookmarked: Boolean) -> Unit,
|
onMultiBookmarkClicked: (List<Chapter>, bookmarked: Boolean) -> Unit,
|
||||||
@ -662,7 +667,7 @@ fun MangaScreenLargeImpl(
|
|||||||
onCopyTagToClipboard = onCopyTagToClipboard,
|
onCopyTagToClipboard = onCopyTagToClipboard,
|
||||||
)
|
)
|
||||||
MangaNotesSection(
|
MangaNotesSection(
|
||||||
onClickNotes = onNotesClicked,
|
onClickNotes = onNotesEditClicked,
|
||||||
content = state.manga.notes,
|
content = state.manga.notes,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,8 @@ class MangaScreen(
|
|||||||
onMigrateClicked = {
|
onMigrateClicked = {
|
||||||
navigator.push(MigrateSearchScreen(successState.manga.id))
|
navigator.push(MigrateSearchScreen(successState.manga.id))
|
||||||
}.takeIf { successState.manga.favorite },
|
}.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,
|
onMultiBookmarkClicked = screenModel::bookmarkChapters,
|
||||||
onMultiMarkAsReadClicked = screenModel::markChaptersRead,
|
onMultiMarkAsReadClicked = screenModel::markChaptersRead,
|
||||||
onMarkPreviousAsReadClicked = screenModel::markPreviousChapterRead,
|
onMarkPreviousAsReadClicked = screenModel::markPreviousChapterRead,
|
||||||
|
@ -12,12 +12,20 @@ import eu.kanade.presentation.util.Screen
|
|||||||
import tachiyomi.domain.manga.model.Manga
|
import tachiyomi.domain.manga.model.Manga
|
||||||
import tachiyomi.presentation.core.screens.LoadingScreen
|
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
|
@Composable
|
||||||
override fun Content() {
|
override fun Content() {
|
||||||
val navigator = LocalNavigator.currentOrThrow
|
val navigator = LocalNavigator.currentOrThrow
|
||||||
|
|
||||||
val screenModel = rememberScreenModel { MangaNotesScreenModel(manga = manga) }
|
val screenModel = rememberScreenModel {
|
||||||
|
MangaNotesScreenModel(
|
||||||
|
manga = manga,
|
||||||
|
editing = editing,
|
||||||
|
)
|
||||||
|
}
|
||||||
val state by screenModel.state.collectAsState()
|
val state by screenModel.state.collectAsState()
|
||||||
|
|
||||||
if (state is MangaNotesScreenState.Loading) {
|
if (state is MangaNotesScreenState.Loading) {
|
||||||
|
@ -12,6 +12,7 @@ import uy.kohesive.injekt.api.get
|
|||||||
|
|
||||||
class MangaNotesScreenModel(
|
class MangaNotesScreenModel(
|
||||||
val manga: Manga,
|
val manga: Manga,
|
||||||
|
editing: Boolean,
|
||||||
private val setMangaNotes: SetMangaNotes = Injekt.get(),
|
private val setMangaNotes: SetMangaNotes = Injekt.get(),
|
||||||
) : StateScreenModel<MangaNotesScreenState>(MangaNotesScreenState.Loading) {
|
) : StateScreenModel<MangaNotesScreenState>(MangaNotesScreenState.Loading) {
|
||||||
|
|
||||||
@ -23,6 +24,7 @@ class MangaNotesScreenModel(
|
|||||||
MangaNotesScreenState.Success(
|
MangaNotesScreenState.Success(
|
||||||
manga = manga,
|
manga = manga,
|
||||||
notes = manga.notes,
|
notes = manga.notes,
|
||||||
|
editing = editing,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user