feat: 增加播放器双击点赞与飘心
This commit is contained in:
1 parent
e2cc409e5a
commit
4140c4eb50
6 files changed
+207
No files matched your search
@@ -96,6 +96,29 @@ extension _PlayerViewActions on _PlayerPageState {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _likeFromDoubleTap(
|
||||
BuildContext context,
|
||||
InteractionController interactions,
|
||||
Episode episode,
|
||||
) async {
|
||||
unawaited(context.read<Haptics>().lightImpact());
|
||||
if (interactions.isEpisodeLiked(episode.id) ||
|
||||
interactions.isEpisodeBusy(episode.id)) {
|
||||
return;
|
||||
}
|
||||
if (!await ensureSignedIn(context) || !context.mounted) return;
|
||||
if (interactions.isEpisodeLiked(episode.id) ||
|
||||
interactions.isEpisodeBusy(episode.id)) {
|
||||
return;
|
||||
}
|
||||
final result = await interactions.toggleEpisodeLike(episode.id);
|
||||
if (result.isSuccess || !context.mounted) return;
|
||||
showCenteredToast(
|
||||
context,
|
||||
result.errorMessage ?? AppLocalizations.of(context)!.likeFailed,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _toggleSave(BuildContext context, Drama drama) async {
|
||||
final favorites = context.read<FavoriteController>();
|
||||
if (!await ensureSignedIn(context) || !context.mounted) return;
|
||||
|
||||
Reference in new issue
Block a user