Skip to content

Commit f528a16

Browse files
authored
Merge pull request matrix-org#5304 from matrix-org/travis/rel/5303
[Release] Use new preparing event for widget communications
2 parents 4abaa10 + 2caf679 commit f528a16

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"linkifyjs": "^2.1.9",
8080
"lodash": "^4.17.19",
8181
"matrix-js-sdk": "8.5.0-rc.1",
82-
"matrix-widget-api": "^0.1.0-beta.2",
82+
"matrix-widget-api": "^0.1.0-beta.3",
8383
"minimist": "^1.2.5",
8484
"pako": "^1.0.11",
8585
"parse5": "^5.1.1",

src/components/views/elements/AppTile.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export default class AppTile extends React.Component {
5050
// The key used for PersistedElement
5151
this._persistKey = 'widget_' + this.props.app.id;
5252
this._sgWidget = new StopGapWidget(this.props);
53+
this._sgWidget.on("preparing", this._onWidgetPrepared);
5354
this._sgWidget.on("ready", this._onWidgetReady);
5455
this.iframe = null; // ref to the iframe (callback style)
5556

@@ -142,6 +143,7 @@ export default class AppTile extends React.Component {
142143
this._sgWidget.stop();
143144
}
144145
this._sgWidget = new StopGapWidget(newProps);
146+
this._sgWidget.on("preparing", this._onWidgetPrepared);
145147
this._sgWidget.on("ready", this._onWidgetReady);
146148
this._startWidget();
147149
}
@@ -295,8 +297,11 @@ export default class AppTile extends React.Component {
295297
this._revokeWidgetPermission();
296298
}
297299

298-
_onWidgetReady = () => {
300+
_onWidgetPrepared = () => {
299301
this.setState({loading: false});
302+
};
303+
304+
_onWidgetReady = () => {
300305
if (WidgetType.JITSI.matches(this.props.app.type)) {
301306
this._sgWidget.widgetApi.transport.send(ElementWidgetActions.ClientReady, {});
302307
}

src/stores/widgets/StopGapWidget.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ export class StopGapWidget extends EventEmitter {
163163
if (this.started) return;
164164
const driver = new StopGapWidgetDriver( this.appTileProps.whitelistCapabilities || []);
165165
this.messaging = new ClientWidgetApi(this.mockWidget, iframe, driver);
166+
this.messaging.addEventListener("preparing", () => this.emit("preparing"));
166167
this.messaging.addEventListener("ready", () => this.emit("ready"));
167168
WidgetMessagingStore.instance.storeMessaging(this.mockWidget, this.messaging);
168169

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5954,10 +5954,10 @@ matrix-react-test-utils@^0.2.2:
59545954
resolved "https://registry.yarnpkg.com/matrix-react-test-utils/-/matrix-react-test-utils-0.2.2.tgz#c87144d3b910c7edc544a6699d13c7c2bf02f853"
59555955
integrity sha512-49+7gfV6smvBIVbeloql+37IeWMTD+fiywalwCqk8Dnz53zAFjKSltB3rmWHso1uecLtQEcPtCijfhzcLXAxTQ==
59565956

5957-
matrix-widget-api@^0.1.0-beta.2:
5958-
version "0.1.0-beta.2"
5959-
resolved "https://registry.yarnpkg.com/matrix-widget-api/-/matrix-widget-api-0.1.0-beta.2.tgz#367da1ccd26b711f73fc5b6e02edf55ac2ea2692"
5960-
integrity sha512-q5g5RZN+RRjM4HmcJ+LYoQAYrB1wzyERmoQ+LvKbTV/+9Ov36Kp0QEP8CleSXEd5WLp6bkRlt60axDaY6pWGmg==
5957+
matrix-widget-api@^0.1.0-beta.3:
5958+
version "0.1.0-beta.3"
5959+
resolved "https://registry.yarnpkg.com/matrix-widget-api/-/matrix-widget-api-0.1.0-beta.3.tgz#356965ca357172ee056e3fd86fd96879b059a114"
5960+
integrity sha512-j7nxdhLQfdU6snsdBA29KQR0DmT8/vl6otOvGqPCV0OCHpq1312cP79Eg4JzJKIFI3A76Qha3nYx6G9/aapwXg==
59615961

59625962
mdast-util-compact@^1.0.0:
59635963
version "1.0.4"

0 commit comments

Comments
 (0)