feat: Display progress on redact events and clear archive dialogs
This commit is contained in:
parent
e122bdeb98
commit
69bbfa5389
3 changed files with 28 additions and 11 deletions
|
|
@ -52,8 +52,10 @@ class ArchiveController extends State<Archive> {
|
|||
}
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () async {
|
||||
futureWithProgress: (onProgress) async {
|
||||
final count = archive.length;
|
||||
while (archive.isNotEmpty) {
|
||||
onProgress(1 - (archive.length / count));
|
||||
Logs().v('Forget room ${archive.last.getLocalizedDisplayname()}');
|
||||
await archive.last.forget();
|
||||
archive.removeLast();
|
||||
|
|
|
|||
|
|
@ -852,10 +852,12 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
: null;
|
||||
if (reasonInput == null) return;
|
||||
final reason = reasonInput.isEmpty ? null : reasonInput;
|
||||
for (final event in selectedEvents) {
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () async {
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
futureWithProgress: (onProgress) async {
|
||||
final count = selectedEvents.length;
|
||||
for (final (i, event) in selectedEvents.indexed) {
|
||||
onProgress(i / count);
|
||||
if (event.status.isSent) {
|
||||
if (event.canRedact) {
|
||||
await event.redactEvent(reason: reason);
|
||||
|
|
@ -875,9 +877,9 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
} else {
|
||||
await event.cancelSend();
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
setState(() {
|
||||
showEmojiPicker = false;
|
||||
selectedEvents.clear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue