Message Send Log to enable comprehensive resend

This commit is contained in:
Scott Nonnenberg 2021-07-15 16:48:09 -07:00 committed by GitHub
parent 0fe68b57b1
commit a42c41ed01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 3154 additions and 1266 deletions

View file

@ -1,19 +1,19 @@
// Copyright 2019-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { handleMessageSend } from '../util/handleMessageSend';
import { getSendOptions } from '../util/getSendOptions';
export async function sendStickerPackSync(
packId: string,
packKey: string,
installed: boolean
): Promise<void> {
const { ConversationController, textsecure, log } = window;
const ourNumber = textsecure.storage.user.getNumber();
const { wrap, sendOptions } = await ConversationController.prepareForSend(
ourNumber,
{
syncMessage: true,
}
);
const ourConversation = ConversationController.getOurConversationOrThrow();
const sendOptions = await getSendOptions(ourConversation.attributes, {
syncMessage: true,
});
if (!textsecure.messaging) {
log.error(
@ -23,7 +23,14 @@ export async function sendStickerPackSync(
return;
}
wrap(
if (window.ConversationController.areWePrimaryDevice()) {
window.log.warn(
'shims/sendStickerPackSync: We are primary device; not sending sync'
);
return;
}
handleMessageSend(
textsecure.messaging.sendStickerPackSync(
[
{
@ -33,7 +40,8 @@ export async function sendStickerPackSync(
},
],
sendOptions
)
),
{ messageIds: [], sendType: 'otherSync' }
).catch(error => {
log.error(
'shim: Error calling sendStickerPackSync:',