signal-desktop/ts/shims/textsecure.ts

38 lines
904 B
TypeScript
Raw Normal View History

// Copyright 2019-2022 Signal Messenger, LLC
2020-10-30 20:34:04 +00:00
// SPDX-License-Identifier: AGPL-3.0-only
import * as log from '../logging/log';
import { singleProtoJobQueue } from '../jobs/singleProtoJobQueue';
import * as Errors from '../types/errors';
import MessageSender from '../textsecure/SendMessage';
2021-04-08 16:24:21 +00:00
export async function sendStickerPackSync(
packId: string,
packKey: string,
installed: boolean
2021-04-08 16:24:21 +00:00
): Promise<void> {
if (window.ConversationController.areWePrimaryDevice()) {
log.warn(
'shims/sendStickerPackSync: We are primary device; not sending sync'
);
return;
}
try {
await singleProtoJobQueue.add(
MessageSender.getStickerPackSync([
{
packId,
packKey,
installed,
},
])
);
} catch (error) {
log.error(
'sendStickerPackSync: Failed to queue sync message',
Errors.toLogFormat(error)
);
}
}