From 8623942677d6ff634e85b5ff74e90e5100d25c25 Mon Sep 17 00:00:00 2001 From: Aamir-iMac Date: Thu, 18 May 2023 09:41:15 +0300 Subject: [PATCH] OnIos --- lib/classes/chat_call_kit.dart | 44 ++++++++++++++-------------- lib/classes/notifications.dart | 2 +- lib/provider/chat_call_provider.dart | 11 +++++-- 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/lib/classes/chat_call_kit.dart b/lib/classes/chat_call_kit.dart index 0ee3380..c2dc3e1 100644 --- a/lib/classes/chat_call_kit.dart +++ b/lib/classes/chat_call_kit.dart @@ -204,26 +204,26 @@ class ChatVoipCall { } on Exception {} } - void didChangeAppLifecycleState(AppLifecycleState state) { - super.didChangeAppLifecycleState(state); - switch (state) { - case AppLifecycleState.paused: - logger.i('paused'); - break; - case AppLifecycleState.inactive: - logger.i('inactive'); - break; - case AppLifecycleState.resumed: - logger.i('resumed'); - break; - case AppLifecycleState.detached: - logger.i('detached'); - break; - } - } - - @override - void dispose() { - WidgetsBinding.instance.removeObserver(this); - } + // void didChangeAppLifecycleState(AppLifecycleState state) { + // super.didChangeAppLifecycleState(state); + // switch (state) { + // case AppLifecycleState.paused: + // logger.i('paused'); + // break; + // case AppLifecycleState.inactive: + // logger.i('inactive'); + // break; + // case AppLifecycleState.resumed: + // logger.i('resumed'); + // break; + // case AppLifecycleState.detached: + // logger.i('detached'); + // break; + // } + // } + // + // @override + // void dispose() { + // WidgetsBinding.instance.removeObserver(this); + // } } diff --git a/lib/classes/notifications.dart b/lib/classes/notifications.dart index 4e1361d..336af50 100644 --- a/lib/classes/notifications.dart +++ b/lib/classes/notifications.dart @@ -139,7 +139,7 @@ class AppNotifications extends WidgetsBindingObserver { } } -} + AndroidNotificationChannel channel = const AndroidNotificationChannel( "high_importance_channel", diff --git a/lib/provider/chat_call_provider.dart b/lib/provider/chat_call_provider.dart index 3e8c996..7fae5f4 100644 --- a/lib/provider/chat_call_provider.dart +++ b/lib/provider/chat_call_provider.dart @@ -205,7 +205,6 @@ class ChatCallProvider with ChangeNotifier, DiagnosticableTreeMixin { print("------------------ PC Stopped ----------------------------"); _pc.close(); _pc.dispose(); - _pc.close(); } isCallStarted = false; isVideoCall = false; @@ -217,6 +216,9 @@ class ChatCallProvider with ChangeNotifier, DiagnosticableTreeMixin { isIncomingCall = false; if (chatHubConnection != null) { chatHubConnection.stop(); + await localVideoRenderer.dispose(); + localStream.dispose(); + remoteRenderer.dispose(); } return true; } else { @@ -229,7 +231,9 @@ class ChatCallProvider with ChangeNotifier, DiagnosticableTreeMixin { if (_pc.connectionState == RTCPeerConnectionState.RTCPeerConnectionStateConnected) { _pc.close(); _pc.dispose(); - _pc.close(); + localStream.dispose(); + remoteRenderer.dispose(); + } isCallStarted = false; isVideoCall = false; @@ -237,6 +241,7 @@ class ChatCallProvider with ChangeNotifier, DiagnosticableTreeMixin { isMicOff = false; isLoudSpeaker = false; localVideoRenderer.srcObject = null; + await localVideoRenderer.dispose(); remoteRenderer.srcObject = null; isOutGoingCall = false; return true; @@ -273,7 +278,7 @@ class ChatCallProvider with ChangeNotifier, DiagnosticableTreeMixin { // isEndedByCaller = true; endCall().then((bool value) { Navigator.of(AppRoutes.navigatorKey.currentContext!).pop(); - notifyListeners(); + // notifyListeners(); isCallEnded = true; }); }