mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-17 23:56:13 +08:00
opt reply check
fix check dyn Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -82,8 +82,8 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
|
|||||||
@override
|
@override
|
||||||
Future<void> onRefresh() {
|
Future<void> onRefresh() {
|
||||||
cursorNext = null;
|
cursorNext = null;
|
||||||
paginationReply = null;
|
|
||||||
subjectControl = null;
|
subjectControl = null;
|
||||||
|
paginationReply = null;
|
||||||
return super.onRefresh();
|
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(
|
void onReply(
|
||||||
BuildContext context, {
|
BuildContext context, {
|
||||||
int? oid,
|
int? oid,
|
||||||
@@ -117,27 +134,21 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(replyItem != null || (oid != null && replyType != null));
|
assert(replyItem != null || (oid != null && replyType != null));
|
||||||
String? hint;
|
|
||||||
try {
|
final (bool inputDisable, String? hint) = replyHint;
|
||||||
if (subjectControl != null && subjectControl!.hasRootText()) {
|
if (inputDisable) {
|
||||||
if (subjectControl!.inputDisable) {
|
return;
|
||||||
SmartDialog.showToast(subjectControl!.rootText);
|
}
|
||||||
return;
|
|
||||||
}
|
final key = oid ?? replyItem!.oid + replyItem.id;
|
||||||
if ((subjectControl!.hasSwitcherType() &&
|
|
||||||
subjectControl!.switcherType != 1) ||
|
|
||||||
subjectControl!.rootText.contains('可发评论')) {
|
|
||||||
hint = subjectControl!.rootText;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (_) {}
|
|
||||||
dynamic key = oid ?? replyItem!.oid + replyItem.id;
|
|
||||||
Navigator.of(context)
|
Navigator.of(context)
|
||||||
.push(
|
.push(
|
||||||
GetDialogRoute(
|
GetDialogRoute(
|
||||||
pageBuilder: (buildContext, animation, secondaryAnimation) {
|
pageBuilder: (buildContext, animation, secondaryAnimation) {
|
||||||
return ReplyPage(
|
return ReplyPage(
|
||||||
|
hint: hint,
|
||||||
oid: oid ?? replyItem!.oid.toInt(),
|
oid: oid ?? replyItem!.oid.toInt(),
|
||||||
root: oid != null ? 0 : replyItem!.id.toInt(),
|
root: oid != null ? 0 : replyItem!.id.toInt(),
|
||||||
parent: 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();
|
savedReplies[key] = reply.toList();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hint: hint,
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
transitionDuration: const Duration(milliseconds: 500),
|
transitionDuration: const Duration(milliseconds: 500),
|
||||||
|
|||||||
@@ -737,7 +737,7 @@ class _CreateDynPanelState extends CommonRichTextPubPageState<CreateDynPanel> {
|
|||||||
SmartDialog.showToast('发布成功');
|
SmartDialog.showToast('发布成功');
|
||||||
var id = result['data']?['dyn_id'];
|
var id = result['data']?['dyn_id'];
|
||||||
RequestUtils.insertCreatedDyn(id);
|
RequestUtils.insertCreatedDyn(id);
|
||||||
if (_replyOption.value != ReplyOptionType.close) {
|
if (!_isPrivate.value) {
|
||||||
RequestUtils.checkCreatedDyn(
|
RequestUtils.checkCreatedDyn(
|
||||||
id: id,
|
id: id,
|
||||||
dynText: editController.rawText,
|
dynText: editController.rawText,
|
||||||
|
|||||||
@@ -51,12 +51,6 @@ class VideoReplyReplyController extends ReplyController
|
|||||||
queryData();
|
queryData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> onRefresh() {
|
|
||||||
paginationReply = null;
|
|
||||||
return super.onRefresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<ReplyInfo>? getDataList(response) {
|
List<ReplyInfo>? getDataList(response) {
|
||||||
return isDialogue ? response.replies : response.root.replies;
|
return isDialogue ? response.replies : response.root.replies;
|
||||||
@@ -66,6 +60,7 @@ class VideoReplyReplyController extends ReplyController
|
|||||||
bool customHandleResponse(bool isRefresh, Success response) {
|
bool customHandleResponse(bool isRefresh, Success response) {
|
||||||
final data = response.response;
|
final data = response.response;
|
||||||
|
|
||||||
|
subjectControl = data.subjectControl;
|
||||||
upMid ??= data.subjectControl.upMid;
|
upMid ??= data.subjectControl.upMid;
|
||||||
paginationReply = data.paginationReply;
|
paginationReply = data.paginationReply;
|
||||||
isEnd = data.cursor.isEnd;
|
isEnd = data.cursor.isEnd;
|
||||||
@@ -141,6 +136,12 @@ class VideoReplyReplyController extends ReplyController
|
|||||||
int? index,
|
int? index,
|
||||||
}) {
|
}) {
|
||||||
assert(replyItem != null && index != null);
|
assert(replyItem != null && index != null);
|
||||||
|
|
||||||
|
final (bool inputDisable, String? hint) = replyHint;
|
||||||
|
if (inputDisable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final oid = replyItem!.oid.toInt();
|
final oid = replyItem!.oid.toInt();
|
||||||
final root = replyItem.id.toInt();
|
final root = replyItem.id.toInt();
|
||||||
final key = oid + root;
|
final key = oid + root;
|
||||||
@@ -150,6 +151,7 @@ class VideoReplyReplyController extends ReplyController
|
|||||||
GetDialogRoute(
|
GetDialogRoute(
|
||||||
pageBuilder: (buildContext, animation, secondaryAnimation) {
|
pageBuilder: (buildContext, animation, secondaryAnimation) {
|
||||||
return ReplyPage(
|
return ReplyPage(
|
||||||
|
hint: hint,
|
||||||
oid: oid,
|
oid: oid,
|
||||||
root: root,
|
root: root,
|
||||||
parent: root,
|
parent: root,
|
||||||
|
|||||||
Reference in New Issue
Block a user