Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
"Voice" → "video" in more places
Browse files Browse the repository at this point in the history
  • Loading branch information
robintown committed Mar 31, 2022
1 parent 8c25675 commit 6ffdc45
Show file tree
Hide file tree
Showing 17 changed files with 125 additions and 125 deletions.
6 changes: 3 additions & 3 deletions src/Lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import dis from './dispatcher/dispatcher';
import DMRoomMap from './utils/DMRoomMap';
import Modal from './Modal';
import ActiveWidgetStore from './stores/ActiveWidgetStore';
import VoiceChannelStore from "./stores/VoiceChannelStore";
import VideoChannelStore from "./stores/VideoChannelStore";
import PlatformPeg from "./PlatformPeg";
import { sendLoginRequest } from "./Login";
import * as StorageManager from './utils/StorageManager';
Expand Down Expand Up @@ -797,7 +797,7 @@ async function startMatrixClient(startSyncing = true): Promise<void> {
IntegrationManagers.sharedInstance().startWatching();
ActiveWidgetStore.instance.start();
CallHandler.instance.start();
if (SettingsStore.getValue("feature_voice_rooms")) VoiceChannelStore.instance.start();
if (SettingsStore.getValue("feature_video_rooms")) VideoChannelStore.instance.start();

// Start Mjolnir even though we haven't checked the feature flag yet. Starting
// the thing just wastes CPU cycles, but should result in no actual functionality
Expand Down Expand Up @@ -911,7 +911,7 @@ export function stopMatrixClient(unsetClient = true): void {
UserActivity.sharedInstance().stop();
TypingStore.sharedInstance().reset();
Presence.stop();
if (SettingsStore.getValue("feature_voice_rooms")) VoiceChannelStore.instance.stop();
if (SettingsStore.getValue("feature_video_rooms")) VideoChannelStore.instance.stop();
ActiveWidgetStore.instance.stop();
IntegrationManagers.sharedInstance().stopWatching();
Mjolnir.sharedInstance().stop();
Expand Down
6 changes: 3 additions & 3 deletions src/components/structures/RoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ import EffectsOverlay from "../views/elements/EffectsOverlay";
import { containsEmoji } from '../../effects/utils';
import { CHAT_EFFECTS } from '../../effects';
import WidgetStore from "../../stores/WidgetStore";
import { getVoiceChannel } from "../../utils/VoiceChannelUtils";
import { getVideoChannel } from "../../utils/VideoChannelUtils";
import AppTile from "../views/elements/AppTile";
import { UPDATE_EVENT } from "../../stores/AsyncStore";
import Notifier from "../../Notifier";
Expand Down Expand Up @@ -375,7 +375,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
};

private getMainSplitContentType = (room: Room) => {
if (SettingsStore.getValue("feature_voice_rooms") && room.isCallRoom()) {
if (SettingsStore.getValue("feature_video_rooms") && room.isCallRoom()) {
return MainSplitContentType.Video;
}
if (WidgetLayoutStore.instance.hasMaximisedWidget(room)) {
Expand Down Expand Up @@ -2140,7 +2140,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
</>;
break;
case MainSplitContentType.Video: {
const app = getVoiceChannel(this.state.room.roomId);
const app = getVideoChannel(this.state.room.roomId);
if (!app) break;
mainSplitContentClassName = "mx_MainSplit_video";
mainSplitBody = <AppTile
Expand Down
4 changes: 2 additions & 2 deletions src/components/structures/SpaceRoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ const SpaceLandingAddButton = ({ space }) => {
const [menuDisplayed, handle, openMenu, closeMenu] = useContextMenu();
const canCreateRoom = shouldShowComponent(UIComponent.CreateRooms);
const canCreateSpace = shouldShowComponent(UIComponent.CreateSpaces);
const voiceRoomsEnabled = useFeatureEnabled("feature_voice_rooms");
const videoRoomsEnabled = useFeatureEnabled("feature_video_rooms");

let contextMenu;
if (menuDisplayed) {
Expand Down Expand Up @@ -339,7 +339,7 @@ const SpaceLandingAddButton = ({ space }) => {
}
}}
/>
{ voiceRoomsEnabled && <IconizedContextMenuOption
{ videoRoomsEnabled && <IconizedContextMenuOption
label={_t("New video room")}
iconClassName="mx_RoomList_iconNewVideoRoom"
onClick={async (e) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/context_menus/RoomContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const RoomContextMenu = ({ room, onFinished, ...props }: IProps) => {
}

const isDm = DMRoomMap.shared().getUserIdForRoomId(room.roomId);
const isVideoRoom = useFeatureEnabled("feature_voice_rooms") && room.isCallRoom();
const isVideoRoom = useFeatureEnabled("feature_video_rooms") && room.isCallRoom();

let inviteOption: JSX.Element;
if (room.canInvite(cli.getUserId()) && !isDm) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/right_panel/RoomSummaryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ const RoomSummaryCard: React.FC<IProps> = ({ room, onClose }) => {
const isRoomEncrypted = useIsEncrypted(cli, room);
const roomContext = useContext(RoomContext);
const e2eStatus = roomContext.e2eStatus;
const isVideoRoom = useFeatureEnabled("feature_voice_rooms") && room.isCallRoom();
const isVideoRoom = useFeatureEnabled("feature_video_rooms") && room.isCallRoom();

const alias = room.getCanonicalAlias() || room.getAltAliases()[0] || "";
const header = <React.Fragment>
Expand Down
4 changes: 2 additions & 2 deletions src/components/views/rooms/RoomList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ const UntaggedAuxButton = ({ tabIndex }: IAuxButtonProps) => {
tooltip={canAddRooms ? undefined
: _t("You do not have permissions to create new rooms in this space")}
/>
{ SettingsStore.getValue("feature_voice_rooms") && <IconizedContextMenuOption
{ SettingsStore.getValue("feature_video_rooms") && <IconizedContextMenuOption
label={_t("New video room")}
iconClassName="mx_RoomList_iconNewVideoRoom"
onClick={(e) => {
Expand Down Expand Up @@ -280,7 +280,7 @@ const UntaggedAuxButton = ({ tabIndex }: IAuxButtonProps) => {
PosthogTrackers.trackInteraction("WebRoomListRoomsSublistPlusMenuCreateRoomItem", e);
}}
/>
{ SettingsStore.getValue("feature_voice_rooms") && <IconizedContextMenuOption
{ SettingsStore.getValue("feature_video_rooms") && <IconizedContextMenuOption
label={_t("New video room")}
iconClassName="mx_RoomList_iconNewVideoRoom"
onClick={(e) => {
Expand Down
6 changes: 3 additions & 3 deletions src/components/views/rooms/RoomListHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const RoomListHeader = ({ onVisibilityChange }: IProps) => {
const allRoomsInHome = useEventEmitterState(SpaceStore.instance, UPDATE_HOME_BEHAVIOUR, () => {
return SpaceStore.instance.allRoomsInHome;
});
const voiceRoomsEnabled = useFeatureEnabled("feature_voice_rooms");
const videoRoomsEnabled = useFeatureEnabled("feature_video_rooms");
const pendingActions = usePendingActions();

const filterCondition = RoomListStore.instance.getFirstNameFilterCondition();
Expand Down Expand Up @@ -211,7 +211,7 @@ const RoomListHeader = ({ onVisibilityChange }: IProps) => {
closePlusMenu();
}}
/>
{ voiceRoomsEnabled && <IconizedContextMenuOption
{ videoRoomsEnabled && <IconizedContextMenuOption
iconClassName="mx_RoomListHeader_iconNewVideoRoom"
label={_t("New video room")}
onClick={(e) => {
Expand Down Expand Up @@ -302,7 +302,7 @@ const RoomListHeader = ({ onVisibilityChange }: IProps) => {
closePlusMenu();
}}
/>
{ voiceRoomsEnabled && <IconizedContextMenuOption
{ videoRoomsEnabled && <IconizedContextMenuOption
label={_t("New video room")}
iconClassName="mx_RoomListHeader_iconNewVideoRoom"
onClick={(e) => {
Expand Down
74 changes: 37 additions & 37 deletions src/components/views/rooms/RoomTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ import IconizedContextMenu, {
IconizedContextMenuOptionList,
IconizedContextMenuRadio,
} from "../context_menus/IconizedContextMenu";
import VoiceChannelStore, { VoiceChannelEvent, IJitsiParticipant } from "../../../stores/VoiceChannelStore";
import { getConnectedMembers } from "../../../utils/VoiceChannelUtils";
import VideoChannelStore, { VideoChannelEvent, IJitsiParticipant } from "../../../stores/VideoChannelStore";
import { getConnectedMembers } from "../../../utils/VideoChannelUtils";
import { replaceableComponent } from "../../../utils/replaceableComponent";
import PosthogTrackers from "../../../PosthogTrackers";
import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload";
import { KeyBindingAction } from "../../../accessibility/KeyboardShortcuts";
import { getKeyBindingsManager } from "../../../KeyBindingsManager";

enum VoiceStatus {
enum VideoStatus {
Disconnected,
Connected,
}
Expand All @@ -79,10 +79,10 @@ interface IState {
notificationsMenuPosition: PartialDOMRect;
generalMenuPosition: PartialDOMRect;
messagePreview?: string;
voiceStatus: VoiceStatus;
// Active voice channel members, according to room state
voiceMembers: RoomMember[];
// Active voice channel members, according to Jitsi
videoStatus: VideoStatus;
// Active video channel members, according to room state
videoMembers: RoomMember[];
// Active video channel members, according to Jitsi
jitsiParticipants: IJitsiParticipant[];
}

Expand All @@ -102,28 +102,28 @@ export default class RoomTile extends React.PureComponent<IProps, IState> {
private roomTileRef = createRef<HTMLDivElement>();
private notificationState: NotificationState;
private roomProps: RoomEchoChamber;
private isVoiceRoom: boolean;
private isVideoRoom: boolean;

constructor(props: IProps) {
super(props);

const voiceConnected = VoiceChannelStore.instance.roomId === this.props.room.roomId;
const videoConnected = VideoChannelStore.instance.roomId === this.props.room.roomId;

this.state = {
selected: ActiveRoomObserver.activeRoomId === this.props.room.roomId,
notificationsMenuPosition: null,
generalMenuPosition: null,
// generatePreview() will return nothing if the user has previews disabled
messagePreview: "",
voiceStatus: voiceConnected ? VoiceStatus.Connected : VoiceStatus.Disconnected,
voiceMembers: getConnectedMembers(this.props.room.currentState),
jitsiParticipants: voiceConnected ? VoiceChannelStore.instance.participants : [],
videoStatus: videoConnected ? VideoStatus.Connected : VideoStatus.Disconnected,
videoMembers: getConnectedMembers(this.props.room.currentState),
jitsiParticipants: videoConnected ? VideoChannelStore.instance.participants : [],
};
this.generatePreview();

this.notificationState = RoomNotificationStateStore.instance.getRoomState(this.props.room);
this.roomProps = EchoChamber.forRoom(this.props.room);
this.isVoiceRoom = SettingsStore.getValue("feature_voice_rooms") && this.props.room.isCallRoom();
this.isVideoRoom = SettingsStore.getValue("feature_video_rooms") && this.props.room.isCallRoom();
}

private onRoomNameUpdate = (room: Room) => {
Expand Down Expand Up @@ -162,9 +162,9 @@ export default class RoomTile extends React.PureComponent<IProps, IState> {
MessagePreviewStore.getPreviewChangedEventName(this.props.room),
this.onRoomPreviewChanged,
);
prevProps.room?.currentState?.off(RoomStateEvent.Events, this.updateVoiceMembers);
this.props.room?.currentState?.on(RoomStateEvent.Events, this.updateVoiceMembers);
this.updateVoiceStatus();
prevProps.room?.currentState?.off(RoomStateEvent.Events, this.updateVideoMembers);
this.props.room?.currentState?.on(RoomStateEvent.Events, this.updateVideoMembers);
this.updateVideoStatus();
prevProps.room?.off(RoomEvent.Name, this.onRoomNameUpdate);
this.props.room?.on(RoomEvent.Name, this.onRoomNameUpdate);
}
Expand All @@ -185,12 +185,12 @@ export default class RoomTile extends React.PureComponent<IProps, IState> {
this.notificationState.on(NotificationStateEvents.Update, this.onNotificationUpdate);
this.roomProps.on(PROPERTY_UPDATED, this.onRoomPropertyUpdate);
this.props.room?.on(RoomEvent.Name, this.onRoomNameUpdate);
this.props.room?.currentState?.on(RoomStateEvent.Events, this.updateVoiceMembers);
this.props.room?.currentState?.on(RoomStateEvent.Events, this.updateVideoMembers);

VoiceChannelStore.instance.on(VoiceChannelEvent.Connect, this.updateVoiceStatus);
VoiceChannelStore.instance.on(VoiceChannelEvent.Disconnect, this.updateVoiceStatus);
if (VoiceChannelStore.instance.roomId === this.props.room.roomId) {
VoiceChannelStore.instance.on(VoiceChannelEvent.Participants, this.updateJitsiParticipants);
VideoChannelStore.instance.on(VideoChannelEvent.Connect, this.updateVideoStatus);
VideoChannelStore.instance.on(VideoChannelEvent.Disconnect, this.updateVideoStatus);
if (VideoChannelStore.instance.roomId === this.props.room.roomId) {
VideoChannelStore.instance.on(VideoChannelEvent.Participants, this.updateJitsiParticipants);
}
}

Expand All @@ -201,16 +201,16 @@ export default class RoomTile extends React.PureComponent<IProps, IState> {
MessagePreviewStore.getPreviewChangedEventName(this.props.room),
this.onRoomPreviewChanged,
);
this.props.room.currentState.off(RoomStateEvent.Events, this.updateVoiceMembers);
this.props.room.currentState.off(RoomStateEvent.Events, this.updateVideoMembers);
this.props.room.off(RoomEvent.Name, this.onRoomNameUpdate);
}
ActiveRoomObserver.removeListener(this.props.room.roomId, this.onActiveRoomUpdate);
defaultDispatcher.unregister(this.dispatcherRef);
this.notificationState.off(NotificationStateEvents.Update, this.onNotificationUpdate);
this.roomProps.off(PROPERTY_UPDATED, this.onRoomPropertyUpdate);

VoiceChannelStore.instance.off(VoiceChannelEvent.Connect, this.updateVoiceStatus);
VoiceChannelStore.instance.off(VoiceChannelEvent.Disconnect, this.updateVoiceStatus);
VideoChannelStore.instance.off(VideoChannelEvent.Connect, this.updateVideoStatus);
VideoChannelStore.instance.off(VideoChannelEvent.Disconnect, this.updateVideoStatus);
}

private onAction = (payload: ActionPayload) => {
Expand Down Expand Up @@ -585,17 +585,17 @@ export default class RoomTile extends React.PureComponent<IProps, IState> {
);
}

private updateVoiceMembers = () => {
this.setState({ voiceMembers: getConnectedMembers(this.props.room.currentState) });
private updateVideoMembers = () => {
this.setState({ videoMembers: getConnectedMembers(this.props.room.currentState) });
};

private updateVoiceStatus = () => {
if (VoiceChannelStore.instance.roomId === this.props.room?.roomId) {
this.setState({ voiceStatus: VoiceStatus.Connected });
VoiceChannelStore.instance.on(VoiceChannelEvent.Participants, this.updateJitsiParticipants);
private updateVideoStatus = () => {
if (VideoChannelStore.instance.roomId === this.props.room?.roomId) {
this.setState({ videoStatus: VideoStatus.Connected });
VideoChannelStore.instance.on(VideoChannelEvent.Participants, this.updateJitsiParticipants);
} else {
this.setState({ voiceStatus: VoiceStatus.Disconnected });
VoiceChannelStore.instance.off(VoiceChannelEvent.Participants, this.updateJitsiParticipants);
this.setState({ videoStatus: VideoStatus.Disconnected });
VideoChannelStore.instance.off(VideoChannelEvent.Participants, this.updateJitsiParticipants);
}
};

Expand Down Expand Up @@ -630,18 +630,18 @@ export default class RoomTile extends React.PureComponent<IProps, IState> {
}

let subtitle;
if (this.isVoiceRoom) {
if (this.isVideoRoom) {
let videoText: string;
let videoActive: boolean;
let participantCount: number;

switch (this.state.voiceStatus) {
case VoiceStatus.Disconnected:
switch (this.state.videoStatus) {
case VideoStatus.Disconnected:
videoText = _t("Video");
videoActive = false;
participantCount = this.state.voiceMembers.length;
participantCount = this.state.videoMembers.length;
break;
case VoiceStatus.Connected:
case VideoStatus.Connected:
videoText = _t("Connected");
videoActive = true;
participantCount = this.state.jitsiParticipants.length;
Expand Down
8 changes: 4 additions & 4 deletions src/createRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { isJoinedOrNearlyJoined } from "./utils/membership";
import { VIRTUAL_ROOM_EVENT_TYPE } from "./CallHandler";
import SpaceStore from "./stores/spaces/SpaceStore";
import { makeSpaceParentEvent } from "./utils/space";
import { VOICE_CHANNEL_MEMBER, addVoiceChannel } from "./utils/VoiceChannelUtils";
import { VIDEO_CHANNEL_MEMBER, addVideoChannel } from "./utils/VideoChannelUtils";
import { Action } from "./dispatcher/actions";
import ErrorDialog from "./components/views/dialogs/ErrorDialog";
import Spinner from "./components/views/elements/Spinner";
Expand Down Expand Up @@ -128,11 +128,11 @@ export default async function createRoom(opts: IOpts): Promise<string | null> {
[RoomCreateTypeField]: opts.roomType,
};

// In video rooms, allow all users to send voice member updates
// In video rooms, allow all users to send video member updates
if (opts.roomType === RoomType.UnstableCall) {
createOpts.power_level_content_override = {
events: {
[VOICE_CHANNEL_MEMBER]: 0,
[VIDEO_CHANNEL_MEMBER]: 0,
// Annoyingly, we have to reiterate all the defaults here
[EventType.RoomName]: 50,
[EventType.RoomAvatar]: 50,
Expand Down Expand Up @@ -264,7 +264,7 @@ export default async function createRoom(opts: IOpts): Promise<string | null> {
}).then(() => {
// Set up video rooms with a Jitsi widget
if (opts.roomType === RoomType.UnstableCall) {
return addVoiceChannel(roomId, createOpts.name);
return addVideoChannel(roomId, createOpts.name);
}
}).then(function() {
// NB createRoom doesn't block on the client seeing the echo that the
Expand Down
2 changes: 1 addition & 1 deletion src/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export const SETTINGS: {[setting: string]: ISetting} = {
default: false,
controller: new CustomStatusController(),
},
"feature_voice_rooms": {
"feature_video_rooms": {
isFeature: true,
labsGroup: LabGroup.Rooms,
displayName: _td("Video rooms (under active development)"),
Expand Down
Loading

0 comments on commit 6ffdc45

Please sign in to comment.