Sync storiesDisabled flag on AccountRecord

This commit is contained in:
Fedor Indutny 2022-10-04 10:53:36 -07:00 committed by GitHub
parent 3e57cb8549
commit 8b705d3b55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 42 additions and 35 deletions

View file

@ -48,7 +48,7 @@ export type IPCEventsValuesType = {
callRingtoneNotification: boolean;
callSystemNotification: boolean;
countMutedConversations: boolean;
hasStoriesEnabled: boolean;
hasStoriesDisabled: boolean;
hideMenuBar: boolean | undefined;
incomingCallNotification: boolean;
lastSyncTime: number | undefined;
@ -178,9 +178,13 @@ export function createIPCEvents(
webFrame.setZoomFactor(zoomFactor);
},
getHasStoriesEnabled: () => window.storage.get('hasStoriesEnabled', true),
setHasStoriesEnabled: (value: boolean) =>
window.storage.put('hasStoriesEnabled', value),
getHasStoriesDisabled: () =>
window.storage.get('hasStoriesDisabled', false),
setHasStoriesDisabled: async (value: boolean) => {
await window.storage.put('hasStoriesDisabled', value);
const account = window.ConversationController.getOurConversationOrThrow();
account.captureChange('hasStoriesDisabled');
},
getPreferredAudioInputDevice: () =>
window.storage.get('preferred-audio-input-device'),
@ -357,11 +361,7 @@ export function createIPCEvents(
await universalExpireTimer.set(newValue);
// Update account in Storage Service
const conversationId =
window.ConversationController.getOurConversationIdOrThrow();
const account = window.ConversationController.get(conversationId);
assertDev(account, "Account wasn't found");
const account = window.ConversationController.getOurConversationOrThrow();
account.captureChange('universalExpireTimer');
// Add a notification to the currently open conversation