signal-desktop/ts/shims/textsecure.ts
2020-04-15 14:44:51 -07:00

38 lines
809 B
TypeScript

export function sendStickerPackSync(
packId: string,
packKey: string,
installed: boolean
) {
const { ConversationController, textsecure, log } = window;
const ourNumber = textsecure.storage.user.getNumber();
const { wrap, sendOptions } = ConversationController.prepareForSend(
ourNumber,
{ syncMessage: true }
);
if (!textsecure.messaging) {
log.error(
'shim: Cannot call sendStickerPackSync, textsecure.messaging is falsey'
);
return;
}
wrap(
textsecure.messaging.sendStickerPackSync(
[
{
packId,
packKey,
installed,
},
],
sendOptions
)
).catch(error => {
log.error(
'shim: Error calling sendStickerPackSync:',
error && error.stack ? error.stack : error
);
});
}