chore: close level up / constructs notifications on close chat (#2656)
This commit is contained in:
parent
65a3425dd9
commit
7c3861d2a7
4 changed files with 18 additions and 8 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue