feat(interaction): 支持游客点赞收藏评论
This commit is contained in:
1 parent
188811fde6
commit
a3d50eb935
18 files changed
+364
-121
No files matched your search
@@ -53,10 +53,12 @@ class PlayerLogic extends ChangeNotifier {
|
||||
PlaybackPositionCache? positionCache,
|
||||
Future<void> Function()? waitForFrame,
|
||||
DateTime Function()? clock,
|
||||
bool Function()? isSignedIn,
|
||||
}) : positionCache = positionCache ?? PlaybackPositionCache(),
|
||||
_waitForFrame =
|
||||
waitForFrame ?? (() => WidgetsBinding.instance.endOfFrame),
|
||||
_clock = clock ?? DateTime.now;
|
||||
_clock = clock ?? DateTime.now,
|
||||
_isSignedIn = isSignedIn ?? (() => true);
|
||||
|
||||
final WatchHistoryRepository history;
|
||||
final PlaybackRepository playback;
|
||||
@@ -66,6 +68,7 @@ class PlayerLogic extends ChangeNotifier {
|
||||
final PlaybackPositionCache positionCache;
|
||||
final Future<void> Function() _waitForFrame;
|
||||
final DateTime Function() _clock;
|
||||
final bool Function() _isSignedIn;
|
||||
|
||||
late PageController pages;
|
||||
late PlaybackQueue queue;
|
||||
@@ -797,7 +800,10 @@ class PlayerLogic extends ChangeNotifier {
|
||||
/// 金币解锁当前集;成功后强制刷新票据并直接起播。
|
||||
Future<bool> unlockEpisode(int index) async {
|
||||
final service = wallet;
|
||||
if (service == null || index < 0 || index >= sessionEpisodes.length) {
|
||||
if (service == null ||
|
||||
!_isSignedIn() ||
|
||||
index < 0 ||
|
||||
index >= sessionEpisodes.length) {
|
||||
return false;
|
||||
}
|
||||
final episode = sessionEpisodes[index];
|
||||
@@ -1232,6 +1238,7 @@ class PlayerLogic extends ChangeNotifier {
|
||||
int? revision,
|
||||
bool? userWantsPlay,
|
||||
}) async {
|
||||
if (index < 0 || index >= sessionEpisodes.length) return;
|
||||
final feedRevisionAtStart = revision ?? feedRevision;
|
||||
final request = ++pageRequest;
|
||||
cancelScrub();
|
||||
@@ -1257,6 +1264,10 @@ class PlayerLogic extends ChangeNotifier {
|
||||
!isMounted()) {
|
||||
return;
|
||||
}
|
||||
if (!_isSignedIn()) {
|
||||
unawaited(refreshEpisodeStats(index));
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 起播前先要票据:拿不到就不起播,交给三态 UI 提示(失败可重试)
|
||||
final ready = await ensureTicket(index);
|
||||
|
||||
Reference in new issue
Block a user