feat: comment antifraud (#193)

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
dom
2025-02-02 21:19:26 +08:00
committed by bggRGjQaUbCoE
parent ca16551917
commit 54e90bd986
10 changed files with 292 additions and 35 deletions

View File

@@ -25,7 +25,7 @@ class VideoReplyController extends ReplyController {
oid: aid!,
cursor: CursorReq(
next: cursor?.next ?? $fixnum.Int64(0),
mode: mode,
mode: mode.value,
),
banWordForReply: banWordForReply,
)

View File

@@ -1,7 +1,7 @@
import 'package:PiliPlus/grpc/app/main/community/reply/v1/reply.pb.dart';
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/models/video/reply/item.dart';
import 'package:PiliPlus/pages/common/common_controller.dart';
import 'package:PiliPlus/pages/common/reply_controller.dart';
import 'package:PiliPlus/utils/global_data.dart';
import 'package:PiliPlus/utils/storage.dart';
import 'package:flutter/material.dart';
@@ -10,7 +10,7 @@ import 'package:PiliPlus/http/reply.dart';
import 'package:PiliPlus/models/common/reply_type.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
class VideoReplyReplyController extends CommonController
class VideoReplyReplyController extends ReplyController
with GetTickerProviderStateMixin {
VideoReplyReplyController({
required this.hasRoot,
@@ -32,9 +32,6 @@ class VideoReplyReplyController extends CommonController
int? rpid;
ReplyType replyType; // = ReplyType.video;
CursorReply? cursor;
Rx<Mode> mode = Mode.MAIN_LIST_TIME.obs;
RxInt count = (-1).obs;
int? upMid;
dynamic firstFloor;
@@ -45,8 +42,6 @@ class VideoReplyReplyController extends CommonController
late final horizontalPreview = GStorage.horizontalPreview;
late final banWordForReply = GStorage.banWordForReply;
@override
void onInit() {
super.onInit();
@@ -203,6 +198,7 @@ class VideoReplyReplyController extends CommonController
banWordForReply: banWordForReply,
)
: ReplyHttp.replyReplyList(
isLogin: isLogin,
oid: oid!,
root: rpid!,
pageNum: currentPage,
@@ -210,6 +206,7 @@ class VideoReplyReplyController extends CommonController
banWordForReply: banWordForReply,
);
@override
queryBySort() {
mode.value = mode.value == Mode.MAIN_LIST_HOT
? Mode.MAIN_LIST_TIME

View File

@@ -27,7 +27,7 @@ class VideoReplyReplyPanel extends StatefulWidget {
this.dialog,
this.firstFloor,
this.source,
this.replyType,
required this.replyType,
this.isDialogue = false,
this.isTop = false,
this.onViewImage,
@@ -39,7 +39,7 @@ class VideoReplyReplyPanel extends StatefulWidget {
final int? dialog;
final dynamic firstFloor;
final String? source;
final ReplyType? replyType;
final ReplyType replyType;
final bool isDialogue;
final bool isTop;
final VoidCallback? onViewImage;
@@ -73,7 +73,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
oid: widget.oid,
rpid: widget.rpid,
dialog: widget.dialog,
replyType: widget.replyType!,
replyType: widget.replyType,
isDialogue: widget.isDialogue,
),
tag: '${widget.rpid}${widget.dialog}${widget.isDialogue}',
@@ -352,15 +352,36 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
_videoReplyReplyController.count.value += 1;
_videoReplyReplyController.loadingState.value =
LoadingState.success(list);
if (_videoReplyReplyController.enableCommAntifraud && mounted) {
_videoReplyReplyController.checkReply(
context,
oid,
root,
widget.replyType.index,
replyInfo.id.toInt(),
replyInfo.content.message,
);
}
} else {
List list = _videoReplyReplyController.loadingState.value is Success
? (_videoReplyReplyController.loadingState.value as Success)
.response
: <ReplyItemModel>[];
list.insert(index + 1, ReplyItemModel.fromJson(res, ''));
ReplyItemModel replyInfo = ReplyItemModel.fromJson(res, '');
list.insert(index + 1, replyInfo);
_videoReplyReplyController.count.value += 1;
_videoReplyReplyController.loadingState.value =
LoadingState.success(list);
if (_videoReplyReplyController.enableCommAntifraud && mounted) {
_videoReplyReplyController.checkReply(
context,
oid,
root,
widget.replyType.index,
replyInfo.rpid ?? 0,
replyInfo.content?.message ?? '',
);
}
}
}
});