chore: update pin button after pinning / unpinning a message
This commit is contained in:
parent
709a0e55c1
commit
646723d7ca
2 changed files with 17 additions and 3 deletions
|
|
@ -1856,7 +1856,10 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
}
|
||||
}
|
||||
|
||||
void pinEvent() {
|
||||
// #Pangea
|
||||
// void pinEvent() {
|
||||
Future<void> pinEvent() async {
|
||||
// Pangea#
|
||||
final pinnedEventIds = room.pinnedEventIds;
|
||||
final selectedEventIds = selectedEvents.map((e) => e.eventId).toSet();
|
||||
final unpin = selectedEventIds.length == 1 &&
|
||||
|
|
@ -1866,10 +1869,16 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
} else {
|
||||
pinnedEventIds.addAll(selectedEventIds);
|
||||
}
|
||||
showFutureLoadingDialog(
|
||||
// #Pangea
|
||||
// showFutureLoadingDialog(
|
||||
// context: context,
|
||||
// future: () => room.setPinnedEvents(pinnedEventIds),
|
||||
// );
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => room.setPinnedEvents(pinnedEventIds),
|
||||
);
|
||||
// Pangea#
|
||||
}
|
||||
|
||||
Timer? _storeInputTimeoutTimer;
|
||||
|
|
|
|||
|
|
@ -109,10 +109,15 @@ class OverlayHeaderState extends State<OverlayHeader> {
|
|||
icon: pinned
|
||||
? const Icon(Icons.push_pin)
|
||||
: const Icon(Icons.push_pin_outlined),
|
||||
onPressed: controller.pinEvent,
|
||||
onPressed: () {
|
||||
controller
|
||||
.pinEvent()
|
||||
.then((_) => setState(() {}));
|
||||
},
|
||||
tooltip: pinned ? l10n.unpin : l10n.pinMessage,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
|
||||
if (controller.canEditSelectedEvents &&
|
||||
!controller.selectedEvents.first.isActivityMessage)
|
||||
IconButton(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue