Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #450 from TheTimeWalker/ios-sticker-sending
Browse files Browse the repository at this point in the history
Fix iOS stickers by adding widgetData to callAction
  • Loading branch information
turt2live authored Dec 28, 2021
2 parents 7be069b + 835c95e commit 08bd131
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions web/app/shared/services/scalar/scalar-widget.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,33 +39,36 @@ export class ScalarWidgetApi {
}

public static sendSticker(sticker: FE_Sticker, pack: FE_StickerPack): void {
ScalarWidgetApi.callAction("m.sticker", {
data: {
description: sticker.description,
content: {
// Element Android requires content.body to contain the sticker description, otherwise
// you will not be able to send any stickers
body: sticker.description,
url: sticker.thumbnail.mxc,
info: {
const payload = {
description: sticker.description,
content: {
// Element Android requires content.body to contain the sticker description, otherwise
// you will not be able to send any stickers
body: sticker.description,
url: sticker.thumbnail.mxc,
info: {
mimetype: sticker.image.mimetype,
w: Math.round(sticker.thumbnail.width / 2),
h: Math.round(sticker.thumbnail.height / 2),
thumbnail_url: sticker.thumbnail.mxc,
thumbnail_info: {
mimetype: sticker.image.mimetype,
w: Math.round(sticker.thumbnail.width / 2),
h: Math.round(sticker.thumbnail.height / 2),
thumbnail_url: sticker.thumbnail.mxc,
thumbnail_info: {
mimetype: sticker.image.mimetype,
w: Math.round(sticker.thumbnail.width / 2),
h: Math.round(sticker.thumbnail.height / 2),
},

// This has to be included in the info object so it makes it to the event
dimension: {
license: pack.license,
author: pack.author,
},
},

// This has to be included in the info object so it makes it to the event
dimension: {
license: pack.license,
author: pack.author,
},
},
},
};
ScalarWidgetApi.callAction("m.sticker", {
data: payload,
// This is needed for Element iOS to work as it uses widgetData
widgetData: payload,
});
}

Expand Down

0 comments on commit 08bd131

Please sign in to comment.