mirror of
https://github.com/mihonapp/mihon.git
synced 2026-10-16 13:48:09 -07:00
Show a confirmation dialog when unfavoriting manga from the manga screen (#4073)
This commit is contained in:
@@ -57,6 +57,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
|
|||||||
- Fixed restoring a backup failing on entries that list a category or excluded scanlator twice ([@AntsyLich](https://github.com/AntsyLich)) ([#4022](https://github.com/mihonapp/mihon/pull/4022))
|
- Fixed restoring a backup failing on entries that list a category or excluded scanlator twice ([@AntsyLich](https://github.com/AntsyLich)) ([#4022](https://github.com/mihonapp/mihon/pull/4022))
|
||||||
- List MangaBaka first among trackers ([@AntsyLich](https://github.com/AntsyLich)) ([`dd46413`](https://github.com/mihonapp/mihon/commit/dd46413))
|
- List MangaBaka first among trackers ([@AntsyLich](https://github.com/AntsyLich)) ([`dd46413`](https://github.com/mihonapp/mihon/commit/dd46413))
|
||||||
- Show a wavy progress ring while a chapter downloads ([@AntsyLich](https://github.com/AntsyLich)) ([`e562a9b`](https://github.com/mihonapp/mihon/commit/e562a9b))
|
- Show a wavy progress ring while a chapter downloads ([@AntsyLich](https://github.com/AntsyLich)) ([`e562a9b`](https://github.com/mihonapp/mihon/commit/e562a9b))
|
||||||
|
- Show a confirmation dialog when unfavoriting manga from the manga screen ([@WizaHX](https://github.com/WizaHX)) ([#4073](https://github.com/mihonapp/mihon/pull/4073))
|
||||||
|
|
||||||
### Improved
|
### Improved
|
||||||
- Show the updates and upcoming filter icon as active when filtering by category, or by hidden excluded scanlators in updates ([@Secozzi](https://github.com/Secozzi)) ([#3772](https://github.com/mihonapp/mihon/pull/3772))
|
- Show the updates and upcoming filter icon as active when filtering by category, or by hidden excluded scanlators in updates ([@Secozzi](https://github.com/Secozzi)) ([#3772](https://github.com/mihonapp/mihon/pull/3772))
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import cafe.adriel.voyager.navigator.currentOrThrow
|
|||||||
import dev.zacsweers.metrox.viewmodel.assistedMetroViewModel
|
import dev.zacsweers.metrox.viewmodel.assistedMetroViewModel
|
||||||
import eu.kanade.domain.manga.model.hasCustomCover
|
import eu.kanade.domain.manga.model.hasCustomCover
|
||||||
import eu.kanade.domain.manga.model.toSManga
|
import eu.kanade.domain.manga.model.toSManga
|
||||||
|
import eu.kanade.presentation.browse.components.RemoveMangaDialog
|
||||||
import eu.kanade.presentation.category.components.ChangeCategoryDialog
|
import eu.kanade.presentation.category.components.ChangeCategoryDialog
|
||||||
import eu.kanade.presentation.components.NavigatorAdaptiveSheet
|
import eu.kanade.presentation.components.NavigatorAdaptiveSheet
|
||||||
import eu.kanade.presentation.manga.ChapterSettingsDialog
|
import eu.kanade.presentation.manga.ChapterSettingsDialog
|
||||||
@@ -116,7 +117,11 @@ class MangaScreen(
|
|||||||
onDownloadChapter = viewModel::runChapterDownloadActions.takeIf { !successState.source.isLocalOrStub() },
|
onDownloadChapter = viewModel::runChapterDownloadActions.takeIf { !successState.source.isLocalOrStub() },
|
||||||
downloadProgressProvider = viewModel::getDownloadProgress,
|
downloadProgressProvider = viewModel::getDownloadProgress,
|
||||||
onAddToLibraryClicked = {
|
onAddToLibraryClicked = {
|
||||||
viewModel.toggleFavorite()
|
if (successState.manga.favorite) {
|
||||||
|
viewModel.showRemoveFromLibraryDialog()
|
||||||
|
} else {
|
||||||
|
viewModel.toggleFavorite()
|
||||||
|
}
|
||||||
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||||
},
|
},
|
||||||
onWebViewClicked = {
|
onWebViewClicked = {
|
||||||
@@ -171,6 +176,15 @@ class MangaScreen(
|
|||||||
val onDismissRequest = { viewModel.dismissDialog() }
|
val onDismissRequest = { viewModel.dismissDialog() }
|
||||||
when (val dialog = successState.dialog) {
|
when (val dialog = successState.dialog) {
|
||||||
null -> {}
|
null -> {}
|
||||||
|
MangaViewModel.Dialog.RemoveFromLibrary -> {
|
||||||
|
RemoveMangaDialog(
|
||||||
|
onDismissRequest = onDismissRequest,
|
||||||
|
onConfirm = {
|
||||||
|
if (successState.manga.favorite) viewModel.toggleFavorite()
|
||||||
|
},
|
||||||
|
mangaToRemove = successState.manga,
|
||||||
|
)
|
||||||
|
}
|
||||||
is MangaViewModel.Dialog.ChangeCategory -> {
|
is MangaViewModel.Dialog.ChangeCategory -> {
|
||||||
ChangeCategoryDialog(
|
ChangeCategoryDialog(
|
||||||
initialSelection = dialog.initialSelection,
|
initialSelection = dialog.initialSelection,
|
||||||
|
|||||||
@@ -461,6 +461,10 @@ class MangaViewModel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun showRemoveFromLibraryDialog() {
|
||||||
|
if (successState?.manga?.favorite == true) dialog.value = Dialog.RemoveFromLibrary
|
||||||
|
}
|
||||||
|
|
||||||
fun showChangeCategoryDialog() {
|
fun showChangeCategoryDialog() {
|
||||||
val manga = successState?.manga ?: return
|
val manga = successState?.manga ?: return
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
@@ -1053,6 +1057,7 @@ class MangaViewModel(
|
|||||||
data class DuplicateManga(val manga: Manga, val duplicates: List<MangaWithChapterCount>) : Dialog
|
data class DuplicateManga(val manga: Manga, val duplicates: List<MangaWithChapterCount>) : Dialog
|
||||||
data class Migrate(val target: Manga, val current: Manga) : Dialog
|
data class Migrate(val target: Manga, val current: Manga) : Dialog
|
||||||
data class SetFetchInterval(val manga: Manga) : Dialog
|
data class SetFetchInterval(val manga: Manga) : Dialog
|
||||||
|
data object RemoveFromLibrary : Dialog
|
||||||
data object SettingsSheet : Dialog
|
data object SettingsSheet : Dialog
|
||||||
data object TrackSheet : Dialog
|
data object TrackSheet : Dialog
|
||||||
data object FullCover : Dialog
|
data object FullCover : Dialog
|
||||||
|
|||||||
Reference in New Issue
Block a user