Send viewed receipt for view-once opens

This commit is contained in:
yash-signal
2026-02-18 12:28:16 -06:00
committed by GitHub
parent 6aca6a278a
commit c8619bc42b
4 changed files with 65 additions and 27 deletions

View File

@@ -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);