opt reply check

fix check dyn

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-08-12 16:44:51 +08:00
parent a94493705d
commit 308bd26172
3 changed files with 36 additions and 24 deletions

View File

@@ -82,8 +82,8 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
@override
Future<void> onRefresh() {
cursorNext = null;
paginationReply = null;
subjectControl = null;
paginationReply = null;
return super.onRefresh();
}
@@ -105,6 +105,23 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
});
}
(bool inputDisable, String? hint) get replyHint {
try {
if (subjectControl != null && subjectControl!.hasRootText()) {
if (subjectControl!.inputDisable) {
SmartDialog.showToast(subjectControl!.rootText);
return (true, null);
}
if ((subjectControl!.hasSwitcherType() &&
subjectControl!.switcherType != 1) ||
subjectControl!.rootText.contains('可发评论')) {
return (false, subjectControl!.rootText);
}
}
} catch (_) {}
return (false, null);
}
void onReply(
BuildContext context, {
int? oid,
@@ -117,27 +134,21 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
return;
}
}
assert(replyItem != null || (oid != null && replyType != null));
String? hint;
try {
if (subjectControl != null && subjectControl!.hasRootText()) {
if (subjectControl!.inputDisable) {
SmartDialog.showToast(subjectControl!.rootText);
return;
}
if ((subjectControl!.hasSwitcherType() &&
subjectControl!.switcherType != 1) ||
subjectControl!.rootText.contains('可发评论')) {
hint = subjectControl!.rootText;
}
}
} catch (_) {}
dynamic key = oid ?? replyItem!.oid + replyItem.id;
final (bool inputDisable, String? hint) = replyHint;
if (inputDisable) {
return;
}
final key = oid ?? replyItem!.oid + replyItem.id;
Navigator.of(context)
.push(
GetDialogRoute(
pageBuilder: (buildContext, animation, secondaryAnimation) {
return ReplyPage(
hint: hint,
oid: oid ?? replyItem!.oid.toInt(),
root: oid != null ? 0 : replyItem!.id.toInt(),
parent: oid != null ? 0 : replyItem!.id.toInt(),
@@ -151,7 +162,6 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
savedReplies[key] = reply.toList();
}
},
hint: hint,
);
},
transitionDuration: const Duration(milliseconds: 500),

View File

@@ -737,7 +737,7 @@ class _CreateDynPanelState extends CommonRichTextPubPageState<CreateDynPanel> {
SmartDialog.showToast('发布成功');
var id = result['data']?['dyn_id'];
RequestUtils.insertCreatedDyn(id);
if (_replyOption.value != ReplyOptionType.close) {
if (!_isPrivate.value) {
RequestUtils.checkCreatedDyn(
id: id,
dynText: editController.rawText,

View File

@@ -51,12 +51,6 @@ class VideoReplyReplyController extends ReplyController
queryData();
}
@override
Future<void> onRefresh() {
paginationReply = null;
return super.onRefresh();
}
@override
List<ReplyInfo>? getDataList(response) {
return isDialogue ? response.replies : response.root.replies;
@@ -66,6 +60,7 @@ class VideoReplyReplyController extends ReplyController
bool customHandleResponse(bool isRefresh, Success response) {
final data = response.response;
subjectControl = data.subjectControl;
upMid ??= data.subjectControl.upMid;
paginationReply = data.paginationReply;
isEnd = data.cursor.isEnd;
@@ -141,6 +136,12 @@ class VideoReplyReplyController extends ReplyController
int? index,
}) {
assert(replyItem != null && index != null);
final (bool inputDisable, String? hint) = replyHint;
if (inputDisable) {
return;
}
final oid = replyItem!.oid.toInt();
final root = replyItem.id.toInt();
final key = oid + root;
@@ -150,6 +151,7 @@ class VideoReplyReplyController extends ReplyController
GetDialogRoute(
pageBuilder: (buildContext, animation, secondaryAnimation) {
return ReplyPage(
hint: hint,
oid: oid,
root: root,
parent: root,