diff --git a/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift b/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift index 63f0c1331b..3cd445d143 100644 --- a/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift +++ b/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift @@ -1867,7 +1867,6 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState } var clearCacheAsDelete = false - var hasViewStats = false if let channel = message.peers[message.id.peerId] as? TelegramChannel, case .broadcast = channel.info, !isMigrated { var views: Int = 0 var forwards: Int = 0 @@ -1888,28 +1887,11 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState controllerInteraction.openMessageStats(messages[0].id) }) }))) - hasViewStats = true } clearCacheAsDelete = true } - if !hasViewStats, messages[0].forwardInfo == nil { - for media in message.media { - if let poll = media as? TelegramMediaPoll, message.id.namespace == Namespaces.Message.Cloud, poll.pollId.namespace == Namespaces.Media.CloudPoll { - actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ViewPollStats, icon: { theme in - return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Statistics"), color: theme.actionSheet.primaryTextColor) - }, action: { c, _ in - c?.dismiss(completion: { - let controller = context.sharedContext.makePollStatsScreen(context: context, messageId: messages[0].id) - controllerInteraction.navigationController()?.pushViewController(controller) - }) - }))) - break - } - } - } - if message.id.namespace == Namespaces.Message.Cloud, let channel = message.peers[message.id.peerId] as? TelegramChannel, case .broadcast = channel.info, canEditFactCheck(appConfig: appConfig) { var canAddFactCheck = true if message.media.contains(where: { $0 is TelegramMediaAction || $0 is TelegramMediaGiveaway }) { @@ -2284,57 +2266,6 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState } } - - - // - for media in message.media { - if let poll = media as? TelegramMediaPoll, message.id.namespace == Namespaces.Message.Cloud, poll.pollId.namespace == Namespaces.Media.CloudPoll { - var restrictionText: String = "" - let peerName: String = chatPresentationInterfaceState.renderedPeer?.peer.flatMap(EnginePeer.init)?.compactDisplayTitle ?? "" - - if !poll.countries.isEmpty { - let locale = localeWithStrings(chatPresentationInterfaceState.strings) - let countryNames = poll.countries.map { id in - if let countryName = locale.localizedString(forRegionCode: id) { - return countryName - //return "\(flagEmoji(countryCode: id))\u{feff}\(countryName)" - } else { - return id - } - } - var countries: String = "" - if countryNames.count == 1, let country = countryNames.first { - countries = "**\(country)**" - } else { - for i in 0 ..< countryNames.count { - countries.append("**\(countryNames[i])**") - if i == countryNames.count - 2 { - countries.append(chatPresentationInterfaceState.strings.Chat_Poll_Restriction_Country_CountriesLastDelimiter) - } else if i < countryNames.count - 2 { - countries.append(chatPresentationInterfaceState.strings.Chat_Poll_Restriction_Country_CountriesDelimiter) - } - } - } - if poll.restrictToSubscribers { - restrictionText = chatPresentationInterfaceState.strings.Chat_Poll_Restriction_SubscribersCountry(peerName, countries).string - } else { - restrictionText = chatPresentationInterfaceState.strings.Chat_Poll_Restriction_Country(countries).string - } - } else if poll.restrictToSubscribers { - restrictionText = chatPresentationInterfaceState.strings.Chat_Poll_Restriction_Subscribers(peerName).string - } - - if !restrictionText.isEmpty { - actions.append(.separator) - let noAction: ((ContextMenuActionItem.Action) -> Void)? = nil - actions.append( - .action(ContextMenuActionItem(text: restrictionText, textLayout: .multiline, textFont: .small, parseMarkdown: true, icon: { _ in return nil }, action: noAction)) - ) - } - break - } - } - return ContextController.Items(content: .list(actions), tip: nil) } }