remove reactive url param for showFooter
This commit is contained in:
@@ -14,13 +14,11 @@ import {
|
|||||||
type RTCNotificationType,
|
type RTCNotificationType,
|
||||||
} from "matrix-js-sdk/lib/matrixrtc";
|
} from "matrix-js-sdk/lib/matrixrtc";
|
||||||
import { pickBy } from "lodash-es";
|
import { pickBy } from "lodash-es";
|
||||||
import { BehaviorSubject } from "rxjs";
|
|
||||||
|
|
||||||
import { Config } from "./config/Config";
|
import { Config } from "./config/Config";
|
||||||
import { type EncryptionSystem } from "./e2ee/sharedKeyManagement";
|
import { type EncryptionSystem } from "./e2ee/sharedKeyManagement";
|
||||||
import { E2eeType } from "./e2ee/e2eeType";
|
import { E2eeType } from "./e2ee/e2eeType";
|
||||||
import { platform } from "./Platform";
|
import { platform } from "./Platform";
|
||||||
import { type ObservableScope } from "./state/ObservableScope";
|
|
||||||
|
|
||||||
interface RoomIdentifier {
|
interface RoomIdentifier {
|
||||||
roomAlias: string | null;
|
roomAlias: string | null;
|
||||||
@@ -620,24 +618,6 @@ export const useRoomIdentifier = (): RoomIdentifier => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
let urlParams$ = undefined as BehaviorSubject<UrlParams> | undefined;
|
|
||||||
export const observerUrlParams$ = (
|
|
||||||
scope: ObservableScope,
|
|
||||||
): BehaviorSubject<UrlParams> => {
|
|
||||||
if (urlParams$ !== undefined) return urlParams$;
|
|
||||||
function updateUrlParams(): void {
|
|
||||||
console.log("[observerUrlParams$] update urlParams$");
|
|
||||||
urlParams$!.next(getUrlParams());
|
|
||||||
}
|
|
||||||
|
|
||||||
urlParams$ = new BehaviorSubject(getUrlParams());
|
|
||||||
window.addEventListener("hashchange", updateUrlParams);
|
|
||||||
scope.onEnd(() => {
|
|
||||||
window.removeEventListener("hashchange", updateUrlParams);
|
|
||||||
});
|
|
||||||
return urlParams$;
|
|
||||||
};
|
|
||||||
|
|
||||||
export function generateUrlSearchParams(
|
export function generateUrlSearchParams(
|
||||||
roomId: string,
|
roomId: string,
|
||||||
encryptionSystem: EncryptionSystem,
|
encryptionSystem: EncryptionSystem,
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ import { v4 as uuidv4 } from "uuid";
|
|||||||
import { type IMembershipManager } from "matrix-js-sdk/lib/matrixrtc/IMembershipManager";
|
import { type IMembershipManager } from "matrix-js-sdk/lib/matrixrtc/IMembershipManager";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
and$,
|
|
||||||
createToggle$,
|
createToggle$,
|
||||||
filterBehavior,
|
filterBehavior,
|
||||||
generateItem,
|
generateItem,
|
||||||
@@ -83,7 +82,7 @@ import { constant, type Behavior } from "../Behavior";
|
|||||||
import { E2eeType } from "../../e2ee/e2eeType";
|
import { E2eeType } from "../../e2ee/e2eeType";
|
||||||
import { MatrixKeyProvider } from "../../e2ee/matrixKeyProvider";
|
import { MatrixKeyProvider } from "../../e2ee/matrixKeyProvider";
|
||||||
import { type MuteStates } from "../MuteStates";
|
import { type MuteStates } from "../MuteStates";
|
||||||
import { getUrlParams, HeaderStyle, observerUrlParams$ } from "../../UrlParams";
|
import { getUrlParams, HeaderStyle } from "../../UrlParams";
|
||||||
import { type ProcessorState } from "../../livekit/TrackProcessorContext";
|
import { type ProcessorState } from "../../livekit/TrackProcessorContext";
|
||||||
import { ElementWidgetActions, widget } from "../../widget";
|
import { ElementWidgetActions, widget } from "../../widget";
|
||||||
import {
|
import {
|
||||||
@@ -1317,13 +1316,9 @@ export function createCallViewModel$(
|
|||||||
windowMode$.pipe(map((mode) => mode !== "pip" && mode !== "flat")),
|
windowMode$.pipe(map((mode) => mode !== "pip" && mode !== "flat")),
|
||||||
);
|
);
|
||||||
|
|
||||||
const urlParams$ = observerUrlParams$(scope);
|
const urlParams = getUrlParams();
|
||||||
const showFooterUrlParams$ = urlParams$.pipe(
|
const showFooterUrlParams = !(
|
||||||
map(
|
urlParams.header === HeaderStyle.None && urlParams.showControls === false
|
||||||
({ header, showControls }) =>
|
|
||||||
// with no header and no controls we always set showFooter to false.
|
|
||||||
!(header === HeaderStyle.None && showControls === false),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
const showFooterLayout$ = scope.behavior<boolean>(
|
const showFooterLayout$ = scope.behavior<boolean>(
|
||||||
windowMode$.pipe(
|
windowMode$.pipe(
|
||||||
@@ -1380,7 +1375,9 @@ export function createCallViewModel$(
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
const showFooter$ = scope.behavior(
|
const showFooter$ = scope.behavior(
|
||||||
and$(showFooterLayout$, showFooterUrlParams$),
|
showFooterLayout$.pipe(
|
||||||
|
map((showFooter) => showFooter && showFooterUrlParams),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* Whether audio is currently being output through the earpiece.
|
* Whether audio is currently being output through the earpiece.
|
||||||
|
|||||||
Reference in New Issue
Block a user