No more UIContext needed to modifyFav

This commit is contained in:
tarsin committed 2023-07-05 11:01:35 +08:00
1 parent f2601fb672
commit 4e4b072c16
1 file changed
+2 -6
@@ -254,17 +254,13 @@ private suspend fun doAddToFavorites(
if (slot != LOCAL_FAVORITED || galleryInfo.favoriteSlot == NOT_FAVORITED) {
galleryInfo.favoriteSlot = slot
galleryInfo.favoriteName = Settings.favCat.getOrNull(slot)
withUIContext {
FavouriteStatusRouter.modifyFavourites(galleryInfo.gid, slot)
}
FavouriteStatusRouter.modifyFavourites(galleryInfo.gid, slot)
}
} else if (slot != LOCAL_FAVORITED || galleryInfo.favoriteSlot == LOCAL_FAVORITED) {
val newSlot = if (galleryInfo.favoriteSlot > LOCAL_FAVORITED && localFavorited) LOCAL_FAVORITED else NOT_FAVORITED
galleryInfo.favoriteSlot = newSlot
galleryInfo.favoriteName = null
withUIContext {
FavouriteStatusRouter.modifyFavourites(galleryInfo.gid, newSlot)
}
FavouriteStatusRouter.modifyFavourites(galleryInfo.gid, newSlot)
}
return add
}