mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-18 09:36:52 +08:00
@@ -10,7 +10,6 @@ import 'package:PiliPlus/pages/common/publish/publish_route.dart';
|
||||
import 'package:PiliPlus/pages/video/reply_new/view.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/reply_utils.dart';
|
||||
import 'package:PiliPlus/utils/request_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -174,10 +173,9 @@ abstract class ReplyController<R> extends CommonListController<R, ReplyInfo> {
|
||||
),
|
||||
)
|
||||
.then(
|
||||
(res) {
|
||||
if (res != null) {
|
||||
(replyInfo) {
|
||||
if (replyInfo is ReplyInfo) {
|
||||
savedReplies.remove(key);
|
||||
ReplyInfo replyInfo = RequestUtils.replyCast(res);
|
||||
if (loadingState.value case Success(:final response)) {
|
||||
if (response == null) {
|
||||
loadingState.value = Success([replyInfo]);
|
||||
|
||||
@@ -160,6 +160,14 @@ class _MediaPageState extends CommonPageState<MinePage>
|
||||
),
|
||||
msgBadge(_mainController),
|
||||
],
|
||||
IconButton(
|
||||
iconSize: iconSize,
|
||||
padding: padding,
|
||||
style: style,
|
||||
tooltip: '评论记录',
|
||||
onPressed: () => Get.toNamed('/myReply'),
|
||||
icon: const Icon(Icons.message_outlined),
|
||||
),
|
||||
Obx(
|
||||
() {
|
||||
final anonymity = MineController.anonymity.value;
|
||||
|
||||
122
lib/pages/my_reply/view.dart
Normal file
122
lib/pages/my_reply/view.dart
Normal file
@@ -0,0 +1,122 @@
|
||||
import 'package:PiliPlus/common/widgets/dialog/dialog.dart';
|
||||
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
||||
import 'package:PiliPlus/common/widgets/view_sliver_safe_area.dart';
|
||||
import 'package:PiliPlus/grpc/bilibili/main/community/reply/v1.pb.dart';
|
||||
import 'package:PiliPlus/pages/video/reply/widgets/reply_item_grpc.dart';
|
||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/reply_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/waterfall.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:waterfall_flow/waterfall_flow.dart';
|
||||
|
||||
class MyReply extends StatefulWidget {
|
||||
const MyReply({super.key});
|
||||
|
||||
@override
|
||||
State<MyReply> createState() => _MyReplyState();
|
||||
}
|
||||
|
||||
class _MyReplyState extends State<MyReply> with DynMixin {
|
||||
late final List<ReplyInfo> _replies;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_replies =
|
||||
GStorage.reply.values
|
||||
.map((e) => ReplyInfo.create()..mergeFromProto3Json(e))
|
||||
.toList()
|
||||
..sort((a, b) => b.ctime.compareTo(a.ctime));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('我的评论'),
|
||||
actions: kDebugMode
|
||||
? [
|
||||
IconButton(
|
||||
tooltip: 'Clear',
|
||||
onPressed: () => showConfirmDialog(
|
||||
context: context,
|
||||
title: 'Clear Local Storage?',
|
||||
onConfirm: () {
|
||||
GStorage.reply.clear();
|
||||
_replies.clear();
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
icon: const Icon(Icons.clear_all),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
]
|
||||
: null,
|
||||
),
|
||||
body: CustomScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
_replies.isNotEmpty
|
||||
? ViewSliverSafeArea(
|
||||
sliver: SliverWaterfallFlow(
|
||||
gridDelegate: dynGridDelegate,
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
childCount: _replies.length,
|
||||
(context, index) => ReplyItemGrpc(
|
||||
replyLevel: 0,
|
||||
needDivider: false,
|
||||
replyItem: _replies[index],
|
||||
replyReply: _replyReply,
|
||||
onDelete: (_, _) => _onDelete(index),
|
||||
onCheckReply: _onCheckReply,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: const HttpError(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _replyReply(ReplyInfo replyInfo, int? rpid) {
|
||||
switch (replyInfo.type.toInt()) {
|
||||
case 1:
|
||||
PiliScheme.videoPush(
|
||||
replyInfo.oid.toInt(),
|
||||
null,
|
||||
);
|
||||
case 12:
|
||||
PageUtils.toDupNamed(
|
||||
'/articlePage',
|
||||
parameters: {
|
||||
'id': replyInfo.oid.toString(),
|
||||
'type': 'read',
|
||||
},
|
||||
);
|
||||
case _:
|
||||
PageUtils.pushDynFromId(
|
||||
rid: replyInfo.oid.toString(),
|
||||
type: replyInfo.type,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _onDelete(int index) {
|
||||
_replies.removeAt(index);
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
void _onCheckReply(ReplyInfo replyInfo) {
|
||||
ReplyUtils.onCheckReply(
|
||||
replyInfo: replyInfo,
|
||||
biliSendCommAntifraud: Pref.biliSendCommAntifraud,
|
||||
sourceId: null,
|
||||
isManual: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/image_utils.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/url_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
@@ -865,6 +866,35 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
if (kDebugMode) ...[
|
||||
ListTile(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
GStorage.reply.put(
|
||||
item.id.toString(),
|
||||
(item.toProto3Json() as Map)
|
||||
..remove('replies')
|
||||
..remove('memberV2')
|
||||
..remove('trackInfo'),
|
||||
);
|
||||
},
|
||||
title: Text(
|
||||
'save to local',
|
||||
style: style!.copyWith(color: theme.colorScheme.primary),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
onDelete();
|
||||
GStorage.reply.delete(item.id.toString());
|
||||
},
|
||||
title: Text(
|
||||
'remove from local',
|
||||
style: style.copyWith(color: theme.colorScheme.primary),
|
||||
),
|
||||
),
|
||||
],
|
||||
if (ownerMid == upMid || ownerMid == item.member.mid)
|
||||
ListTile(
|
||||
onTap: () async {
|
||||
|
||||
@@ -429,8 +429,8 @@ class _ReplyPageState extends CommonRichTextPubPageState<ReplyPage> {
|
||||
);
|
||||
if (res case Success(:final response)) {
|
||||
hasPub = true;
|
||||
SmartDialog.showToast(response['success_toast']);
|
||||
Get.back(result: response['reply']);
|
||||
SmartDialog.showToast('发送成功');
|
||||
Get.back(result: response);
|
||||
} else {
|
||||
res.toast();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import 'package:PiliPlus/pages/common/publish/publish_route.dart';
|
||||
import 'package:PiliPlus/pages/common/reply_controller.dart';
|
||||
import 'package:PiliPlus/pages/video/reply_new/view.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/request_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
@@ -195,10 +194,9 @@ class VideoReplyReplyController extends ReplyController
|
||||
},
|
||||
),
|
||||
)
|
||||
.then((res) {
|
||||
if (res != null) {
|
||||
.then((replyInfo) {
|
||||
if (replyInfo is ReplyInfo) {
|
||||
savedReplies.remove(key);
|
||||
ReplyInfo replyInfo = RequestUtils.replyCast(res);
|
||||
|
||||
count.value += 1;
|
||||
loadingState
|
||||
|
||||
Reference in New Issue
Block a user