opt: msg btn

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-10 00:28:09 +08:00
parent 9e4bc24365
commit 0510fbb65a
5 changed files with 223 additions and 144 deletions

View File

@@ -1,5 +1,11 @@
import 'package:PiliPlus/grpc/bilibili/app/im/v1.pb.dart'
show Offset, Session, SessionId, SessionMainReply, SessionPageType;
show
Offset,
Session,
SessionId,
SessionMainReply,
SessionPageType,
ThreeDotItem;
import 'package:PiliPlus/grpc/im.dart';
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/http/msg.dart';
@@ -18,6 +24,9 @@ class WhisperController
PbMap<int, Offset>? offset;
Rx<List<ThreeDotItem>?> threeDotItems = Rx<List<ThreeDotItem>?>(null);
Rx<List<ThreeDotItem>?> outsideItem = Rx<List<ThreeDotItem>?>(null);
@override
void onInit() {
super.onInit();
@@ -72,6 +81,16 @@ class WhisperController
return response.sessions;
}
@override
bool customHandleResponse(
bool isRefresh, Success<SessionMainReply> response) {
if (isRefresh) {
threeDotItems.value = response.response.threeDotItems;
outsideItem.value = response.response.outsideItem;
}
return false;
}
@override
Future<LoadingState<SessionMainReply>> customGetData() =>
ImGrpc.sessionMain(offset: offset);
@@ -140,4 +159,14 @@ class WhisperController
SmartDialog.showToast(res['msg']);
}
}
Future<void> onDeleteList() async {
var res = await ImGrpc.deleteSessionList(
pageType: SessionPageType.SESSION_PAGE_TYPE_HOME);
if (res['status']) {
loadingState.value = LoadingState.success(null);
} else {
SmartDialog.showToast(res['msg']);
}
}
}