diff --git a/lib/pages/common/reply_controller.dart b/lib/pages/common/reply_controller.dart index b2c814be..e14ddd00 100644 --- a/lib/pages/common/reply_controller.dart +++ b/lib/pages/common/reply_controller.dart @@ -82,8 +82,8 @@ abstract class ReplyController extends CommonListController { @override Future onRefresh() { cursorNext = null; - paginationReply = null; subjectControl = null; + paginationReply = null; return super.onRefresh(); } @@ -105,6 +105,23 @@ abstract class ReplyController extends CommonListController { }); } + (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 extends CommonListController { 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 extends CommonListController { savedReplies[key] = reply.toList(); } }, - hint: hint, ); }, transitionDuration: const Duration(milliseconds: 500), diff --git a/lib/pages/dynamics_create/view.dart b/lib/pages/dynamics_create/view.dart index 9dbc2465..4efcb6aa 100644 --- a/lib/pages/dynamics_create/view.dart +++ b/lib/pages/dynamics_create/view.dart @@ -737,7 +737,7 @@ class _CreateDynPanelState extends CommonRichTextPubPageState { 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, diff --git a/lib/pages/video/reply_reply/controller.dart b/lib/pages/video/reply_reply/controller.dart index a7eae0d1..d878135a 100644 --- a/lib/pages/video/reply_reply/controller.dart +++ b/lib/pages/video/reply_reply/controller.dart @@ -51,12 +51,6 @@ class VideoReplyReplyController extends ReplyController queryData(); } - @override - Future onRefresh() { - paginationReply = null; - return super.onRefresh(); - } - @override List? 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,