diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift b/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift index 9d50c8e691..92cc47a2e2 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift @@ -43,6 +43,7 @@ public enum StarGift: Equatable, Codable, PostboxCoding { public static let isBirthdayGift = Flags(rawValue: 1 << 0) public static let requiresPremium = Flags(rawValue: 1 << 1) + public static let peerColorAvailable = Flags(rawValue: 1 << 2) } enum CodingKeys: String, CodingKey { @@ -951,6 +952,9 @@ extension StarGift { if (apiFlags & (1 << 7)) != 0 { flags.insert(.requiresPremium) } + if (apiFlags & (1 << 10)) != 0 { + flags.insert(.peerColorAvailable) + } var availability: StarGift.Gift.Availability? if let availabilityRemains, let availabilityTotal { diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift index 6a98d2d19e..9c75e69e0e 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift @@ -6215,7 +6215,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro } case .discussion: if let cachedData = self.data?.cachedData as? CachedChannelData, case let .known(maybeLinkedDiscussionPeerId) = cachedData.linkedDiscussionPeerId, let linkedDiscussionPeerId = maybeLinkedDiscussionPeerId { - let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: linkedDiscussionPeerId)) + let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: linkedDiscussionPeerId)) |> deliverOnMainQueue).startStandalone(next: { [weak self] linkedDiscussionPeer in guard let self, let linkedDiscussionPeer else { return @@ -6616,7 +6616,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro canSetupAutoremoveTimeout = true } } - + if filteredButtons.contains(.call) { items.append(.action(ContextMenuActionItem(text: presentationData.strings.PeerInfo_ButtonCall, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Call"), color: theme.contextMenu.primaryColor) @@ -6634,6 +6634,25 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro }))) } + var hasDiscussion = false + if let channel = chatPeer as? TelegramChannel { + switch channel.info { + case let .broadcast(info): + hasDiscussion = info.flags.contains(.hasDiscussionGroup) + case .group: + hasDiscussion = false + } + } + if !headerButtons.contains(.discussion) && hasDiscussion { + //TODO:localize + items.append(.action(ContextMenuActionItem(text: "View Discussion", icon: { theme in + generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/MessageBubble"), color: theme.contextMenu.primaryColor) + }, action: { [weak self] _, f in + f(.dismissWithoutContent) + self?.performButtonAction(key: .discussion, gesture: nil) + }))) + } + if let user = peer as? TelegramUser { if user.botInfo == nil && strongSelf.data?.encryptionKeyFingerprint == nil && !user.isDeleted { items.append(.action(ContextMenuActionItem(text: presentationData.strings.UserInfo_ChangeWallpaper, icon: { theme in