Fix Gift Badge expiration
This commit is contained in:
parent
4cd86f558e
commit
07ee7f46b7
1 changed files with 3 additions and 3 deletions
|
@ -27,6 +27,7 @@ import type {
|
||||||
import { WarnOnlyError } from './Errors';
|
import { WarnOnlyError } from './Errors';
|
||||||
import { GiftBadgeStates } from '../components/conversation/Message';
|
import { GiftBadgeStates } from '../components/conversation/Message';
|
||||||
import { APPLICATION_OCTET_STREAM, stringToMIMEType } from '../types/MIME';
|
import { APPLICATION_OCTET_STREAM, stringToMIMEType } from '../types/MIME';
|
||||||
|
import { SECOND } from '../util/durations';
|
||||||
|
|
||||||
const FLAGS = Proto.DataMessage.Flags;
|
const FLAGS = Proto.DataMessage.Flags;
|
||||||
export const ATTACHMENT_MAX = 32;
|
export const ATTACHMENT_MAX = 32;
|
||||||
|
@ -242,7 +243,6 @@ export function processDelete(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function processGiftBadge(
|
export function processGiftBadge(
|
||||||
timestamp: number,
|
|
||||||
giftBadge: Proto.DataMessage.IGiftBadge | null | undefined
|
giftBadge: Proto.DataMessage.IGiftBadge | null | undefined
|
||||||
): ProcessedGiftBadge | undefined {
|
): ProcessedGiftBadge | undefined {
|
||||||
if (
|
if (
|
||||||
|
@ -258,7 +258,7 @@ export function processGiftBadge(
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
expiration: timestamp + Number(receipt.getReceiptExpirationTime()),
|
expiration: Number(receipt.getReceiptExpirationTime()) * SECOND,
|
||||||
id: undefined,
|
id: undefined,
|
||||||
level: Number(receipt.getReceiptLevel()),
|
level: Number(receipt.getReceiptLevel()),
|
||||||
receiptCredentialPresentation: Bytes.toBase64(
|
receiptCredentialPresentation: Bytes.toBase64(
|
||||||
|
@ -317,7 +317,7 @@ export async function processDataMessage(
|
||||||
bodyRanges: message.bodyRanges ?? [],
|
bodyRanges: message.bodyRanges ?? [],
|
||||||
groupCallUpdate: dropNull(message.groupCallUpdate),
|
groupCallUpdate: dropNull(message.groupCallUpdate),
|
||||||
storyContext: dropNull(message.storyContext),
|
storyContext: dropNull(message.storyContext),
|
||||||
giftBadge: processGiftBadge(timestamp, message.giftBadge),
|
giftBadge: processGiftBadge(message.giftBadge),
|
||||||
};
|
};
|
||||||
|
|
||||||
const isEndSession = Boolean(result.flags & FLAGS.END_SESSION);
|
const isEndSession = Boolean(result.flags & FLAGS.END_SESSION);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue