You've already forked matrix-react-sdk
							
							
				mirror of
				https://github.com/matrix-org/matrix-react-sdk.git
				synced 2025-11-04 11:51:45 +03:00 
			
		
		
		
	Wire up AudioFeedArrayForCall
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
		@@ -59,6 +59,9 @@ import { getKeyBindingsManager, NavigationAction, RoomAction } from '../../KeyBi
 | 
				
			|||||||
import { IOpts } from "../../createRoom";
 | 
					import { IOpts } from "../../createRoom";
 | 
				
			||||||
import SpacePanel from "../views/spaces/SpacePanel";
 | 
					import SpacePanel from "../views/spaces/SpacePanel";
 | 
				
			||||||
import {replaceableComponent} from "../../utils/replaceableComponent";
 | 
					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)
 | 
					// 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.
 | 
					// so each pinned message may trigger a request. Limit the number per room for sanity.
 | 
				
			||||||
@@ -119,6 +122,7 @@ interface IState {
 | 
				
			|||||||
    usageLimitEventContent?: IUsageLimit;
 | 
					    usageLimitEventContent?: IUsageLimit;
 | 
				
			||||||
    usageLimitEventTs?: number;
 | 
					    usageLimitEventTs?: number;
 | 
				
			||||||
    useCompactLayout: boolean;
 | 
					    useCompactLayout: boolean;
 | 
				
			||||||
 | 
					    activeCalls: Array<MatrixCall>;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -160,6 +164,7 @@ class LoggedInView extends React.Component<IProps, IState> {
 | 
				
			|||||||
            // use compact timeline view
 | 
					            // use compact timeline view
 | 
				
			||||||
            useCompactLayout: SettingsStore.getValue('useCompactLayout'),
 | 
					            useCompactLayout: SettingsStore.getValue('useCompactLayout'),
 | 
				
			||||||
            usageLimitDismissed: false,
 | 
					            usageLimitDismissed: false,
 | 
				
			||||||
 | 
					            activeCalls: [],
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // stash the MatrixClient in case we log out before we are unmounted
 | 
					        // stash the MatrixClient in case we log out before we are unmounted
 | 
				
			||||||
@@ -175,6 +180,7 @@ class LoggedInView extends React.Component<IProps, IState> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    componentDidMount() {
 | 
					    componentDidMount() {
 | 
				
			||||||
        document.addEventListener('keydown', this._onNativeKeyDown, false);
 | 
					        document.addEventListener('keydown', this._onNativeKeyDown, false);
 | 
				
			||||||
 | 
					        CallHandler.sharedInstance().addListener(CallHandlerEvent.CallsChanged, this.onCallsChanged);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this._updateServerNoticeEvents();
 | 
					        this._updateServerNoticeEvents();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -199,6 +205,7 @@ class LoggedInView extends React.Component<IProps, IState> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    componentWillUnmount() {
 | 
					    componentWillUnmount() {
 | 
				
			||||||
        document.removeEventListener('keydown', this._onNativeKeyDown, false);
 | 
					        document.removeEventListener('keydown', this._onNativeKeyDown, false);
 | 
				
			||||||
 | 
					        CallHandler.sharedInstance().removeListener(CallHandlerEvent.CallsChanged, this.onCallsChanged);
 | 
				
			||||||
        this._matrixClient.removeListener("accountData", this.onAccountData);
 | 
					        this._matrixClient.removeListener("accountData", this.onAccountData);
 | 
				
			||||||
        this._matrixClient.removeListener("sync", this.onSync);
 | 
					        this._matrixClient.removeListener("sync", this.onSync);
 | 
				
			||||||
        this._matrixClient.removeListener("RoomState.events", this.onRoomStateEvents);
 | 
					        this._matrixClient.removeListener("RoomState.events", this.onRoomStateEvents);
 | 
				
			||||||
@@ -206,6 +213,12 @@ class LoggedInView extends React.Component<IProps, IState> {
 | 
				
			|||||||
        this.resizer.detach();
 | 
					        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
 | 
					    // 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.
 | 
					    // 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';
 | 
					            bodyClasses += ' mx_MatrixChat_useCompactLayout';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        const audioFeedArraysForCalls = this.state.activeCalls.map((call) => {
 | 
				
			||||||
 | 
					            return (
 | 
				
			||||||
 | 
					                <AudioFeedArrayForCall call={call} key={call.callId} />
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return (
 | 
					        return (
 | 
				
			||||||
            <MatrixClientContext.Provider value={this._matrixClient}>
 | 
					            <MatrixClientContext.Provider value={this._matrixClient}>
 | 
				
			||||||
                <div
 | 
					                <div
 | 
				
			||||||
@@ -685,6 +704,7 @@ class LoggedInView extends React.Component<IProps, IState> {
 | 
				
			|||||||
                <CallContainer />
 | 
					                <CallContainer />
 | 
				
			||||||
                <NonUrgentToastContainer />
 | 
					                <NonUrgentToastContainer />
 | 
				
			||||||
                <HostSignupContainer />
 | 
					                <HostSignupContainer />
 | 
				
			||||||
 | 
					                {audioFeedArraysForCalls}
 | 
				
			||||||
            </MatrixClientContext.Provider>
 | 
					            </MatrixClientContext.Provider>
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user