mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 11:08:03 +08:00
opt: save reply (#1860)
* opt: save reply * opt: reply save switch * remove unneeded sort * clear sub replies [skip ci] --------- Co-authored-by: dom <githubaccount56556@proton.me>
This commit is contained in:
committed by
GitHub
parent
4ad422c3ea
commit
f825f87dc1
@@ -4,6 +4,7 @@ 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/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/reply_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
@@ -26,11 +27,7 @@ class _MyReplyState extends State<MyReply> with DynMixin {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_replies =
|
||||
GStorage.reply.values
|
||||
.map((e) => ReplyInfo.create()..mergeFromProto3Json(e))
|
||||
.toList()
|
||||
..sort((a, b) => b.ctime.compareTo(a.ctime));
|
||||
_replies = GStorage.reply!.values.map(ReplyInfo.fromBuffer).toList();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -46,7 +43,7 @@ class _MyReplyState extends State<MyReply> with DynMixin {
|
||||
context: context,
|
||||
title: 'Clear Local Storage?',
|
||||
onConfirm: () {
|
||||
GStorage.reply.clear();
|
||||
GStorage.reply!.clear();
|
||||
_replies.clear();
|
||||
setState(() {});
|
||||
},
|
||||
@@ -112,10 +109,14 @@ class _MyReplyState extends State<MyReply> with DynMixin {
|
||||
}
|
||||
|
||||
void _onCheckReply(ReplyInfo replyInfo) {
|
||||
final oid = replyInfo.oid.toInt();
|
||||
ReplyUtils.onCheckReply(
|
||||
replyInfo: replyInfo,
|
||||
biliSendCommAntifraud: Pref.biliSendCommAntifraud,
|
||||
sourceId: null,
|
||||
sourceId: switch (oid) {
|
||||
1 => IdUtils.av2bv(oid),
|
||||
_ => oid.toString(),
|
||||
},
|
||||
isManual: true,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user