Better support for widgets overriding their URLs

Move the URL processing into AppTile so that the widget can have a
URL used for embedding in the page and a separate one for popping
out into a browser.
This commit is contained in:
David Baker 2020-04-01 10:00:33 +01:00
parent 78fd8e4569
commit 538147f7fa
6 changed files with 135 additions and 131 deletions

View file

@ -240,6 +240,14 @@ export default class Stickerpicker extends React.Component {
// Set default name
stickerpickerWidget.content.name = stickerpickerWidget.name || _t("Stickerpack");
// FIXME: could this use the same code as other apps?
const stickerApp = {
id: stickerpickerWidget.id,
url: stickerpickerWidget.content.url,
name: stickerpickerWidget.content.name,
type: stickerpickerWidget.content.type,
};
stickersContent = (
<div className='mx_Stickers_content_container'>
<div
@ -253,11 +261,8 @@ export default class Stickerpicker extends React.Component {
>
<PersistedElement persistKey={PERSISTED_ELEMENT_KEY} style={{zIndex: STICKERPICKER_Z_INDEX}}>
<AppTile
id={stickerpickerWidget.id}
url={stickerpickerWidget.content.url}
name={stickerpickerWidget.content.name}
app={stickerApp}
room={this.props.room}
type={stickerpickerWidget.content.type}
fullWidth={true}
userId={MatrixClientPeg.get().credentials.userId}
creatorUserId={stickerpickerWidget.sender || MatrixClientPeg.get().credentials.userId}