From 67f1443daa7b84a35d2fe37b1c7f38394f7873fe Mon Sep 17 00:00:00 2001 From: Isaac <> Date: Wed, 13 Dec 2023 23:29:02 +0400 Subject: [PATCH] Fill in default secret chat timer for standalone messages --- .../State/ManagedSecretChatOutgoingOperations.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/submodules/TelegramCore/Sources/State/ManagedSecretChatOutgoingOperations.swift b/submodules/TelegramCore/Sources/State/ManagedSecretChatOutgoingOperations.swift index daf468b03b..bcaf3dbe7e 100644 --- a/submodules/TelegramCore/Sources/State/ManagedSecretChatOutgoingOperations.swift +++ b/submodules/TelegramCore/Sources/State/ManagedSecretChatOutgoingOperations.swift @@ -1876,6 +1876,12 @@ private func sendStandaloneMessage(auxiliaryMethods: AccountAuxiliaryMethods, po if let value = contents.media { media.append(value) } + + var attributes = contents.attributes + if !attributes.contains(where: { $0 is AutoremoveTimeoutMessageAttribute }), let messageAutoremoveTimeout = state.messageAutoremoveTimeout { + attributes.append(AutoclearTimeoutMessageAttribute(timeout: messageAutoremoveTimeout, countdownBeginTime: nil)) + } + let message = Message( stableId: 1, stableVersion: 0, @@ -1892,7 +1898,7 @@ private func sendStandaloneMessage(auxiliaryMethods: AccountAuxiliaryMethods, po forwardInfo: nil, author: nil, text: contents.text, - attributes: contents.attributes, + attributes: attributes, media: media, peers: SimpleDictionary(), associatedMessages: SimpleDictionary(), @@ -1967,7 +1973,7 @@ private func sendStandaloneMessage(auxiliaryMethods: AccountAuxiliaryMethods, po } let entitiesAttribute = message.textEntitiesAttribute - let (tags, globalTags) = tagsForStoreMessage(incoming: false, attributes: contents.attributes, media: updatedMedia, textEntities: entitiesAttribute?.entities, isPinned: false) + let (tags, globalTags) = tagsForStoreMessage(incoming: false, attributes: attributes, media: updatedMedia, textEntities: entitiesAttribute?.entities, isPinned: false) let storedMessage = StoreMessage( peerId: peerId,