mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-10-01 05:05:53 +00:00
Fix iOS stickers by adding widgetData to callAction
This commit is contained in:
parent
2fb719f7fd
commit
835c95e6e2
@ -39,33 +39,36 @@ export class ScalarWidgetApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static sendSticker(sticker: FE_Sticker, pack: FE_StickerPack): void {
|
public static sendSticker(sticker: FE_Sticker, pack: FE_StickerPack): void {
|
||||||
ScalarWidgetApi.callAction("m.sticker", {
|
const payload = {
|
||||||
data: {
|
description: sticker.description,
|
||||||
description: sticker.description,
|
content: {
|
||||||
content: {
|
// Element Android requires content.body to contain the sticker description, otherwise
|
||||||
// Element Android requires content.body to contain the sticker description, otherwise
|
// you will not be able to send any stickers
|
||||||
// you will not be able to send any stickers
|
body: sticker.description,
|
||||||
body: sticker.description,
|
url: sticker.thumbnail.mxc,
|
||||||
url: sticker.thumbnail.mxc,
|
info: {
|
||||||
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,
|
mimetype: sticker.image.mimetype,
|
||||||
w: Math.round(sticker.thumbnail.width / 2),
|
w: Math.round(sticker.thumbnail.width / 2),
|
||||||
h: Math.round(sticker.thumbnail.height / 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
|
// This has to be included in the info object so it makes it to the event
|
||||||
dimension: {
|
dimension: {
|
||||||
license: pack.license,
|
license: pack.license,
|
||||||
author: pack.author,
|
author: pack.author,
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
};
|
||||||
|
ScalarWidgetApi.callAction("m.sticker", {
|
||||||
|
data: payload,
|
||||||
|
// This is needed for Element iOS to work as it uses widgetData
|
||||||
|
widgetData: payload,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user