diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 0a5a765..f778073 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1,2 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"firebase_core","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/firebase_core-2.24.0/","native_build":true,"dependencies":[]},{"name":"firebase_messaging","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/firebase_messaging-14.7.6/","native_build":true,"dependencies":["firebase_core"]},{"name":"flutter_callkit_incoming","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_callkit_incoming-2.0.0+2/","native_build":true,"dependencies":[]},{"name":"flutter_local_notifications","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_local_notifications-16.2.0/","native_build":true,"dependencies":[]},{"name":"flutter_webrtc","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_webrtc-0.9.47/","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/fluttertoast-8.2.4/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"permission_handler_apple","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/permission_handler_apple-9.2.0/","native_build":true,"dependencies":[]}],"android":[{"name":"firebase_core","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/firebase_core-2.24.0/","native_build":true,"dependencies":[]},{"name":"firebase_messaging","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/firebase_messaging-14.7.6/","native_build":true,"dependencies":["firebase_core"]},{"name":"flutter_callkit_incoming","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_callkit_incoming-2.0.0+2/","native_build":true,"dependencies":[]},{"name":"flutter_local_notifications","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_local_notifications-16.2.0/","native_build":true,"dependencies":[]},{"name":"flutter_webrtc","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_webrtc-0.9.47/","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/fluttertoast-8.2.4/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/path_provider_android-2.2.1/","native_build":true,"dependencies":[]},{"name":"permission_handler_android","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/permission_handler_android-12.0.1/","native_build":true,"dependencies":[]}],"macos":[{"name":"firebase_core","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/firebase_core-2.24.0/","native_build":true,"dependencies":[]},{"name":"firebase_messaging","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/firebase_messaging-14.7.6/","native_build":true,"dependencies":["firebase_core"]},{"name":"flutter_local_notifications","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_local_notifications-16.2.0/","native_build":true,"dependencies":[]},{"name":"flutter_webrtc","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_webrtc-0.9.47/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"flutter_webrtc","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_webrtc-0.9.47/","native_build":true,"dependencies":[]},{"name":"path_provider_linux","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"firebase_core","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/firebase_core-2.24.0/","native_build":true,"dependencies":[]},{"name":"flutter_webrtc","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_webrtc-0.9.47/","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/","native_build":false,"dependencies":[]},{"name":"permission_handler_windows","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/permission_handler_windows-0.2.0/","native_build":true,"dependencies":[]}],"web":[{"name":"firebase_core_web","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/firebase_core_web-2.9.0/","dependencies":[]},{"name":"firebase_messaging_web","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/firebase_messaging_web-3.5.15/","dependencies":["firebase_core_web"]},{"name":"fluttertoast","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/fluttertoast-8.2.4/","dependencies":[]},{"name":"permission_handler_html","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/permission_handler_html-0.1.0+1/","dependencies":[]}]},"dependencyGraph":[{"name":"firebase_core","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","dependencies":[]},{"name":"firebase_messaging","dependencies":["firebase_core","firebase_messaging_web"]},{"name":"firebase_messaging_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"flutter_callkit_incoming","dependencies":[]},{"name":"flutter_local_notifications","dependencies":[]},{"name":"flutter_webrtc","dependencies":["path_provider"]},{"name":"fluttertoast","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"permission_handler","dependencies":["permission_handler_android","permission_handler_apple","permission_handler_html","permission_handler_windows"]},{"name":"permission_handler_android","dependencies":[]},{"name":"permission_handler_apple","dependencies":[]},{"name":"permission_handler_html","dependencies":[]},{"name":"permission_handler_windows","dependencies":[]}],"date_created":"2023-12-12 10:20:19.414819","version":"3.16.1"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"firebase_core","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/firebase_core-2.24.0/","native_build":true,"dependencies":[]},{"name":"firebase_messaging","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/firebase_messaging-14.7.6/","native_build":true,"dependencies":["firebase_core"]},{"name":"flutter_callkit_incoming","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_callkit_incoming-2.0.0+2/","native_build":true,"dependencies":[]},{"name":"flutter_local_notifications","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_local_notifications-16.2.0/","native_build":true,"dependencies":[]},{"name":"flutter_webrtc","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_webrtc-0.9.47/","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/fluttertoast-8.2.4/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"permission_handler_apple","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/permission_handler_apple-9.2.0/","native_build":true,"dependencies":[]}],"android":[{"name":"firebase_core","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/firebase_core-2.24.0/","native_build":true,"dependencies":[]},{"name":"firebase_messaging","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/firebase_messaging-14.7.6/","native_build":true,"dependencies":["firebase_core"]},{"name":"flutter_callkit_incoming","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_callkit_incoming-2.0.0+2/","native_build":true,"dependencies":[]},{"name":"flutter_local_notifications","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_local_notifications-16.2.0/","native_build":true,"dependencies":[]},{"name":"flutter_webrtc","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_webrtc-0.9.47/","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/fluttertoast-8.2.4/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/path_provider_android-2.2.1/","native_build":true,"dependencies":[]},{"name":"permission_handler_android","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/permission_handler_android-12.0.1/","native_build":true,"dependencies":[]}],"macos":[{"name":"firebase_core","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/firebase_core-2.24.0/","native_build":true,"dependencies":[]},{"name":"firebase_messaging","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/firebase_messaging-14.7.6/","native_build":true,"dependencies":["firebase_core"]},{"name":"flutter_local_notifications","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_local_notifications-16.2.0/","native_build":true,"dependencies":[]},{"name":"flutter_webrtc","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_webrtc-0.9.47/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"flutter_webrtc","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_webrtc-0.9.47/","native_build":true,"dependencies":[]},{"name":"path_provider_linux","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"firebase_core","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/firebase_core-2.24.0/","native_build":true,"dependencies":[]},{"name":"flutter_webrtc","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/flutter_webrtc-0.9.47/","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/","native_build":false,"dependencies":[]},{"name":"permission_handler_windows","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/permission_handler_windows-0.2.0/","native_build":true,"dependencies":[]}],"web":[{"name":"firebase_core_web","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/firebase_core_web-2.9.0/","dependencies":[]},{"name":"firebase_messaging_web","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/firebase_messaging_web-3.5.15/","dependencies":["firebase_core_web"]},{"name":"fluttertoast","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/fluttertoast-8.2.4/","dependencies":[]},{"name":"permission_handler_html","path":"/Users/isaacakakpo/.pub-cache/hosted/pub.dev/permission_handler_html-0.1.0+1/","dependencies":[]}]},"dependencyGraph":[{"name":"firebase_core","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","dependencies":[]},{"name":"firebase_messaging","dependencies":["firebase_core","firebase_messaging_web"]},{"name":"firebase_messaging_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"flutter_callkit_incoming","dependencies":[]},{"name":"flutter_local_notifications","dependencies":[]},{"name":"flutter_webrtc","dependencies":["path_provider"]},{"name":"fluttertoast","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"permission_handler","dependencies":["permission_handler_android","permission_handler_apple","permission_handler_html","permission_handler_windows"]},{"name":"permission_handler_android","dependencies":[]},{"name":"permission_handler_apple","dependencies":[]},{"name":"permission_handler_html","dependencies":[]},{"name":"permission_handler_windows","dependencies":[]}],"date_created":"2023-12-12 10:20:19.414819","version":"3.16.1"} + diff --git a/lib/view/screen/login_screen.dart b/lib/view/screen/login_screen.dart index 55e10b4..e6b85c6 100644 --- a/lib/view/screen/login_screen.dart +++ b/lib/view/screen/login_screen.dart @@ -141,4 +141,14 @@ class _LoginScreenState extends State { ), ); } + + void _showToast(BuildContext context,String text) { + final scaffold = ScaffoldMessenger.of(context); + scaffold.showSnackBar( + SnackBar( + content: Text('$text'), + action: SnackBarAction(label: 'OKAY', onPressed: scaffold.hideCurrentSnackBar), + ), + ); + } } diff --git a/packages/telnyx_webrtc/lib/model/telnyx_socket_error.dart b/packages/telnyx_webrtc/lib/model/telnyx_socket_error.dart index 6ca20c3..34bc31a 100644 --- a/packages/telnyx_webrtc/lib/model/telnyx_socket_error.dart +++ b/packages/telnyx_webrtc/lib/model/telnyx_socket_error.dart @@ -1,8 +1,13 @@ class TelnyxSocketError { - int errorCode; - String errorMessage; + int errorCode = 0; + String errorMessage = ''; TelnyxSocketError({required this.errorCode, required this.errorMessage}); + + TelnyxSocketError.fromJson(Map json) { + errorCode = json['code'] ?? 0; + errorMessage = json['message'] ?? ''; + } } class TelnyxErrorConstants { diff --git a/packages/telnyx_webrtc/lib/model/verto/receive/received_message_body.dart b/packages/telnyx_webrtc/lib/model/verto/receive/received_message_body.dart index 33e7146..71cec37 100644 --- a/packages/telnyx_webrtc/lib/model/verto/receive/received_message_body.dart +++ b/packages/telnyx_webrtc/lib/model/verto/receive/received_message_body.dart @@ -1,6 +1,6 @@ import 'package:logger/logger.dart'; - import '../send/invite_answer_message_body.dart'; +import 'package:telnyx_webrtc/model/telnyx_socket_error.dart'; class ReceivedMessage { String? jsonrpc; @@ -69,6 +69,7 @@ class ReceivedResult { String? id; ResultParams? resultParams; String? sessId; + TelnyxSocketError? error; ReceivedResult( {this.jsonrpc, @@ -81,6 +82,9 @@ class ReceivedResult { resultParams = json['result'] != null ? ResultParams.fromJson(json['result']) : null; sessId = json['sessid']; + error = json['error'] != null + ? TelnyxSocketError.fromJson(json['error']) + : null; } Map toJson() { diff --git a/packages/telnyx_webrtc/lib/telnyx_client.dart b/packages/telnyx_webrtc/lib/telnyx_client.dart index 343347c..011aeaf 100644 --- a/packages/telnyx_webrtc/lib/telnyx_client.dart +++ b/packages/telnyx_webrtc/lib/telnyx_client.dart @@ -234,6 +234,19 @@ class TelnyxClient { if (data.toString().trim().isNotEmpty) { _logger.i('Received WebSocket message :: ${data.toString().trim()}'); + if(data.toString().trim().contains("error")){ + var errorJson = jsonEncode(data.toString()); + _logger + .i('Received WebSocket message - Contains Error :: $errorJson'); + try { + ReceivedResult errorResult = + ReceivedResult.fromJson(jsonDecode(data.toString())); + onSocketErrorReceived.call(errorResult.error!); + } on Exception catch (e) { + _logger.e('Error parsing JSON: $e'); + } + } + //Login success if (data.toString().trim().contains("result")) { var paramJson = jsonEncode(data.toString()); @@ -308,7 +321,8 @@ class TelnyxClient { } on Exception catch (e) { _logger.e('Error parsing JSON: $e'); } - } else if (data.toString().trim().contains("method")) { + } + else if (data.toString().trim().contains("method")) { //Received Telnyx Method Message var messageJson = jsonDecode(data.toString()); _logger.i( @@ -426,7 +440,8 @@ class TelnyxClient { break; } } - } else { + } + else { _logger.i('Received and ignored empty packet'); } } else {