Load focus information from well known and use client config only as a fallback. (#2358)

* Load focus information from well known and use client config only as a fallback.

Signed-off-by: Timo K <toger5@hotmail.de>
Co-authored-by: Andrew Ferrazzutti <andrewf@element.io>
This commit is contained in:
Timo
2024-06-19 16:41:52 +02:00
committed by GitHub
parent 09ca3b4dc0
commit 812ae2ce89
15 changed files with 346 additions and 173 deletions

View File

@@ -77,8 +77,6 @@ export const widget = ((): WidgetHelpers | null => {
logger.info("Widget API is available");
const api = new WidgetApi(widgetId, parentOrigin);
api.requestCapability(MatrixCapabilities.AlwaysOnScreen);
api.requestCapabilityToSendEvent(EventType.CallEncryptionKeysPrefix);
api.requestCapabilityToReceiveEvent(EventType.CallEncryptionKeysPrefix);
// Set up the lazy action emitter, but only for select actions that we
// intend for the app to handle
@@ -116,9 +114,15 @@ export const widget = ((): WidgetHelpers | null => {
if (!baseUrl) throw new Error("Base URL must be supplied");
// These are all the event types the app uses
const sendRecvEvent = ["org.matrix.rageshake_request"];
const sendRecvEvent = [
"org.matrix.rageshake_request",
EventType.CallEncryptionKeysPrefix,
];
const sendState = [
{ eventType: EventType.GroupCallMemberPrefix, stateKey: userId },
{
eventType: EventType.GroupCallMemberPrefix,
stateKey: userId, // TODO: based on if we use the new format we want the key to be: `_${userId}_${deviceId}`
},
];
const receiveState = [
{ eventType: EventType.RoomMember },
@@ -167,7 +171,7 @@ export const widget = ((): WidgetHelpers | null => {
// wait for the config file to be ready (we load very early on so it might not
// be otherwise)
await Config.init();
await client.startClient();
await client.startClient({ clientWellKnownPollPeriod: 60 * 10 });
resolve(client);
})();
});