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