Implement jitsi
This commit is contained in:
parent
d110910ef0
commit
f721045d00
7 changed files with 145 additions and 22 deletions
|
|
@ -6,6 +6,7 @@ import 'package:fluffychat/utils/app_route.dart';
|
|||
import 'package:fluffychat/views/chat_details.dart';
|
||||
import 'package:fluffychat/views/chat_list.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import 'dialogs/simple_dialogs.dart';
|
||||
import 'matrix.dart';
|
||||
|
|
@ -29,6 +30,18 @@ class _ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
|||
super.dispose();
|
||||
}
|
||||
|
||||
void startCallAction(BuildContext context) async {
|
||||
final url =
|
||||
'${Matrix.of(context).jitsiInstance}${Uri.encodeComponent(widget.room.id.localpart)}';
|
||||
final success = await Matrix.of(context)
|
||||
.tryRequestWithLoadingDialog(widget.room.sendEvent({
|
||||
'msgtype': Matrix.callNamespace,
|
||||
'body': url,
|
||||
}));
|
||||
if (success == false) return;
|
||||
await launch(url);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
notificationChangeSub ??= Matrix.of(context)
|
||||
|
|
@ -49,6 +62,10 @@ class _ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
|||
value: "unmute",
|
||||
child: Text(I18n.of(context).unmuteChat),
|
||||
),
|
||||
PopupMenuItem<String>(
|
||||
value: "call",
|
||||
child: Text(I18n.of(context).videoCall),
|
||||
),
|
||||
PopupMenuItem<String>(
|
||||
value: "leave",
|
||||
child: Text(I18n.of(context).leave),
|
||||
|
|
@ -86,6 +103,9 @@ class _ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
|||
await Matrix.of(context).tryRequestWithLoadingDialog(
|
||||
widget.room.setPushRuleState(PushRuleState.notify));
|
||||
break;
|
||||
case "call":
|
||||
startCallAction(context);
|
||||
break;
|
||||
case "details":
|
||||
await Navigator.of(context).push(
|
||||
AppRoute.defaultRoute(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue