Make the hangup button do things for conference calls
Behaviour constraints: * If you're not in the conference, use a grey button that does nothing. * If you're in the conference, show a button: * If you're able to modify widgets in the room, annotate it in the context of ending the call for everyone and remove the widget. Use a confirmation dialog. * If you're not able to modify widgets in the room, hang up. For this we know that persistent Jitsi widgets will mean that the user is in the call, so we use that to determine if they are actually participating.
This commit is contained in:
@@ -22,6 +22,7 @@ import { AsyncStoreWithClient } from "./AsyncStoreWithClient";
|
||||
import defaultDispatcher from "../dispatcher/dispatcher";
|
||||
import SettingsStore from "../settings/SettingsStore";
|
||||
import WidgetEchoStore from "../stores/WidgetEchoStore";
|
||||
import ActiveWidgetStore from "../stores/ActiveWidgetStore";
|
||||
import WidgetUtils from "../utils/WidgetUtils";
|
||||
import {SettingLevel} from "../settings/SettingLevel";
|
||||
import {WidgetType} from "../widgets/WidgetType";
|
||||
@@ -206,6 +207,24 @@ export default class WidgetStore extends AsyncStoreWithClient<IState> {
|
||||
}
|
||||
return roomInfo.widgets;
|
||||
}
|
||||
|
||||
public doesRoomHaveConference(room: Room): boolean {
|
||||
const roomInfo = this.getRoom(room.roomId);
|
||||
if (!roomInfo) return false;
|
||||
|
||||
const currentWidgets = roomInfo.widgets.filter(w => WidgetType.JITSI.matches(w.type));
|
||||
const hasPendingWidgets = WidgetEchoStore.roomHasPendingWidgetsOfType(room.roomId, [], WidgetType.JITSI);
|
||||
return currentWidgets.length > 0 || hasPendingWidgets;
|
||||
}
|
||||
|
||||
public isJoinedToConferenceIn(room: Room): boolean {
|
||||
const roomInfo = this.getRoom(room.roomId);
|
||||
if (!roomInfo) return false;
|
||||
|
||||
// A persistent conference widget indicates that we're participating
|
||||
const widgets = roomInfo.widgets.filter(w => WidgetType.JITSI.matches(w.type));
|
||||
return widgets.some(w => ActiveWidgetStore.getWidgetPersistence(w.id));
|
||||
}
|
||||
}
|
||||
|
||||
window.mxWidgetStore = WidgetStore.instance;
|
||||
|
||||
Reference in New Issue
Block a user