From 6df3371c6c562fa006bb2cddbd6b3cdb4cb8e8cc Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Tue, 22 May 2018 19:14:54 +0100 Subject: [PATCH 1/2] Add a "reload widget" button. --- res/img/button-refresh.svg | 12 ++++++++++++ src/components/views/elements/AppTile.js | 23 +++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 res/img/button-refresh.svg diff --git a/res/img/button-refresh.svg b/res/img/button-refresh.svg new file mode 100644 index 0000000000..b4990a2147 --- /dev/null +++ b/res/img/button-refresh.svg @@ -0,0 +1,12 @@ + + + + + + diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index 0895ede636..4f7a3e298d 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -55,6 +55,7 @@ export default class AppTile extends React.Component { this._grantWidgetPermission = this._grantWidgetPermission.bind(this); this._revokeWidgetPermission = this._revokeWidgetPermission.bind(this); this._onPopoutWidgetClick = this._onPopoutWidgetClick.bind(this); + this._onReloadWidgetClick = this._onReloadWidgetClick.bind(this); } /** @@ -519,6 +520,11 @@ export default class AppTile extends React.Component { { target: '_blank', href: this._getSafeUrl(), rel: 'noopener noreferrer'}).click(); } + _onReloadWidgetClick(e) { + // Reload iframe in this way to avoid cross-origin restrictions + this.refs.appFrame.src = this.refs.appFrame.src; + } + render() { let appTileBody; @@ -606,6 +612,7 @@ export default class AppTile extends React.Component { const showPictureSnapshotButton = this._hasCapability('m.capability.screenshot') && this.props.show; const showPictureSnapshotIcon = 'img/camera_green.svg'; const popoutWidgetIcon = 'img/button-new-window.svg'; + const reloadWidgetIcon = 'img/button-refresh.svg'; const windowStateIcon = (this.props.show ? 'img/minimize.svg' : 'img/maximize.svg'); return ( @@ -624,6 +631,16 @@ export default class AppTile extends React.Component { { this.props.showTitle && this._getTileTitle() } + { /* Reload widget */ } + { this.props.showReload && } + { /* Popout widget */ } { this.props.showPopout && Date: Wed, 23 May 2018 00:26:55 +0100 Subject: [PATCH 2/2] Translation. --- src/i18n/strings/en_EN.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 239b45c32e..ea2749b404 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -103,6 +103,7 @@ "You need to be logged in.": "You need to be logged in.", "You need to be able to invite users to do that.": "You need to be able to invite users to do that.", "Unable to create widget.": "Unable to create widget.", + "Reload widget": "Reload widget", "Missing roomId.": "Missing roomId.", "Failed to send request.": "Failed to send request.", "This room is not recognised.": "This room is not recognised.",