mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-24 19:16:44 +08:00
feat: setMsgDnd
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -4,6 +4,8 @@ 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:PiliPlus/utils/storage.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
|
||||
abstract class CommonWhisperController<R>
|
||||
@@ -40,6 +42,22 @@ abstract class CommonWhisperController<R>
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> onSetMute(int index, bool isMuted, Int64 talkerUid) async {
|
||||
var res = await MsgHttp.setMsgDnd(
|
||||
uid: Accounts.main.mid,
|
||||
setting: isMuted ? 0 : 1,
|
||||
dndUid: talkerUid,
|
||||
);
|
||||
if (res['status']) {
|
||||
loadingState
|
||||
..value.data![index].isMuted = !isMuted
|
||||
..refresh();
|
||||
SmartDialog.showToast('操作成功');
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> onClearUnread() async {
|
||||
final res = await ImGrpc.clearUnread(pageType: sessionPageType);
|
||||
if (res.isSuccess) {
|
||||
|
||||
Reference in New Issue
Block a user