From fd4577ae84271cf0be96393d71b16346b3cf79c7 Mon Sep 17 00:00:00 2001 From: td Date: Mon, 27 Feb 2023 11:53:08 +0530 Subject: [PATCH] chore: stop stale group call checker on room leave --- lib/src/client.dart | 3 +++ lib/src/room.dart | 2 +- lib/src/voip/voip_room_extension.dart | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/src/client.dart b/lib/src/client.dart index 57891faa..6fca33c5 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -2136,6 +2136,9 @@ class Client extends MatrixApi { } // If the membership is "leave" then remove the item and stop here else if (found && membership == Membership.leave) { + // stop stale group call checker for left room. + room.stopStaleCallsChecker(room.id); + rooms.removeAt(roomIndex); } // Update notification, highlight count and/or additional informations diff --git a/lib/src/room.dart b/lib/src/room.dart index 12ff7299..8db8879b 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -142,8 +142,8 @@ class Room { setState(state); } } - partial = false; startStaleCallsChecker(id); + partial = false; } /// Returns the [Event] for the given [typeKey] and optional [stateKey]. diff --git a/lib/src/voip/voip_room_extension.dart b/lib/src/voip/voip_room_extension.dart index f52137e0..ba69c54c 100644 --- a/lib/src/voip/voip_room_extension.dart +++ b/lib/src/voip/voip_room_extension.dart @@ -47,6 +47,7 @@ extension GroupCallUtils on Room { void stopStaleCallsChecker(String roomId) { if (staleGroupCallsTimer.tryGet(roomId) != null) { staleGroupCallsTimer[roomId]!.cancel(); + Logs().d('stopped stale group calls checker for room $id'); } else { Logs().w('[VOIP] no stale call checker for room found'); } @@ -137,10 +138,10 @@ extension GroupCallUtils on Room { 'm.terminated': GroupCallTerminationReason.CallEnded, }); - Logs().d('[VOIP] Group call $groupCallId was killed uwu'); + Logs().i('[VOIP] Group call $groupCallId was killed uwu'); return req; } catch (e) { - Logs().i('killing stale call $groupCallId failed. reason: $e'); + Logs().e('killing stale call $groupCallId failed. reason: $e'); return null; } }