mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-12-26 04:48:51 +00:00
Add confirmation to leave call
This commit is contained in:
parent
456df166b1
commit
0f99e807f8
@ -8,7 +8,6 @@ import 'package:comunic/models/call_config.dart';
|
||||
import 'package:comunic/models/call_member.dart';
|
||||
import 'package:comunic/models/conversation.dart';
|
||||
import 'package:comunic/ui/routes/main_route.dart';
|
||||
import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
|
||||
import 'package:comunic/ui/widgets/safe_state.dart';
|
||||
import 'package:comunic/utils/account_utils.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
@ -91,7 +90,7 @@ class _CallScreenState extends SafeState<CallScreen> {
|
||||
});
|
||||
|
||||
this.listen<CallClosedEvent>((e) {
|
||||
if (e.callID == convID) _leaveCall();
|
||||
if (e.callID == convID) _leaveCall(needConfirm: false);
|
||||
});
|
||||
} catch (e, stack) {
|
||||
print("Could not initialize call! $e\n$stack");
|
||||
@ -110,7 +109,12 @@ class _CallScreenState extends SafeState<CallScreen> {
|
||||
}
|
||||
|
||||
// Make us leave the call
|
||||
void _leaveCall() {
|
||||
void _leaveCall({bool needConfirm = true}) async {
|
||||
if (needConfirm &&
|
||||
!await showConfirmDialog(
|
||||
context: context,
|
||||
message: tr("Do you really want to leave this call ?"))) return;
|
||||
|
||||
MainController.of(context).popPage();
|
||||
}
|
||||
|
||||
@ -123,7 +127,10 @@ class _CallScreenState extends SafeState<CallScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: ComunicBackButton(),
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back),
|
||||
onPressed: () => _leaveCall(),
|
||||
),
|
||||
title:
|
||||
_convName == null ? CircularProgressIndicator() : Text(_convName),
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user