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:
My-Responsitories
2026-03-08 20:37:59 +08:00
committed by GitHub
parent 4ad422c3ea
commit f825f87dc1
8 changed files with 106 additions and 38 deletions

View File

@@ -41,6 +41,7 @@ import 'package:PiliPlus/utils/utils.dart';
import 'package:PiliPlus/utils/wbi_sign.dart';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart' show compute;
import 'package:protobuf/protobuf.dart';
/// view层根据 status 判断渲染逻辑
abstract final class VideoHttp {
@@ -559,11 +560,13 @@ abstract final class VideoHttp {
if (res.data['code'] == 0) {
try {
final replyInfo = RequestUtils.replyCast(res.data['data']['reply']);
GStorage.reply.put(
GStorage.reply?.put(
replyInfo.id.toString(),
(replyInfo.toProto3Json() as Map)
..remove('memberV2')
..remove('trackInfo'),
(replyInfo.deepCopy()
..unknownFields.clear()
..clearMemberV2()
..clearTrackInfo())
.writeToBuffer(),
);
return Success(replyInfo);
} catch (e, s) {
@@ -591,7 +594,7 @@ abstract final class VideoHttp {
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
GStorage.reply.delete(rpid.toString());
GStorage.reply?.delete(rpid.toString());
return const Success(null);
} else {
return const Error('请退出账号后重新登录');