Merge remote-tracking branch 'upstream/main' into SimonBrandner/fix/audio
This commit is contained in:
		
				commit
				
					
						4ac5c2c677
					
				
			
		
					 19 changed files with 74 additions and 36 deletions
				
			
		| 
						 | 
					@ -33,6 +33,7 @@ import {
 | 
				
			||||||
  initClient,
 | 
					  initClient,
 | 
				
			||||||
  initMatroskaClient,
 | 
					  initMatroskaClient,
 | 
				
			||||||
  defaultHomeserver,
 | 
					  defaultHomeserver,
 | 
				
			||||||
 | 
					  CryptoStoreIntegrityError,
 | 
				
			||||||
} from "./matrix-utils";
 | 
					} from "./matrix-utils";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
declare global {
 | 
					declare global {
 | 
				
			||||||
| 
						 | 
					@ -115,28 +116,51 @@ export const ClientProvider: FC<Props> = ({ children }) => {
 | 
				
			||||||
        // We're running as a standalone application
 | 
					        // We're running as a standalone application
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
          const session = loadSession();
 | 
					          const session = loadSession();
 | 
				
			||||||
 | 
					          if (!session) return { client: undefined, isPasswordlessUser: false };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          if (session) {
 | 
					          logger.log("Using a standalone client");
 | 
				
			||||||
            /* eslint-disable camelcase */
 | 
					 | 
				
			||||||
            const { user_id, device_id, access_token, passwordlessUser } =
 | 
					 | 
				
			||||||
              session;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            logger.log("Using a standalone client");
 | 
					          /* eslint-disable camelcase */
 | 
				
			||||||
            const client = await initClient(
 | 
					          const { user_id, device_id, access_token, passwordlessUser } =
 | 
				
			||||||
              {
 | 
					            session;
 | 
				
			||||||
                baseUrl: defaultHomeserver,
 | 
					 | 
				
			||||||
                accessToken: access_token,
 | 
					 | 
				
			||||||
                userId: user_id,
 | 
					 | 
				
			||||||
                deviceId: device_id,
 | 
					 | 
				
			||||||
              },
 | 
					 | 
				
			||||||
              true
 | 
					 | 
				
			||||||
            );
 | 
					 | 
				
			||||||
            /* eslint-enable camelcase */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return { client, isPasswordlessUser: passwordlessUser };
 | 
					          try {
 | 
				
			||||||
 | 
					            return {
 | 
				
			||||||
 | 
					              client: await initClient(
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                  baseUrl: defaultHomeserver,
 | 
				
			||||||
 | 
					                  accessToken: access_token,
 | 
				
			||||||
 | 
					                  userId: user_id,
 | 
				
			||||||
 | 
					                  deviceId: device_id,
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                true
 | 
				
			||||||
 | 
					              ),
 | 
				
			||||||
 | 
					              isPasswordlessUser: passwordlessUser,
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
 | 
					          } catch (err) {
 | 
				
			||||||
 | 
					            if (err instanceof CryptoStoreIntegrityError) {
 | 
				
			||||||
 | 
					              // We can't use this session anymore, so let's log it out
 | 
				
			||||||
 | 
					              try {
 | 
				
			||||||
 | 
					                const client = await initClient(
 | 
				
			||||||
 | 
					                  {
 | 
				
			||||||
 | 
					                    baseUrl: defaultHomeserver,
 | 
				
			||||||
 | 
					                    accessToken: access_token,
 | 
				
			||||||
 | 
					                    userId: user_id,
 | 
				
			||||||
 | 
					                    deviceId: device_id,
 | 
				
			||||||
 | 
					                  },
 | 
				
			||||||
 | 
					                  false // Don't need the crypto store just to log out
 | 
				
			||||||
 | 
					                );
 | 
				
			||||||
 | 
					                await client.logout(undefined, true);
 | 
				
			||||||
 | 
					              } catch (err_) {
 | 
				
			||||||
 | 
					                logger.warn(
 | 
				
			||||||
 | 
					                  "The previous session was lost, and we couldn't log it out, " +
 | 
				
			||||||
 | 
					                    "either"
 | 
				
			||||||
 | 
					                );
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            throw err;
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					          /* eslint-enable camelcase */
 | 
				
			||||||
          return { client: undefined, isPasswordlessUser: false };
 | 
					 | 
				
			||||||
        } catch (err) {
 | 
					        } catch (err) {
 | 
				
			||||||
          clearSession();
 | 
					          clearSession();
 | 
				
			||||||
          throw err;
 | 
					          throw err;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,7 +16,8 @@ limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import React, { HTMLAttributes } from "react";
 | 
					import React, { HTMLAttributes } from "react";
 | 
				
			||||||
import classNames from "classnames";
 | 
					import classNames from "classnames";
 | 
				
			||||||
import { MatrixClient, RoomMember } from "matrix-js-sdk";
 | 
					import { MatrixClient } from "matrix-js-sdk/src/client";
 | 
				
			||||||
 | 
					import { RoomMember } from "matrix-js-sdk/src/models/room-member";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import styles from "./Facepile.module.css";
 | 
					import styles from "./Facepile.module.css";
 | 
				
			||||||
import { Avatar, Size, sizes } from "./Avatar";
 | 
					import { Avatar, Size, sizes } from "./Avatar";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,7 @@ import React, { HTMLAttributes, ReactNode, useCallback, useRef } from "react";
 | 
				
			||||||
import { Link } from "react-router-dom";
 | 
					import { Link } from "react-router-dom";
 | 
				
			||||||
import { useButton } from "@react-aria/button";
 | 
					import { useButton } from "@react-aria/button";
 | 
				
			||||||
import { AriaButtonProps } from "@react-types/button";
 | 
					import { AriaButtonProps } from "@react-types/button";
 | 
				
			||||||
import { Room } from "matrix-js-sdk";
 | 
					import { Room } from "matrix-js-sdk/src/models/room";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import styles from "./Header.module.css";
 | 
					import styles from "./Header.module.css";
 | 
				
			||||||
import { useModalTriggerState } from "./Modal";
 | 
					import { useModalTriggerState } from "./Modal";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
 | 
				
			||||||
limitations under the License.
 | 
					limitations under the License.
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { Room } from "matrix-js-sdk";
 | 
					import { Room } from "matrix-js-sdk/src/models/room";
 | 
				
			||||||
import React from "react";
 | 
					import React from "react";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { Modal, ModalContent } from "./Modal";
 | 
					import { Modal, ModalContent } from "./Modal";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,7 +16,8 @@ limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import React from "react";
 | 
					import React from "react";
 | 
				
			||||||
import { Link } from "react-router-dom";
 | 
					import { Link } from "react-router-dom";
 | 
				
			||||||
import { MatrixClient, RoomMember } from "matrix-js-sdk";
 | 
					import { MatrixClient } from "matrix-js-sdk/src/client";
 | 
				
			||||||
 | 
					import { RoomMember } from "matrix-js-sdk/src/models/room-member";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { CopyButton } from "../button";
 | 
					import { CopyButton } from "../button";
 | 
				
			||||||
import { Facepile } from "../Facepile";
 | 
					import { Facepile } from "../Facepile";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,7 +21,7 @@ import React, {
 | 
				
			||||||
  FormEventHandler,
 | 
					  FormEventHandler,
 | 
				
			||||||
} from "react";
 | 
					} from "react";
 | 
				
			||||||
import { useHistory } from "react-router-dom";
 | 
					import { useHistory } from "react-router-dom";
 | 
				
			||||||
import { MatrixClient } from "matrix-js-sdk";
 | 
					import { MatrixClient } from "matrix-js-sdk/src/client";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { createRoom, roomAliasLocalpartFromRoomName } from "../matrix-utils";
 | 
					import { createRoom, roomAliasLocalpartFromRoomName } from "../matrix-utils";
 | 
				
			||||||
import { useGroupCallRooms } from "./useGroupCallRooms";
 | 
					import { useGroupCallRooms } from "./useGroupCallRooms";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,7 +14,10 @@ See the License for the specific language governing permissions and
 | 
				
			||||||
limitations under the License.
 | 
					limitations under the License.
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { GroupCall, MatrixClient, Room, RoomMember } from "matrix-js-sdk";
 | 
					import { MatrixClient } from "matrix-js-sdk/src/client";
 | 
				
			||||||
 | 
					import { GroupCall } from "matrix-js-sdk/src/webrtc/groupCall";
 | 
				
			||||||
 | 
					import { Room } from "matrix-js-sdk/src/models/room";
 | 
				
			||||||
 | 
					import { RoomMember } from "matrix-js-sdk/src/models/room-member";
 | 
				
			||||||
import { GroupCallEventHandlerEvent } from "matrix-js-sdk/src/webrtc/groupCallEventHandler";
 | 
					import { GroupCallEventHandlerEvent } from "matrix-js-sdk/src/webrtc/groupCallEventHandler";
 | 
				
			||||||
import { useState, useEffect } from "react";
 | 
					import { useState, useEffect } from "react";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,7 @@ limitations under the License.
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import React, { ChangeEvent, useCallback, useEffect, useState } from "react";
 | 
					import React, { ChangeEvent, useCallback, useEffect, useState } from "react";
 | 
				
			||||||
import { MatrixClient } from "matrix-js-sdk";
 | 
					import { MatrixClient } from "matrix-js-sdk/src/client";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { Button } from "../button";
 | 
					import { Button } from "../button";
 | 
				
			||||||
import { useProfile } from "./useProfile";
 | 
					import { useProfile } from "./useProfile";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,7 @@ limitations under the License.
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import React from "react";
 | 
					import React from "react";
 | 
				
			||||||
import { MatrixClient } from "matrix-js-sdk";
 | 
					import { MatrixClient } from "matrix-js-sdk/src/client";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import styles from "./CallEndedView.module.css";
 | 
					import styles from "./CallEndedView.module.css";
 | 
				
			||||||
import { LinkButton } from "../button";
 | 
					import { LinkButton } from "../button";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,7 +26,8 @@ import React, {
 | 
				
			||||||
import ReactJson, { CollapsedFieldProps } from "react-json-view";
 | 
					import ReactJson, { CollapsedFieldProps } from "react-json-view";
 | 
				
			||||||
import mermaid from "mermaid";
 | 
					import mermaid from "mermaid";
 | 
				
			||||||
import { Item } from "@react-stately/collections";
 | 
					import { Item } from "@react-stately/collections";
 | 
				
			||||||
import { MatrixEvent, GroupCall, IContent } from "matrix-js-sdk";
 | 
					import { MatrixEvent, IContent } from "matrix-js-sdk/src/models/event";
 | 
				
			||||||
 | 
					import { GroupCall } from "matrix-js-sdk/src/webrtc/groupCall";
 | 
				
			||||||
import { ClientEvent, MatrixClient } from "matrix-js-sdk/src/client";
 | 
					import { ClientEvent, MatrixClient } from "matrix-js-sdk/src/client";
 | 
				
			||||||
import { RoomStateEvent } from "matrix-js-sdk/src/models/room-state";
 | 
					import { RoomStateEvent } from "matrix-js-sdk/src/models/room-state";
 | 
				
			||||||
import { CallEvent } from "matrix-js-sdk/src/webrtc/call";
 | 
					import { CallEvent } from "matrix-js-sdk/src/webrtc/call";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,8 @@ limitations under the License.
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import React, { ReactNode } from "react";
 | 
					import React, { ReactNode } from "react";
 | 
				
			||||||
import { GroupCall, MatrixClient } from "matrix-js-sdk";
 | 
					import { MatrixClient } from "matrix-js-sdk/src/client";
 | 
				
			||||||
 | 
					import { GroupCall } from "matrix-js-sdk/src/webrtc/groupCall";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { useLoadGroupCall } from "./useLoadGroupCall";
 | 
					import { useLoadGroupCall } from "./useLoadGroupCall";
 | 
				
			||||||
import { ErrorView, FullScreenView } from "../FullScreenView";
 | 
					import { ErrorView, FullScreenView } from "../FullScreenView";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,7 +17,7 @@ limitations under the License.
 | 
				
			||||||
import React, { useCallback, useEffect, useState } from "react";
 | 
					import React, { useCallback, useEffect, useState } from "react";
 | 
				
			||||||
import { useHistory } from "react-router-dom";
 | 
					import { useHistory } from "react-router-dom";
 | 
				
			||||||
import { GroupCall, GroupCallState } from "matrix-js-sdk/src/webrtc/groupCall";
 | 
					import { GroupCall, GroupCallState } from "matrix-js-sdk/src/webrtc/groupCall";
 | 
				
			||||||
import { MatrixClient } from "matrix-js-sdk";
 | 
					import { MatrixClient } from "matrix-js-sdk/src/client";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { useGroupCall } from "./useGroupCall";
 | 
					import { useGroupCall } from "./useGroupCall";
 | 
				
			||||||
import { ErrorView, FullScreenView } from "../FullScreenView";
 | 
					import { ErrorView, FullScreenView } from "../FullScreenView";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,7 +16,9 @@ limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import React, { useCallback, useMemo, useRef } from "react";
 | 
					import React, { useCallback, useMemo, useRef } from "react";
 | 
				
			||||||
import { usePreventScroll } from "@react-aria/overlays";
 | 
					import { usePreventScroll } from "@react-aria/overlays";
 | 
				
			||||||
import { GroupCall, MatrixClient, RoomMember } from "matrix-js-sdk";
 | 
					import { MatrixClient } from "matrix-js-sdk/src/client";
 | 
				
			||||||
 | 
					import { RoomMember } from "matrix-js-sdk/src/models/room-member";
 | 
				
			||||||
 | 
					import { GroupCall } from "matrix-js-sdk/src/webrtc/groupCall";
 | 
				
			||||||
import { CallFeed } from "matrix-js-sdk/src/webrtc/callFeed";
 | 
					import { CallFeed } from "matrix-js-sdk/src/webrtc/callFeed";
 | 
				
			||||||
import classNames from "classnames";
 | 
					import classNames from "classnames";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,7 +17,9 @@ limitations under the License.
 | 
				
			||||||
import React, { useEffect } from "react";
 | 
					import React, { useEffect } from "react";
 | 
				
			||||||
import useMeasure from "react-use-measure";
 | 
					import useMeasure from "react-use-measure";
 | 
				
			||||||
import { ResizeObserver } from "@juggle/resize-observer";
 | 
					import { ResizeObserver } from "@juggle/resize-observer";
 | 
				
			||||||
import { GroupCall, MatrixClient, RoomMember } from "matrix-js-sdk";
 | 
					import { MatrixClient } from "matrix-js-sdk/src/client";
 | 
				
			||||||
 | 
					import { RoomMember } from "matrix-js-sdk/src/models/room-member";
 | 
				
			||||||
 | 
					import { GroupCall } from "matrix-js-sdk/src/webrtc/groupCall";
 | 
				
			||||||
import { CallFeed } from "matrix-js-sdk/src/webrtc/callFeed";
 | 
					import { CallFeed } from "matrix-js-sdk/src/webrtc/callFeed";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { useDelayedState } from "../useDelayedState";
 | 
					import { useDelayedState } from "../useDelayedState";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,7 +16,7 @@ limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { useCallback, useContext, useEffect, useState } from "react";
 | 
					import { useCallback, useContext, useEffect, useState } from "react";
 | 
				
			||||||
import pako from "pako";
 | 
					import pako from "pako";
 | 
				
			||||||
import { MatrixEvent } from "matrix-js-sdk";
 | 
					import { MatrixEvent } from "matrix-js-sdk/src/models/event";
 | 
				
			||||||
import { OverlayTriggerState } from "@react-stately/overlays";
 | 
					import { OverlayTriggerState } from "@react-stately/overlays";
 | 
				
			||||||
import { MatrixClient, ClientEvent } from "matrix-js-sdk/src/client";
 | 
					import { MatrixClient, ClientEvent } from "matrix-js-sdk/src/client";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
 | 
				
			||||||
limitations under the License.
 | 
					limitations under the License.
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { MatrixClient } from "matrix-js-sdk";
 | 
					import { MatrixClient } from "matrix-js-sdk/src/client";
 | 
				
			||||||
import { MediaHandlerEvent } from "matrix-js-sdk/src/webrtc/mediaHandler";
 | 
					import { MediaHandlerEvent } from "matrix-js-sdk/src/webrtc/mediaHandler";
 | 
				
			||||||
import React, {
 | 
					import React, {
 | 
				
			||||||
  useState,
 | 
					  useState,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,7 +17,7 @@ limitations under the License.
 | 
				
			||||||
import { SDPStreamMetadataPurpose } from "matrix-js-sdk/src/webrtc/callEventTypes";
 | 
					import { SDPStreamMetadataPurpose } from "matrix-js-sdk/src/webrtc/callEventTypes";
 | 
				
			||||||
import React from "react";
 | 
					import React from "react";
 | 
				
			||||||
import { useCallback } from "react";
 | 
					import { useCallback } from "react";
 | 
				
			||||||
import { RoomMember } from "matrix-js-sdk";
 | 
					import { RoomMember } from "matrix-js-sdk/src/models/room-member";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { useCallFeed } from "./useCallFeed";
 | 
					import { useCallFeed } from "./useCallFeed";
 | 
				
			||||||
import { useSpatialMediaStream } from "./useMediaStream";
 | 
					import { useSpatialMediaStream } from "./useMediaStream";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,7 +16,7 @@ limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { useState, useEffect } from "react";
 | 
					import { useState, useEffect } from "react";
 | 
				
			||||||
import { CallFeed, CallFeedEvent } from "matrix-js-sdk/src/webrtc/callFeed";
 | 
					import { CallFeed, CallFeedEvent } from "matrix-js-sdk/src/webrtc/callFeed";
 | 
				
			||||||
import { RoomMember } from "matrix-js-sdk";
 | 
					import { RoomMember } from "matrix-js-sdk/src/models/room-member";
 | 
				
			||||||
import { SDPStreamMetadataPurpose } from "matrix-js-sdk/src/webrtc/callEventTypes";
 | 
					import { SDPStreamMetadataPurpose } from "matrix-js-sdk/src/webrtc/callEventTypes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface CallFeedState {
 | 
					interface CallFeedState {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,7 +14,10 @@ See the License for the specific language governing permissions and
 | 
				
			||||||
limitations under the License.
 | 
					limitations under the License.
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { RoomMember, RoomMemberEvent } from "matrix-js-sdk";
 | 
					import {
 | 
				
			||||||
 | 
					  RoomMember,
 | 
				
			||||||
 | 
					  RoomMemberEvent,
 | 
				
			||||||
 | 
					} from "matrix-js-sdk/src/models/room-member";
 | 
				
			||||||
import { useState, useEffect } from "react";
 | 
					import { useState, useEffect } from "react";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface RoomMemberName {
 | 
					interface RoomMemberName {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue