mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix(manga): Missing "withUIContext"
This commit is contained in:
parent
2f8ae26a83
commit
28cbf0b988
1 changed files with 25 additions and 23 deletions
|
@ -311,31 +311,33 @@ suspend fun Manga.addOrRemoveToFavorites(
|
|||
)
|
||||
)
|
||||
onMangaMoved()
|
||||
return view.snack(view.context.getString(MR.strings.removed_from_library), Snackbar.LENGTH_INDEFINITE) {
|
||||
setAction(MR.strings.undo) {
|
||||
favorite = true
|
||||
date_added = lastAddedDate
|
||||
scope.launchIO {
|
||||
updateManga.await(
|
||||
MangaUpdate(
|
||||
id = this@addOrRemoveToFavorites.id!!,
|
||||
favorite = true,
|
||||
dateAdded = lastAddedDate,
|
||||
return withUIContext {
|
||||
view.snack(view.context.getString(MR.strings.removed_from_library), Snackbar.LENGTH_INDEFINITE) {
|
||||
setAction(MR.strings.undo) {
|
||||
favorite = true
|
||||
date_added = lastAddedDate
|
||||
scope.launchIO {
|
||||
updateManga.await(
|
||||
MangaUpdate(
|
||||
id = this@addOrRemoveToFavorites.id!!,
|
||||
favorite = true,
|
||||
dateAdded = lastAddedDate,
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
onMangaMoved()
|
||||
}
|
||||
addCallback(
|
||||
object : BaseTransientBottomBar.BaseCallback<Snackbar>() {
|
||||
override fun onDismissed(transientBottomBar: Snackbar?, event: Int) {
|
||||
super.onDismissed(transientBottomBar, event)
|
||||
if (!favorite) {
|
||||
onMangaDeleted()
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
onMangaMoved()
|
||||
}
|
||||
addCallback(
|
||||
object : BaseTransientBottomBar.BaseCallback<Snackbar>() {
|
||||
override fun onDismissed(transientBottomBar: Snackbar?, event: Int) {
|
||||
super.onDismissed(transientBottomBar, event)
|
||||
if (!favorite) {
|
||||
onMangaDeleted()
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue