feat: pugv (#927)

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
dom
2025-08-03 15:25:29 +08:00
committed by GitHub
parent cf835e330b
commit bd3d6cf34c
33 changed files with 596 additions and 421 deletions

View File

@@ -2,16 +2,26 @@ import 'package:PiliPlus/grpc/bilibili/main/community/reply/v1.pb.dart'
show MainListReply, ReplyInfo;
import 'package:PiliPlus/grpc/reply.dart';
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/models/common/video/video_type.dart';
import 'package:PiliPlus/pages/common/reply_controller.dart';
import 'package:PiliPlus/pages/video/controller.dart';
import 'package:PiliPlus/utils/id_utils.dart';
import 'package:flutter/material.dart';
import 'package:get/get_state_manager/src/rx_flutter/rx_ticket_provider_mixin.dart';
import 'package:get/get.dart';
class VideoReplyController extends ReplyController<MainListReply>
with GetSingleTickerProviderStateMixin {
VideoReplyController({required this.aid});
// 视频aid 请求时使用的oid
VideoReplyController({
required this.aid,
required this.videoType,
required this.heroTag,
});
int aid;
final VideoType videoType;
late final isPugv = videoType == VideoType.pugv;
final String heroTag;
late final videoCtr = Get.find<VideoDetailController>(tag: heroTag);
@override
dynamic get sourceId => IdUtils.av2bv(aid);
@@ -52,9 +62,18 @@ class VideoReplyController extends ReplyController<MainListReply>
return response.replies;
}
int get _epId {
return switch (videoCtr.epId) {
int e => e,
String e => int.parse(e),
_ => throw UnsupportedError(''),
};
}
@override
Future<LoadingState<MainListReply>> customGetData() => ReplyGrpc.mainList(
oid: aid,
oid: isPugv ? _epId : aid,
type: videoType.replyType,
mode: mode.value,
cursorNext: cursorNext,
offset: paginationReply?.nextOffset,

View File

@@ -13,22 +13,8 @@ import 'package:flutter/rendering.dart';
import 'package:get/get.dart';
class VideoReplyPanel extends StatefulWidget {
final String? bvid;
final int oid;
final int rpid;
final int replyLevel;
final String heroTag;
final Function(ReplyInfo replyItem, int? rpid) replyReply;
final VoidCallback? onViewImage;
final ValueChanged<int>? onDismissed;
final Function(List<String>, int)? callback;
final bool? needController;
const VideoReplyPanel({
super.key,
this.bvid,
required this.oid,
this.rpid = 0,
this.replyLevel = 1,
required this.heroTag,
required this.replyReply,
@@ -38,6 +24,14 @@ class VideoReplyPanel extends StatefulWidget {
this.needController,
});
final int replyLevel;
final String heroTag;
final Function(ReplyInfo replyItem, int? rpid) replyReply;
final VoidCallback? onViewImage;
final ValueChanged<int>? onDismissed;
final Function(List<String>, int)? callback;
final bool? needController;
@override
State<VideoReplyPanel> createState() => _VideoReplyPanelState();
}
@@ -179,7 +173,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
_videoReplyController.onReply(
context,
oid: _videoReplyController.aid,
replyType: 1,
replyType: _videoReplyController.videoType.replyType,
);
},
tooltip: '发表评论',
@@ -240,7 +234,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
item,
index,
_videoReplyController.aid,
1,
_videoReplyController.videoType.replyType,
),
);
}