mirror of
https://github.com/vector-im/element-call.git
synced 2026-04-06 07:20:25 +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 => {
|
||||
const { theme: themeName } = useUrlParams();
|
||||
const contentLoadedSent = useRef<boolean>(false);
|
||||
const previousTheme = useRef<string | null>(document.body.classList.item(0));
|
||||
useLayoutEffect(() => {
|
||||
// If the url does not contain a theme props we default to "dark".
|
||||
@@ -38,5 +39,9 @@ export const useTheme = (): void => {
|
||||
previousTheme.current = themeString;
|
||||
}
|
||||
document.body.classList.remove("nodisplay");
|
||||
if (!contentLoadedSent.current) {
|
||||
widget?.api.sendContentLoaded();
|
||||
contentLoadedSent.current = true;
|
||||
}
|
||||
}, [previousTheme, themeName]);
|
||||
};
|
||||
|
||||
@@ -158,6 +158,8 @@ export const widget = ((): WidgetHelpers | null => {
|
||||
useE2eForGroupCall: e2eEnabled,
|
||||
fallbackICEServerAllowed: allowIceFallback,
|
||||
},
|
||||
// ContentLoaded event will be sent as soon as the theme is set (see useTheme.ts)
|
||||
false,
|
||||
);
|
||||
|
||||
const clientPromise = new Promise<MatrixClient>((resolve) => {
|
||||
|
||||
Reference in New Issue
Block a user