Story view receipts setting

This commit is contained in:
Fedor Indutny 2022-10-25 15:18:42 -07:00 committed by GitHub
parent ad42d98774
commit 3702a67975
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 161 additions and 35 deletions

View file

@ -362,6 +362,17 @@ export function toAccountRecord(
const hasStoriesDisabled = window.storage.get('hasStoriesDisabled');
accountRecord.storiesDisabled = hasStoriesDisabled === true;
const storyViewReceiptsEnabled = window.storage.get(
'storyViewReceiptsEnabled'
);
if (storyViewReceiptsEnabled !== undefined) {
accountRecord.storyViewReceiptsEnabled = storyViewReceiptsEnabled
? Proto.OptionalBool.ENABLED
: Proto.OptionalBool.DISABLED;
} else {
accountRecord.storyViewReceiptsEnabled = Proto.OptionalBool.UNSET;
}
applyUnknownFields(accountRecord, conversation);
return accountRecord;
@ -1093,6 +1104,7 @@ export async function mergeAccountRecord(
keepMutedChatsArchived,
hasSetMyStoriesPrivacy,
storiesDisabled,
storyViewReceiptsEnabled,
} = accountRecord;
const updatedConversations = new Array<ConversationModel>();
@ -1292,6 +1304,19 @@ export async function mergeAccountRecord(
window.textsecure.server?.onHasStoriesDisabledChange(hasStoriesDisabled);
}
switch (storyViewReceiptsEnabled) {
case Proto.OptionalBool.ENABLED:
window.storage.put('storyViewReceiptsEnabled', true);
break;
case Proto.OptionalBool.DISABLED:
window.storage.put('storyViewReceiptsEnabled', false);
break;
case Proto.OptionalBool.UNSET:
default:
// Do nothing
break;
}
const ourID = window.ConversationController.getOurConversationId();
if (!ourID) {