mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-06-20 18:24:43 +00:00
Add channel discussion option
This commit is contained in:
@@ -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 {
|
||||
|
||||
+21
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user