chore: close level up / constructs notifications on close chat (#2656)

This commit is contained in:
ggurdin 2025-05-05 12:19:29 -04:00 committed by GitHub
parent 65a3425dd9
commit 7c3861d2a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 8 deletions

View file

@ -660,7 +660,7 @@ class ChatController extends State<ChatPageWithRoom>
//#Pangea
choreographer.stateStream.close();
choreographer.dispose();
MatrixState.pAnyState.closeAllOverlays();
MatrixState.pAnyState.closeAllOverlays(force: true);
showToolbarStream.close();
stopAudioStream.close();
hideTextController.dispose();

View file

@ -202,7 +202,9 @@ class IgcController {
}
choreographer.chatController.inputFocus.unfocus();
MatrixState.pAnyState.closeAllOverlays(RegExp(r'span_card_overlay_\d+'));
MatrixState.pAnyState.closeAllOverlays(
filter: RegExp(r'span_card_overlay_\d+'),
);
OverlayUtil.showPositionedCard(
overlayKey: "span_card_overlay_$firstMatchIndex",
context: context,

View file

@ -110,7 +110,9 @@ class PangeaTextController extends TextEditingController {
: null;
if (cardToShow != null) {
MatrixState.pAnyState.closeAllOverlays(RegExp(r'span_card_overlay_\d+'));
MatrixState.pAnyState.closeAllOverlays(
filter: RegExp(r'span_card_overlay_\d+'),
);
OverlayUtil.showPositionedCard(
overlayKey: matchIndex != -1 ? "span_card_overlay_$matchIndex" : null,
context: context,

View file

@ -92,13 +92,19 @@ class PangeaAnyState {
}
}
void closeAllOverlays([RegExp? regex]) {
List<OverlayListEntry> shouldRemove =
entries.where((element) => element.canPop).toList();
if (regex != null) {
void closeAllOverlays({
RegExp? filter,
force = false,
}) {
List<OverlayListEntry> shouldRemove = List.from(entries);
if (!force) {
shouldRemove = shouldRemove.where((element) => element.canPop).toList();
}
if (filter != null) {
shouldRemove = shouldRemove
.where((element) => element.key != null)
.where((element) => regex.hasMatch(element.key!))
.where((element) => filter.hasMatch(element.key!))
.toList();
}
if (shouldRemove.isEmpty) return;