mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: msg btn
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
import 'package:PiliPlus/grpc/bilibili/app/im/v1.pb.dart'
|
||||
show Offset, Session, SessionId, SessionPageType, SessionSecondaryReply;
|
||||
show
|
||||
Offset,
|
||||
Session,
|
||||
SessionId,
|
||||
SessionPageType,
|
||||
SessionSecondaryReply,
|
||||
ThreeDotItem;
|
||||
import 'package:PiliPlus/grpc/im.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/http/msg.dart';
|
||||
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:protobuf/protobuf.dart' show PbMap;
|
||||
|
||||
class WhisperSecController
|
||||
@@ -15,6 +22,7 @@ class WhisperSecController
|
||||
|
||||
PbMap<int, Offset>? offset;
|
||||
final SessionPageType sessionPageType;
|
||||
Rx<List<ThreeDotItem>?> threeDotItems = Rx<List<ThreeDotItem>?>(null);
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
@@ -33,9 +41,19 @@ class WhisperSecController
|
||||
if (response.paginationParams.hasMore == false) {
|
||||
isEnd = true;
|
||||
}
|
||||
|
||||
return response.sessions;
|
||||
}
|
||||
|
||||
@override
|
||||
bool customHandleResponse(
|
||||
bool isRefresh, Success<SessionSecondaryReply> response) {
|
||||
if (isRefresh) {
|
||||
threeDotItems.value = response.response.threeDotItems;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<LoadingState<SessionSecondaryReply>> customGetData() =>
|
||||
ImGrpc.sessionSecondary(
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import 'package:PiliPlus/common/skeleton/whisper_item.dart';
|
||||
import 'package:PiliPlus/common/widgets/dialog/dialog.dart';
|
||||
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
||||
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/grpc/bilibili/app/im/v1.pb.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/pages/whisper/widgets/item.dart';
|
||||
import 'package:PiliPlus/pages/whisper_secondary/controller.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -35,50 +35,40 @@ class _WhisperSecPageState extends State<WhisperSecPage> {
|
||||
appBar: AppBar(
|
||||
title: Text(widget.name),
|
||||
actions: [
|
||||
PopupMenuButton(
|
||||
itemBuilder: (context) {
|
||||
return [
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
showConfirmDialog(
|
||||
context: context,
|
||||
title: '一键已读',
|
||||
content: '是否清除全部新消息提醒?',
|
||||
onConfirm: _controller.onClearUnread,
|
||||
);
|
||||
},
|
||||
child: const Row(
|
||||
children: [
|
||||
Icon(
|
||||
size: 17,
|
||||
Icons.cleaning_services,
|
||||
),
|
||||
Text(' 一键已读'),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
showConfirmDialog(
|
||||
context: context,
|
||||
title: '清空列表',
|
||||
content: '清空后所有消息将被删除,无法恢复',
|
||||
onConfirm: _controller.onDeleteList,
|
||||
);
|
||||
},
|
||||
child: const Row(
|
||||
children: [
|
||||
Icon(
|
||||
size: 19,
|
||||
Icons.delete_forever_outlined,
|
||||
),
|
||||
Text(' 清空列表'),
|
||||
],
|
||||
),
|
||||
),
|
||||
];
|
||||
},
|
||||
),
|
||||
Obx(() {
|
||||
if (_controller.threeDotItems.value?.isNotEmpty == true) {
|
||||
return PopupMenuButton(
|
||||
itemBuilder: (context) {
|
||||
return _controller.threeDotItems.value!
|
||||
.map((e) => PopupMenuItem(
|
||||
onTap: () {
|
||||
e.type.action(
|
||||
context: context,
|
||||
onConfirm: () {
|
||||
switch (e.type) {
|
||||
case ThreeDotItemType
|
||||
.THREE_DOT_ITEM_TYPE_READ_ALL:
|
||||
_controller.onClearUnread();
|
||||
case ThreeDotItemType
|
||||
.THREE_DOT_ITEM_TYPE_CLEAR_LIST:
|
||||
_controller.onDeleteList();
|
||||
default:
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(size: 17, e.type.icon),
|
||||
Text(' ${e.title}'),
|
||||
],
|
||||
),
|
||||
))
|
||||
.toList();
|
||||
},
|
||||
);
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
}),
|
||||
],
|
||||
),
|
||||
body: refreshIndicator(
|
||||
|
||||
Reference in New Issue
Block a user