diff --git a/.DS_Store b/.DS_Store index 7083c2c..2a939b0 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.lh/lib/view/screen/home_screen.dart.json b/.lh/lib/view/screen/home_screen.dart.json new file mode 100644 index 0000000..ece6899 --- /dev/null +++ b/.lh/lib/view/screen/home_screen.dart.json @@ -0,0 +1,18 @@ +{ + "sourceFile": "lib/view/screen/home_screen.dart", + "activeCommit": 0, + "commits": [ + { + "activePatchIndex": 0, + "patches": [ + { + "date": 1730906592729, + "content": "Index: \n===================================================================\n--- \n+++ \n" + } + ], + "date": 1730906592729, + "name": "Commit-0", + "content": "import 'package:flutter/material.dart';\nimport 'package:telnyx_flutter_webrtc/main_view_model.dart';\nimport 'package:provider/provider.dart';\nimport 'package:logger/logger.dart';\nimport 'package:telnyx_flutter_webrtc/view/screen/call_screen.dart';\nimport 'package:telnyx_flutter_webrtc/view/widgets/invitation_widget.dart';\n\nclass HomeScreen extends StatefulWidget {\n const HomeScreen({Key? key, required this.title}) : super(key: key);\n final String title;\n\n @override\n State createState() => _HomeScreenState();\n}\n\nclass _HomeScreenState extends State {\n final logger = Logger();\n TextEditingController destinationController = TextEditingController();\n\n bool invitation = false;\n bool ongoingCall = false;\n\n @override\n void initState() {\n super.initState();\n destinationController.text = 'isaac33882';\n }\n\n void _observeResponses() {\n Provider.of(context, listen: true).observeResponses();\n invitation =\n Provider.of(context, listen: true).ongoingInvitation;\n ongoingCall = Provider.of(context, listen: true).ongoingCall;\n }\n\n\n void _callDestination() {\n Provider.of(context, listen: false)\n .call(destinationController.text);\n logger.i('Calling!');\n }\n\n void _endCall() {\n Provider.of(context, listen: false)\n .endCall();\n logger.i('Calling!');\n }\n\n void handleOptionClick(String value) {\n switch (value) {\n case 'Logout':\n Provider.of(context, listen: false).disconnect();\n WidgetsBinding.instance.addPostFrameCallback((_) {\n Navigator.of(context).pushReplacementNamed('/');\n });\n logger.i('Disconnecting!');\n break;\n }\n }\n\n @override\n Widget build(BuildContext context) {\n _observeResponses();\n if (invitation) {\n return InvitationWidget(\n title: 'Home',\n invitation: Provider.of(context, listen: false)\n .incomingInvitation);\n } else if (ongoingCall) {\n return CallScreen(\n title: \"Ongoing Call\",\n call: Provider.of(context, listen: false).currentCall);\n } else {\n return Scaffold(\n appBar: AppBar(\n title: Text(widget.title),\n actions: [\n PopupMenuButton(\n onSelected: handleOptionClick,\n itemBuilder: (BuildContext context) {\n return {'Logout'}.map((String choice) {\n return PopupMenuItem(\n value: choice,\n child: Text(choice),\n );\n }).toList();\n },\n ),\n ],\n ),\n body: Center(\n child: Column(\n mainAxisAlignment: MainAxisAlignment.center,\n children: [\n Padding(\n padding: const EdgeInsets.all(8.0),\n child: TextFormField(\n controller: destinationController,\n decoration: const InputDecoration(\n border: OutlineInputBorder(),\n labelText: 'Destination',\n ),\n ),\n ),\n Padding(\n padding: const EdgeInsets.all(8.0),\n child: TextButton(\n style: TextButton.styleFrom(\n foregroundColor: Colors.blue,\n ),\n onPressed: () {\n _callDestination();\n },\n child: const Text('Call'),\n ),\n )\n ],\n ),\n ),\n );\n }\n }\n}\n" + } + ] +} \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index 6fd8858..fc748b3 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -59,6 +59,9 @@ android { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug + lintOptions { + abortOnError false + } } } } diff --git a/android/app/release/app-release.apk b/android/app/release/app-release.apk new file mode 100644 index 0000000..bcf3c99 Binary files /dev/null and b/android/app/release/app-release.apk differ diff --git a/android/app/release/output-metadata.json b/android/app/release/output-metadata.json new file mode 100644 index 0000000..8e60859 --- /dev/null +++ b/android/app/release/output-metadata.json @@ -0,0 +1,20 @@ +{ + "version": 3, + "artifactType": { + "type": "APK", + "kind": "Directory" + }, + "applicationId": "com.telnyx.telnyx_flutter_webrtc", + "variantName": "release", + "elements": [ + { + "type": "SINGLE", + "filters": [], + "attributes": [], + "versionCode": 1, + "versionName": "1.0.0", + "outputFile": "app-release.apk" + } + ], + "elementType": "File" +} \ No newline at end of file diff --git a/lib/view/screen/home_screen.dart b/lib/view/screen/home_screen.dart index d2ecb77..ebf846c 100644 --- a/lib/view/screen/home_screen.dart +++ b/lib/view/screen/home_screen.dart @@ -23,6 +23,7 @@ class _HomeScreenState extends State { @override void initState() { super.initState(); + destinationController.text = 'isaac33882'; } void _observeResponses() { @@ -32,7 +33,6 @@ class _HomeScreenState extends State { ongoingCall = Provider.of(context, listen: true).ongoingCall; } - void _callDestination() { Provider.of(context, listen: false) .call(destinationController.text); @@ -40,8 +40,7 @@ class _HomeScreenState extends State { } void _endCall() { - Provider.of(context, listen: false) - .endCall(); + Provider.of(context, listen: false).endCall(); logger.i('Calling!'); } diff --git a/packages/telnyx_webrtc/lib/telnyx_client.dart b/packages/telnyx_webrtc/lib/telnyx_client.dart index 8fcef21..2b7cf81 100644 --- a/packages/telnyx_webrtc/lib/telnyx_client.dart +++ b/packages/telnyx_webrtc/lib/telnyx_client.dart @@ -924,11 +924,10 @@ class TelnyxClient { case SocketMethod.ATTACH: { _logger.i('ATTACH RECEIVED :: $messageJson'); - _logger.i('INCOMING INVITATION :: $messageJson'); ReceivedMessage invite = ReceivedMessage.fromJson(jsonDecode(data.toString())); var message = TelnyxMessage( - socketMethod: SocketMethod.INVITE, message: invite); + socketMethod: SocketMethod.ATTACH, message: invite); //play ringtone for web Call offerCall = _createCall(); offerCall.callId = invite.inviteParams?.callID; @@ -943,8 +942,6 @@ class TelnyxClient { "State", isAttach: true); _pendingAnswerFromPush = false; - // offerCall.callHandler.changeState(CallState.active, offerCall); - break; } case SocketMethod.MEDIA: @@ -980,6 +977,10 @@ class TelnyxClient { } var message = TelnyxMessage( socketMethod: SocketMethod.ANSWER, message: inviteAnswer); + answerCall.callState = CallState.active; + + updateCall(answerCall); + if (inviteAnswer.inviteParams?.sdp != null) { answerCall ?.onRemoteSessionReceived(inviteAnswer.inviteParams?.sdp);