mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-19 16:08:34 +01:00
Send viewed receipt for view-once opens
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
expectSystemMessages,
|
||||
typeIntoInput,
|
||||
waitForEnabledComposer,
|
||||
waitForNonProfileKeyUpdateMessage,
|
||||
} from '../helpers.node.js';
|
||||
|
||||
export const debug = createDebug('mock:test:messaging');
|
||||
@@ -27,30 +28,6 @@ const IdentifierType = Proto.ManifestRecord.Identifier.Type;
|
||||
|
||||
const DAY = 24 * 3600;
|
||||
|
||||
function isProfileKeyUpdate(flags: number | null | undefined): boolean {
|
||||
if (flags == null) {
|
||||
return false;
|
||||
}
|
||||
// eslint-disable-next-line no-bitwise
|
||||
return (flags & Proto.DataMessage.Flags.PROFILE_KEY_UPDATE) !== 0;
|
||||
}
|
||||
|
||||
async function waitForNonProfileKeyUpdateMessage(
|
||||
device: PrimaryDevice
|
||||
): Promise<{ body: string; dataMessage: Proto.IDataMessage }> {
|
||||
const maxAttempts = 5;
|
||||
for (let i = 0; i < maxAttempts; i += 1) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const message = await device.waitForMessage();
|
||||
if (isProfileKeyUpdate(message.dataMessage.flags)) {
|
||||
debug('Skipping profile key update');
|
||||
continue;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
throw new Error(`No message with body after ${maxAttempts} attempts`);
|
||||
}
|
||||
|
||||
describe('messaging/expireTimerVersion', function (this: Mocha.Suite) {
|
||||
this.timeout(durations.MINUTE);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user