File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
packages/stream_video/lib/src Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ const _tag = 'SV:Client';
5151const _idEvents = 1 ;
5252const _idAppState = 2 ;
5353const _idConnect = 3 ;
54+ const _idActiveCall = 4 ;
5455
5556const _defaultCoordinatorRpcUrl = 'https://video.stream-io-api.com/video' ;
5657const _defaultCoordinatorWsUrl = 'wss://video.stream-io-api.com/video/connect' ;
@@ -322,6 +323,13 @@ class StreamVideo {
322323 // Register device with push notification manager.
323324 pushNotificationManager? .registerDevice ();
324325
326+ if (pushNotificationManager != null ) {
327+ _subscriptions.add (
328+ _idActiveCall,
329+ _state.activeCall.listen (_onActiveCall),
330+ );
331+ }
332+
325333 return Result .success (tokenResult.data);
326334 } catch (e, stk) {
327335 _logger.e (() => '[connect] failed(${user .id }): $e ' );
@@ -421,6 +429,12 @@ class StreamVideo {
421429 }
422430 }
423431
432+ Future <void > _onActiveCall (Call ? activeCall) async {
433+ if (activeCall == null ) {
434+ await pushNotificationManager? .endAllCalls ();
435+ }
436+ }
437+
424438 StreamSubscription <Call ?> listenActiveCall (
425439 void Function (Call ? value)? onActiveCall,
426440 ) {
You can’t perform that action at this time.
0 commit comments