Support reporting token on envelope

This commit is contained in:
Fedor Indutny 2023-02-07 16:55:12 -08:00 committed by GitHub
parent dc8d8e529d
commit 486cbe0471
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 98 additions and 26 deletions

View file

@ -2090,6 +2090,18 @@ export class ConversationModel extends window.Backbone
}
}
async updateReportingToken(token?: Uint8Array): Promise<void> {
const oldValue = this.get('reportingToken');
const newValue = token ? Bytes.toBase64(token) : undefined;
if (oldValue === newValue) {
return;
}
this.set('reportingToken', newValue);
await window.Signal.Data.updateConversation(this.attributes);
}
incrementMessageCount(): void {
this.set({
messageCount: (this.get('messageCount') || 0) + 1,