mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-08 20:09:19 +00:00
Emit widget content loaded action after theme is set.
Signed-off-by: Timo K <toger5@hotmail.de>
This commit is contained in:
@@ -21,6 +21,7 @@ import { widget } from "./widget";
|
|||||||
|
|
||||||
export const useTheme = (): void => {
|
export const useTheme = (): void => {
|
||||||
const { theme: themeName } = useUrlParams();
|
const { theme: themeName } = useUrlParams();
|
||||||
|
const contentLoadedSent = useRef<boolean>(false);
|
||||||
const previousTheme = useRef<string | null>(document.body.classList.item(0));
|
const previousTheme = useRef<string | null>(document.body.classList.item(0));
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
// If the url does not contain a theme props we default to "dark".
|
// If the url does not contain a theme props we default to "dark".
|
||||||
@@ -38,5 +39,9 @@ export const useTheme = (): void => {
|
|||||||
previousTheme.current = themeString;
|
previousTheme.current = themeString;
|
||||||
}
|
}
|
||||||
document.body.classList.remove("nodisplay");
|
document.body.classList.remove("nodisplay");
|
||||||
|
if (!contentLoadedSent.current) {
|
||||||
|
widget?.api.sendContentLoaded();
|
||||||
|
contentLoadedSent.current = true;
|
||||||
|
}
|
||||||
}, [previousTheme, themeName]);
|
}, [previousTheme, themeName]);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -158,6 +158,8 @@ export const widget = ((): WidgetHelpers | null => {
|
|||||||
useE2eForGroupCall: e2eEnabled,
|
useE2eForGroupCall: e2eEnabled,
|
||||||
fallbackICEServerAllowed: allowIceFallback,
|
fallbackICEServerAllowed: allowIceFallback,
|
||||||
},
|
},
|
||||||
|
// ContentLoaded event will be sent as soon as the theme is set (see useTheme.ts)
|
||||||
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
const clientPromise = new Promise<MatrixClient>((resolve) => {
|
const clientPromise = new Promise<MatrixClient>((resolve) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user