1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-25 22:39:22 +00:00

Can join & leave the call

This commit is contained in:
Pierre HUBERT 2020-04-20 13:24:40 +02:00
parent da641515fa
commit 391d3150dd
2 changed files with 27 additions and 1 deletions

View File

@ -0,0 +1,15 @@
import 'package:comunic/helpers/websocket_helper.dart';
/// Calls helper
///
/// @author Pierre Hubert
class CallsHelper {
/// Join a call
static Future<void> join(int convID) async =>
ws("calls/join", {"convID": convID});
/// Leave a call
static Future<void> leave(int convID) async =>
ws("calls/leave", {"convID": convID});
}

View File

@ -1,3 +1,4 @@
import 'package:comunic/helpers/calls_helper.dart';
import 'package:comunic/helpers/conversations_helper.dart';
import 'package:comunic/models/conversation.dart';
import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
@ -54,13 +55,23 @@ class _CallScreenState extends SafeState<CallScreen> {
assert(_convName != null);
setState(() {});
// Join the call
await CallsHelper.join(convID);
} catch (e, stack) {
print("Could not initialize call! $e\n$stack");
setState(() => _error = true);
}
}
void _endCall() async {}
void _endCall() async {
try {
// Leave the call
await CallsHelper.leave(convID);
} catch (e, stack) {
print("Could not end call properly! $e\n$stack");
}
}
@override
Widget build(BuildContext context) {