From 6663357a37c6e295338cd82ecff5cabceeee1736 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Wed, 12 Oct 2022 19:11:14 +0530 Subject: [PATCH] feat: handle default disappearing mode change notifications --- src/Socket/messages-recv.ts | 16 ++++++++++++++++ src/Types/Auth.ts | 2 ++ 2 files changed, 18 insertions(+) diff --git a/src/Socket/messages-recv.ts b/src/Socket/messages-recv.ts index af82533..5686c4b 100644 --- a/src/Socket/messages-recv.ts +++ b/src/Socket/messages-recv.ts @@ -314,6 +314,22 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => { } } + break + case 'account_sync': + if(child.tag === 'disappearing_mode') { + const newDuration = +child.attrs.duration + const timestamp = +child.attrs.t + ev.emit('creds.update', { + accountSettings: { + ...authState.creds.accountSettings, + defaultDisappearingMode: { + ephemeralExpiration: newDuration, + ephemeralSettingTimestamp: timestamp, + }, + } + }) + } + break } diff --git a/src/Types/Auth.ts b/src/Types/Auth.ts index 1b78bb0..1010da6 100644 --- a/src/Types/Auth.ts +++ b/src/Types/Auth.ts @@ -31,6 +31,8 @@ export type SignalCreds = { export type AccountSettings = { /** unarchive chats when a new message is received */ unarchiveChats: boolean + /** the default mode to start new conversations with */ + defaultDisappearingMode?: Pick } export type AuthenticationCreds = SignalCreds & {