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:
parent
da641515fa
commit
391d3150dd
15
lib/helpers/calls_helper.dart
Normal file
15
lib/helpers/calls_helper.dart
Normal 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});
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:comunic/helpers/calls_helper.dart';
|
||||||
import 'package:comunic/helpers/conversations_helper.dart';
|
import 'package:comunic/helpers/conversations_helper.dart';
|
||||||
import 'package:comunic/models/conversation.dart';
|
import 'package:comunic/models/conversation.dart';
|
||||||
import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
|
import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
|
||||||
@ -54,13 +55,23 @@ class _CallScreenState extends SafeState<CallScreen> {
|
|||||||
assert(_convName != null);
|
assert(_convName != null);
|
||||||
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
|
||||||
|
// Join the call
|
||||||
|
await CallsHelper.join(convID);
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
print("Could not initialize call! $e\n$stack");
|
print("Could not initialize call! $e\n$stack");
|
||||||
setState(() => _error = true);
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
Loading…
Reference in New Issue
Block a user