fix: 修正双击点赞与心形联动
This commit is contained in:
1 parent
78d0166eb7
commit
68ccfa21c0
8 files changed
+200
-64
No files matched your search
@@ -81,34 +81,17 @@ extension _PlayerViewActions on _PlayerPageState {
|
||||
Future<void> _toggleLike(
|
||||
BuildContext context,
|
||||
InteractionController interactions,
|
||||
Episode episode,
|
||||
) async {
|
||||
if (!await ensureSignedIn(context) || !context.mounted) return;
|
||||
Episode episode, {
|
||||
bool likeOnly = false,
|
||||
}) async {
|
||||
unawaited(context.read<Haptics>().lightImpact());
|
||||
final result = await interactions.toggleEpisodeLike(episode.id);
|
||||
if (result.isSuccess || !context.mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
result.errorMessage ?? AppLocalizations.of(context)!.likeFailed,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _likeFromDoubleTap(
|
||||
BuildContext context,
|
||||
InteractionController interactions,
|
||||
Episode episode,
|
||||
) async {
|
||||
unawaited(context.read<Haptics>().lightImpact());
|
||||
if (interactions.isEpisodeLiked(episode.id) ||
|
||||
interactions.isEpisodeBusy(episode.id)) {
|
||||
if (interactions.isEpisodeBusy(episode.id) ||
|
||||
(likeOnly && interactions.isEpisodeLiked(episode.id))) {
|
||||
return;
|
||||
}
|
||||
if (!await ensureSignedIn(context) || !context.mounted) return;
|
||||
if (interactions.isEpisodeLiked(episode.id) ||
|
||||
interactions.isEpisodeBusy(episode.id)) {
|
||||
if (interactions.isEpisodeBusy(episode.id) ||
|
||||
(likeOnly && interactions.isEpisodeLiked(episode.id))) {
|
||||
return;
|
||||
}
|
||||
final result = await interactions.toggleEpisodeLike(episode.id);
|
||||
|
||||
Reference in new issue
Block a user