Skip to content

Commit 8e5b655

Browse files
compose: Configure button to generate video chat url on tap
This commit adds function and then Configure to generate jitsi unique meeting ID and to fetch video chat url as per realmVideoChatProvider
1 parent f635dfe commit 8e5b655

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

lib/widgets/compose_box.dart

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,33 @@ class _AttachVideoChatUrlButton extends StatelessWidget {
10401040
final ComposeBoxController controller;
10411041
final bool enabled;
10421042

1043+
static const int jitsi = 1;
1044+
static const int zoom = 2; //TODO: Add other supported video chat providers
1045+
1046+
String _generateJitsiUrl(String serverUrl, String visibleText) {
1047+
final id = List.generate(15, (_) => Random.secure().nextInt(10)).join();
1048+
return inlineLink(visibleText, '$serverUrl/$id#config.startWithVideoMuted=false');
1049+
}
1050+
1051+
String? _getMeetingUrl(ZulipLocalizations zulipLocalization, int? provider, String? jitsiServerUrl) {
1052+
final visibleText = zulipLocalization.composeBoxUploadedVideoCallUrl;
1053+
1054+
switch (provider) {
1055+
case 0: return null; //TODO: Implement feedback no video chat provider is setup
1056+
case jitsi: return jitsiServerUrl == null ? null :_generateJitsiUrl(jitsiServerUrl, visibleText);
1057+
case zoom: return inlineLink(visibleText,
1058+
'https://zoom.us/start/meeting');
1059+
default: return null;
1060+
}
1061+
}
1062+
10431063
void _handlePress(BuildContext context) {
1064+
final store = PerAccountStoreWidget.of(context);
1065+
final zulipLocalizations = ZulipLocalizations.of(context);
1066+
1067+
final placeholder = _getMeetingUrl(zulipLocalizations,
1068+
store.realmVideoChatProvider, store.jitsiServerUrl);
1069+
if (placeholder == null) return;
10441070
}
10451071

10461072
@override

0 commit comments

Comments
 (0)