Support multiple integration managers behind a labs flag

Fixes https://github.com/vector-im/riot-web/issues/10622
Implements [MSC1957](https://github.com/matrix-org/matrix-doc/pull/1957)

Design is not final.
This commit is contained in:
Travis Ralston 2019-08-23 09:12:40 -06:00
parent 602c338a26
commit b3cda4b19a
13 changed files with 318 additions and 21 deletions

View file

@ -548,8 +548,8 @@ const onMessage = function(event) {
// (See https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage)
let configUrl;
try {
// TODO: Support multiple integration managers
configUrl = new URL(IntegrationManagers.sharedInstance().getPrimaryManager().uiUrl);
if (!openManagerUrl) openManagerUrl = IntegrationManagers.sharedInstance().getPrimaryManager().uiUrl;
configUrl = new URL(openManagerUrl);
} catch (e) {
// No integrations UI URL, ignore silently.
return;
@ -657,6 +657,7 @@ const onMessage = function(event) {
};
let listenerCount = 0;
let openManagerUrl = null;
module.exports = {
startListening: function() {
if (listenerCount === 0) {
@ -679,4 +680,8 @@ module.exports = {
console.error(e);
}
},
setOpenManagerUrl: function(url) {
openManagerUrl = url;
}
};