From d4658516776d0fb54c706b52e01e8d683e6681f6 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Sun, 16 Feb 2025 23:19:19 +0400 Subject: [PATCH 1/2] Test --- submodules/LegacyComponents/Sources/TGPhotoEditorController.m | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/submodules/LegacyComponents/Sources/TGPhotoEditorController.m b/submodules/LegacyComponents/Sources/TGPhotoEditorController.m index 093e0cc636..db0e8ca807 100644 --- a/submodules/LegacyComponents/Sources/TGPhotoEditorController.m +++ b/submodules/LegacyComponents/Sources/TGPhotoEditorController.m @@ -368,9 +368,7 @@ _scrubberView.delegate = self; _scrubberView.clipsToBounds = false; } - - [self detectFaces]; - + [self presentTab:_currentTab]; } From 39e8c7bb2eb43b2275c544132518e33ffc206edf Mon Sep 17 00:00:00 2001 From: Mikhail Filimonov Date: Mon, 17 Feb 2025 12:41:04 +0200 Subject: [PATCH 2/2] macos and other stuff --- .../Sources/State/PaidMessages.swift | 12 +++++++ .../TelegramEngine/Data/PeersData.swift | 34 +++++++++++++++++++ .../Sources/Utils/MessageUtils.swift | 18 ++++++++++ .../Sources/GroupCallContext.swift | 2 ++ 4 files changed, 66 insertions(+) diff --git a/submodules/TelegramCore/Sources/State/PaidMessages.swift b/submodules/TelegramCore/Sources/State/PaidMessages.swift index fa3e8756e4..95314d227c 100644 --- a/submodules/TelegramCore/Sources/State/PaidMessages.swift +++ b/submodules/TelegramCore/Sources/State/PaidMessages.swift @@ -43,6 +43,18 @@ func _internal_addNoPaidMessagesException(account: Account, peerId: PeerId, refu return account.network.request(Api.functions.account.addNoPaidMessagesException(flags: flags, userId: inputUser)) |> `catch` { _ -> Signal in return .single(.boolFalse) + } |> mapToSignal { _ in + return account.postbox.transaction { transaction -> Void in + transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, cachedData in + if let cachedData = cachedData as? CachedUserData { + var settings = cachedData.peerStatusSettings ?? .init() + settings.paidMessageStars = nil + return cachedData.withUpdatedPeerStatusSettings(settings) + } + return cachedData + }) + } + |> ignoreValues } |> ignoreValues } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Data/PeersData.swift b/submodules/TelegramCore/Sources/TelegramEngine/Data/PeersData.swift index 2a096a11a8..71ed10b3ac 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Data/PeersData.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Data/PeersData.swift @@ -361,6 +361,40 @@ public extension TelegramEngine.EngineData.Item { } } } + + public struct SendPaidMessageStars: TelegramEngineDataItem, TelegramEngineMapKeyDataItem, PostboxViewDataItem { + public typealias Result = Optional + + fileprivate var id: EnginePeer.Id + public var mapKey: EnginePeer.Id { + return self.id + } + + public init(id: EnginePeer.Id) { + self.id = id + } + + var key: PostboxViewKey { + return .cachedPeerData(peerId: self.id) + } + + func extract(view: PostboxView) -> Result { + guard let view = view as? CachedPeerDataView else { + preconditionFailure() + } + guard let cachedPeerData = view.cachedPeerData else { + return nil + } + switch cachedPeerData { + case let user as CachedUserData: + return user.sendPaidMessageStars + case let channel as CachedChannelData: + return channel.sendPaidMessageStars + default: + return nil + } + } + } public struct GroupCallDescription: TelegramEngineDataItem, TelegramEngineMapKeyDataItem, PostboxViewDataItem { public typealias Result = Optional diff --git a/submodules/TelegramCore/Sources/Utils/MessageUtils.swift b/submodules/TelegramCore/Sources/Utils/MessageUtils.swift index 44b136b5ea..89c79c3ee8 100644 --- a/submodules/TelegramCore/Sources/Utils/MessageUtils.swift +++ b/submodules/TelegramCore/Sources/Utils/MessageUtils.swift @@ -470,6 +470,24 @@ public extension Message { } return nil } + + var derivedDataAttribute: DerivedDataMessageAttribute? { + for attribute in self.attributes { + if let attribute = attribute as? DerivedDataMessageAttribute { + return attribute + } + } + return nil + } + + var forwardVideoTimestampAttribute: ForwardVideoTimestampAttribute? { + for attribute in self.attributes { + if let attribute = attribute as? ForwardVideoTimestampAttribute { + return attribute + } + } + return nil + } } public extension Message { var reactionsAttribute: ReactionsMessageAttribute? { diff --git a/submodules/TelegramVoip/Sources/GroupCallContext.swift b/submodules/TelegramVoip/Sources/GroupCallContext.swift index 303bc5fbda..bb08d239cc 100644 --- a/submodules/TelegramVoip/Sources/GroupCallContext.swift +++ b/submodules/TelegramVoip/Sources/GroupCallContext.swift @@ -1088,7 +1088,9 @@ public final class OngoingGroupCallContext { } func activateIncomingAudio() { + #if os(iOS) self.context.activateIncomingAudio() + #endif } }