feat: Reduces into state region and shard changes from the lib. (#14546)

* feat: Reduces into state region and shard changes from the lib.

* squash: Fixes few comments.

* chore(deps) lib-jitsi-meet@latest

https://github.com/jitsi/lib-jitsi-meet/compare/v1802.0.0+49ff6eb4...v1803.0.0+5237dbfe
This commit is contained in:
Дамян Минков
2024-03-26 18:01:53 -05:00
committed by GitHub
parent 56eecaba2a
commit 2c6f4e27fc
5 changed files with 69 additions and 7 deletions

10
package-lock.json generated
View File

@@ -61,7 +61,7 @@
"js-md5": "0.6.1",
"js-sha512": "0.8.0",
"jwt-decode": "2.2.0",
"lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1802.0.0+49ff6eb4/lib-jitsi-meet.tgz",
"lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1803.0.0+5237dbfe/lib-jitsi-meet.tgz",
"lodash": "4.17.21",
"moment": "2.29.4",
"moment-duration-format": "2.2.2",
@@ -12772,8 +12772,8 @@
},
"node_modules/lib-jitsi-meet": {
"version": "0.0.0",
"resolved": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1802.0.0+49ff6eb4/lib-jitsi-meet.tgz",
"integrity": "sha512-/BCu2u6XutBEQJkhNtgGy6UREiZGkiCEEfOHekA1KXUNE0q3V/t47AYYDMPQPqZkkuv2gFK/MKLUdI49RaTYUA==",
"resolved": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1803.0.0+5237dbfe/lib-jitsi-meet.tgz",
"integrity": "sha512-Rbv28RFFz7Y4NgqcTi9oRAxzjrR+jK9djlphybWcIT3o36y8fKogst3y/3AgH58m9wQI53jLGMDznC5bTtflOw==",
"hasInstallScript": true,
"license": "Apache-2.0",
"dependencies": {
@@ -29183,8 +29183,8 @@
}
},
"lib-jitsi-meet": {
"version": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1802.0.0+49ff6eb4/lib-jitsi-meet.tgz",
"integrity": "sha512-/BCu2u6XutBEQJkhNtgGy6UREiZGkiCEEfOHekA1KXUNE0q3V/t47AYYDMPQPqZkkuv2gFK/MKLUdI49RaTYUA==",
"version": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1803.0.0+5237dbfe/lib-jitsi-meet.tgz",
"integrity": "sha512-Rbv28RFFz7Y4NgqcTi9oRAxzjrR+jK9djlphybWcIT3o36y8fKogst3y/3AgH58m9wQI53jLGMDznC5bTtflOw==",
"requires": {
"@jitsi/js-utils": "2.2.1",
"@jitsi/logger": "2.0.2",

View File

@@ -67,7 +67,7 @@
"js-md5": "0.6.1",
"js-sha512": "0.8.0",
"jwt-decode": "2.2.0",
"lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1802.0.0+49ff6eb4/lib-jitsi-meet.tgz",
"lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1803.0.0+5237dbfe/lib-jitsi-meet.tgz",
"lodash": "4.17.21",
"moment": "2.29.4",
"moment-duration-format": "2.2.2",

View File

@@ -3,6 +3,7 @@ import _ from 'lodash';
import { CONFERENCE_INFO } from '../../conference/components/constants';
import { TOOLBAR_BUTTONS } from '../../toolbox/constants';
import { ToolbarButton } from '../../toolbox/types';
import { CONNECTION_PROPERTIES_UPDATED } from '../connection/actionTypes';
import ReducerRegistry from '../redux/ReducerRegistry';
import { equals } from '../redux/functions';
@@ -94,6 +95,24 @@ ReducerRegistry.register<IConfigState>('features/base/config', (state = _getInit
locationURL: action.locationURL
};
case CONNECTION_PROPERTIES_UPDATED: {
const { region, shard } = action.properties;
const { deploymentInfo } = state;
if (deploymentInfo?.region === region && deploymentInfo?.shard === shard) {
return state;
}
return {
...state,
deploymentInfo: JSON.parse(JSON.stringify({
...deploymentInfo,
region,
shard
}))
};
}
case LOAD_CONFIG_ERROR:
// XXX LOAD_CONFIG_ERROR is one of the settlement execution paths of
// the asynchronous "loadConfig procedure/process" started with

View File

@@ -31,6 +31,16 @@ export const CONNECTION_ESTABLISHED = 'CONNECTION_ESTABLISHED';
*/
export const CONNECTION_FAILED = 'CONNECTION_FAILED';
/**
* The type of (redux) action which signals that connection properties were updated.
*
* {
* type: CONNECTION_PROPERTIES_UPDATED,
* properties: Object
* }
*/
export const CONNECTION_PROPERTIES_UPDATED = 'CONNECTION_PROPERTIES_UPDATED';
/**
* The type of (redux) action which signals that a connection will connect.
*

View File

@@ -15,6 +15,7 @@ import {
CONNECTION_DISCONNECTED,
CONNECTION_ESTABLISHED,
CONNECTION_FAILED,
CONNECTION_PROPERTIES_UPDATED,
CONNECTION_WILL_CONNECT,
SET_LOCATION_URL,
SET_PREFER_VISITOR
@@ -230,6 +231,9 @@ export function _connectInternal(id?: string, password?: string) {
connection.addEventListener(
JitsiConnectionEvents.CONNECTION_REDIRECTED,
_onConnectionRedirected);
connection.addEventListener(
JitsiConnectionEvents.PROPERTIES_UPDATED,
_onPropertiesUpdate);
/**
* Unsubscribe the connection instance from
@@ -241,6 +245,7 @@ export function _connectInternal(id?: string, password?: string) {
connection.removeEventListener(
JitsiConnectionEvents.CONNECTION_DISCONNECTED, _onConnectionDisconnected);
connection.removeEventListener(JitsiConnectionEvents.CONNECTION_FAILED, _onConnectionFailed);
connection.removeEventListener(JitsiConnectionEvents.PROPERTIES_UPDATED, _onPropertiesUpdate);
}
/**
@@ -299,7 +304,7 @@ export function _connectInternal(id?: string, password?: string) {
}
/**
* Rejects external promise when connection fails.
* Connection was redirected.
*
* @param {string|undefined} vnode - The vnode to connect to.
* @param {string} focusJid - The focus jid to use.
@@ -313,6 +318,17 @@ export function _connectInternal(id?: string, password?: string) {
dispatch(redirect(vnode, focusJid, username));
}
/**
* Connection properties were updated.
*
* @param {Object} properties - The properties which were updated.
* @private
* @returns {void}
*/
function _onPropertiesUpdate(properties: object) {
dispatch(_propertiesUpdate(properties));
}
// in case of configured http url for conference request we need the room name
const name = getBackendSafeRoomName(state['features/base/conference'].room);
@@ -343,6 +359,23 @@ function _connectionWillConnect(connection: Object) {
};
}
/**
* Create an action for when connection properties are updated.
*
* @param {Object} properties - The properties which were updated.
* @private
* @returns {{
* type: CONNECTION_PROPERTIES_UPDATED,
* properties: Object
* }}
*/
function _propertiesUpdate(properties: object) {
return {
type: CONNECTION_PROPERTIES_UPDATED,
properties
};
}
/**
* Closes connection.
*