Voice rooms prototype (#8084)

* Add voice room labs flag

Signed-off-by: Robin Townsend <robin@robin.town>

* Add more widget actions for interacting with Jitsi

Signed-off-by: Robin Townsend <robin@robin.town>

* Factor out a more generic Jitsi creation utility

Signed-off-by: Robin Townsend <robin@robin.town>

* Add utilities for managing voice channels

Signed-off-by: Robin Townsend <robin@robin.town>

* Enable creation of voice rooms

Signed-off-by: Robin Townsend <robin@robin.town>

* Force a maximized view of voice channel widgets

Signed-off-by: Robin Townsend <robin@robin.town>

* Add voice channel store

Signed-off-by: Robin Townsend <robin@robin.town>

* Factor out a more generic FacePile

Signed-off-by: Robin Townsend <robin@robin.town>

* Implement room tile changes for voice rooms

Signed-off-by: Robin Townsend <robin@robin.town>

* Add interactive radio component to the left panel

Signed-off-by: Robin Townsend <robin@robin.town>

* Test voice rooms

Signed-off-by: Robin Townsend <robin@robin.town>

* Update name of call room type

Signed-off-by: Robin Townsend <robin@robin.town>

* Clarify that voice rooms are under development

Signed-off-by: Robin Townsend <robin@robin.town>

* Use readonly

Signed-off-by: Robin Townsend <robin@robin.town>

* Move acks to the end of handlers

Signed-off-by: Robin Townsend <robin@robin.town>

* Add comment about avatar URLs coming from Jitsi

Signed-off-by: Robin Townsend <robin@robin.town>

* Don't use unicode ellipses

for translation reasons?

Signed-off-by: Robin Townsend <robin@robin.town>

* Fix tests

Signed-off-by: Robin Townsend <robin@robin.town>

* Fix tests, again

Signed-off-by: Robin Townsend <robin@robin.town>

* Remove unnecessary export

Signed-off-by: Robin Townsend <robin@robin.town>

* Ack Jitsi events when we wait for them

Signed-off-by: Robin Townsend <robin@robin.town>
This commit is contained in:
Robin 2022-03-22 18:14:11 -04:00 committed by GitHub
parent f416a970ca
commit cfabcdda35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 1302 additions and 238 deletions

View file

@ -17,16 +17,20 @@ limitations under the License.
import React, { ChangeEvent, createRef, KeyboardEvent, SyntheticEvent } from "react";
import { Room } from "matrix-js-sdk/src/models/room";
import { RoomType } from "matrix-js-sdk/src/@types/event";
import { JoinRule, Preset, Visibility } from "matrix-js-sdk/src/@types/partials";
import SdkConfig from '../../../SdkConfig';
import SettingsStore from "../../../settings/SettingsStore";
import withValidation, { IFieldState } from '../elements/Validation';
import { _t } from '../../../languageHandler';
import { MatrixClientPeg } from '../../../MatrixClientPeg';
import { IOpts, privateShouldBeEncrypted } from "../../../createRoom";
import { CommunityPrototypeStore } from "../../../stores/CommunityPrototypeStore";
import { replaceableComponent } from "../../../utils/replaceableComponent";
import Heading from "../typography/Heading";
import Field from "../elements/Field";
import StyledRadioGroup from "../elements/StyledRadioGroup";
import RoomAliasField from "../elements/RoomAliasField";
import LabelledToggleSwitch from "../elements/LabelledToggleSwitch";
import DialogButtons from "../elements/DialogButtons";
@ -45,6 +49,7 @@ interface IProps {
}
interface IState {
type?: RoomType;
joinRule: JoinRule;
isPublic: boolean;
isEncrypted: boolean;
@ -76,6 +81,7 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
}
this.state = {
type: null,
isPublic: this.props.defaultPublic || false,
isEncrypted: this.props.defaultEncrypted ?? privateShouldBeEncrypted(),
joinRule,
@ -95,6 +101,7 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
private roomCreateOptions() {
const opts: IOpts = {};
const createOpts: IOpts["createOpts"] = opts.createOpts = {};
opts.roomType = this.state.type;
createOpts.name = this.state.name;
if (this.state.joinRule === JoinRule.Public) {
@ -178,6 +185,10 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
this.props.onFinished(false);
};
private onTypeChange = (type: RoomType | "text") => {
this.setState({ type: type === "text" ? null : type });
};
private onNameChange = (ev: ChangeEvent<HTMLInputElement>) => {
this.setState({ name: ev.target.value });
};
@ -337,6 +348,20 @@ export default class CreateRoomDialog extends React.Component<IProps, IState> {
>
<form onSubmit={this.onOk} onKeyDown={this.onKeyDown}>
<div className="mx_Dialog_content">
{ SettingsStore.getValue("feature_voice_rooms") ? <>
<Heading size="h3">{ _t("Room type") }</Heading>
<StyledRadioGroup
name="type"
value={this.state.type ?? "text"}
onChange={this.onTypeChange}
definitions={[
{ value: "text", label: _t("Text room") },
{ value: RoomType.UnstableCall, label: _t("Voice & video room") },
]}
/>
<Heading size="h3">{ _t("Room details") }</Heading>
</> : null }
<Field
ref={this.nameField}
label={_t('Name')}