mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-03 19:54:12 +00:00 
			
		
		
		
	Handle call closed event
This commit is contained in:
		@@ -7,6 +7,7 @@ import 'package:comunic/lists/users_list.dart';
 | 
			
		||||
import 'package:comunic/models/call_config.dart';
 | 
			
		||||
import 'package:comunic/models/call_member.dart';
 | 
			
		||||
import 'package:comunic/models/conversation.dart';
 | 
			
		||||
import 'package:comunic/ui/routes/main_route.dart';
 | 
			
		||||
import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
 | 
			
		||||
import 'package:comunic/ui/widgets/safe_state.dart';
 | 
			
		||||
import 'package:comunic/utils/account_utils.dart';
 | 
			
		||||
@@ -88,12 +89,17 @@ class _CallScreenState extends SafeState<CallScreen> {
 | 
			
		||||
      this.listen<UserLeftCallEvent>((e) {
 | 
			
		||||
        if (e.callID == convID) _removeMember(e.userID);
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
      this.listen<CallClosedEvent>((e) {
 | 
			
		||||
        if (e.callID == convID) _leaveCall();
 | 
			
		||||
      });
 | 
			
		||||
    } catch (e, stack) {
 | 
			
		||||
      print("Could not initialize call! $e\n$stack");
 | 
			
		||||
      setState(() => _error = true);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Do clean up operations when call screen is destroyed
 | 
			
		||||
  void _endCall() async {
 | 
			
		||||
    try {
 | 
			
		||||
      // Leave the call
 | 
			
		||||
@@ -103,6 +109,11 @@ class _CallScreenState extends SafeState<CallScreen> {
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Make us leave the call
 | 
			
		||||
  void _leaveCall() {
 | 
			
		||||
    MainController.of(context).popPage();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void _removeMember(int memberID) {
 | 
			
		||||
    _membersList.removeUser(memberID);
 | 
			
		||||
    setState(() {});
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user