mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-19 08:36:17 +08:00
@@ -24,14 +24,15 @@ abstract class CommonWhisperController<R>
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> onSetTop(int index, bool isTop, SessionId sessionId) async {
|
||||
Future<void> onSetTop(
|
||||
Session item, int index, bool isTop, SessionId sessionId) async {
|
||||
var res = isTop
|
||||
? await ImGrpc.unpinSession(sessionId: sessionId)
|
||||
: await ImGrpc.pinSession(sessionId: sessionId);
|
||||
|
||||
if (res.isSuccess) {
|
||||
List<Session> list = loadingState.value.data!;
|
||||
list[index].isPinned = isTop ? false : true;
|
||||
item.isPinned = isTop ? false : true;
|
||||
if (!isTop) {
|
||||
list.insert(0, list.removeAt(index));
|
||||
}
|
||||
@@ -42,16 +43,15 @@ abstract class CommonWhisperController<R>
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> onSetMute(int index, bool isMuted, Int64 talkerUid) async {
|
||||
Future<void> onSetMute(Session item, 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();
|
||||
item.isMuted = !isMuted;
|
||||
loadingState.refresh();
|
||||
SmartDialog.showToast('操作成功');
|
||||
} else {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
|
||||
Reference in New Issue
Block a user