Wire up AudioFeedArrayForCall
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>pull/21833/head
							parent
							
								
									b88033accc
								
							
						
					
					
						commit
						a220b8b572
					
				| 
						 | 
				
			
			@ -59,6 +59,9 @@ import { getKeyBindingsManager, NavigationAction, RoomAction } from '../../KeyBi
 | 
			
		|||
import { IOpts } from "../../createRoom";
 | 
			
		||||
import SpacePanel from "../views/spaces/SpacePanel";
 | 
			
		||||
import {replaceableComponent} from "../../utils/replaceableComponent";
 | 
			
		||||
import CallHandler, { CallHandlerEvent } from '../../CallHandler';
 | 
			
		||||
import { MatrixCall } from 'matrix-js-sdk/src/webrtc/call';
 | 
			
		||||
import AudioFeedArrayForCall from '../views/voip/AudioFeedArrayForCall';
 | 
			
		||||
 | 
			
		||||
// We need to fetch each pinned message individually (if we don't already have it)
 | 
			
		||||
// so each pinned message may trigger a request. Limit the number per room for sanity.
 | 
			
		||||
| 
						 | 
				
			
			@ -119,6 +122,7 @@ interface IState {
 | 
			
		|||
    usageLimitEventContent?: IUsageLimit;
 | 
			
		||||
    usageLimitEventTs?: number;
 | 
			
		||||
    useCompactLayout: boolean;
 | 
			
		||||
    activeCalls: Array<MatrixCall>;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -160,6 +164,7 @@ class LoggedInView extends React.Component<IProps, IState> {
 | 
			
		|||
            // use compact timeline view
 | 
			
		||||
            useCompactLayout: SettingsStore.getValue('useCompactLayout'),
 | 
			
		||||
            usageLimitDismissed: false,
 | 
			
		||||
            activeCalls: [],
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        // stash the MatrixClient in case we log out before we are unmounted
 | 
			
		||||
| 
						 | 
				
			
			@ -175,6 +180,7 @@ class LoggedInView extends React.Component<IProps, IState> {
 | 
			
		|||
 | 
			
		||||
    componentDidMount() {
 | 
			
		||||
        document.addEventListener('keydown', this._onNativeKeyDown, false);
 | 
			
		||||
        CallHandler.sharedInstance().addListener(CallHandlerEvent.CallsChanged, this.onCallsChanged);
 | 
			
		||||
 | 
			
		||||
        this._updateServerNoticeEvents();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -199,6 +205,7 @@ class LoggedInView extends React.Component<IProps, IState> {
 | 
			
		|||
 | 
			
		||||
    componentWillUnmount() {
 | 
			
		||||
        document.removeEventListener('keydown', this._onNativeKeyDown, false);
 | 
			
		||||
        CallHandler.sharedInstance().removeListener(CallHandlerEvent.CallsChanged, this.onCallsChanged);
 | 
			
		||||
        this._matrixClient.removeListener("accountData", this.onAccountData);
 | 
			
		||||
        this._matrixClient.removeListener("sync", this.onSync);
 | 
			
		||||
        this._matrixClient.removeListener("RoomState.events", this.onRoomStateEvents);
 | 
			
		||||
| 
						 | 
				
			
			@ -206,6 +213,12 @@ class LoggedInView extends React.Component<IProps, IState> {
 | 
			
		|||
        this.resizer.detach();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private onCallsChanged = () => {
 | 
			
		||||
        this.setState({
 | 
			
		||||
            activeCalls: CallHandler.sharedInstance().getAllActiveCalls(),
 | 
			
		||||
        });
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    // Child components assume that the client peg will not be null, so give them some
 | 
			
		||||
    // sort of assurance here by only allowing a re-render if the client is truthy.
 | 
			
		||||
    //
 | 
			
		||||
| 
						 | 
				
			
			@ -661,6 +674,12 @@ class LoggedInView extends React.Component<IProps, IState> {
 | 
			
		|||
            bodyClasses += ' mx_MatrixChat_useCompactLayout';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const audioFeedArraysForCalls = this.state.activeCalls.map((call) => {
 | 
			
		||||
            return (
 | 
			
		||||
                <AudioFeedArrayForCall call={call} key={call.callId} />
 | 
			
		||||
            );
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        return (
 | 
			
		||||
            <MatrixClientContext.Provider value={this._matrixClient}>
 | 
			
		||||
                <div
 | 
			
		||||
| 
						 | 
				
			
			@ -685,6 +704,7 @@ class LoggedInView extends React.Component<IProps, IState> {
 | 
			
		|||
                <CallContainer />
 | 
			
		||||
                <NonUrgentToastContainer />
 | 
			
		||||
                <HostSignupContainer />
 | 
			
		||||
                {audioFeedArraysForCalls}
 | 
			
		||||
            </MatrixClientContext.Provider>
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue