diff --git a/submodules/ComposePollUI/Sources/ComposePollScreen.swift b/submodules/ComposePollUI/Sources/ComposePollScreen.swift index 4fe507f2f1..c96f0dd597 100644 --- a/submodules/ComposePollUI/Sources/ComposePollScreen.swift +++ b/submodules/ComposePollUI/Sources/ComposePollScreen.swift @@ -477,7 +477,7 @@ final class ComposePollScreenComponent: Component { defer { self.isUpdating = false } - + var alphaTransition = transition if !transition.animation.isImmediate { alphaTransition = alphaTransition.withAnimation(.curve(duration: 0.25, curve: .easeInOut)) @@ -850,7 +850,7 @@ final class ComposePollScreenComponent: Component { } } - if self.pollOptions.count < 10, let lastOption = self.pollOptions.last { + if self.pollOptions.count < component.initialData.maxPollAnswersCount, let lastOption = self.pollOptions.last { if lastOption.textInputState.text.length != 0 { self.pollOptions.append(PollOption(id: self.nextPollOptionId)) self.nextPollOptionId += 1 @@ -921,7 +921,7 @@ final class ComposePollScreenComponent: Component { contentHeight += 7.0 - let pollOptionsLimitReached = self.pollOptions.count >= 10 + let pollOptionsLimitReached = self.pollOptions.count >= component.initialData.maxPollAnswersCount var animatePollOptionsFooterIn = false var pollOptionsFooterTransition = transition if self.currentPollOptionsLimitReached != pollOptionsLimitReached { @@ -944,7 +944,7 @@ final class ComposePollScreenComponent: Component { maximumNumberOfLines: 0 )) } else { - let remainingCount = 10 - self.pollOptions.count + let remainingCount = component.initialData.maxPollAnswersCount - self.pollOptions.count let rawString = environment.strings.CreatePoll_OptionCountFooterFormat(Int32(remainingCount)) var pollOptionsFooterItems: [AnimatedTextComponent.Item] = [] @@ -1476,13 +1476,16 @@ public class ComposePollScreen: ViewControllerComponentContainer, AttachmentCont public final class InitialData { fileprivate let maxPollTextLength: Int fileprivate let maxPollOptionLength: Int + fileprivate let maxPollAnswersCount: Int fileprivate init( maxPollTextLength: Int, - maxPollOptionLength: Int + maxPollOptionLength: Int, + maxPollAnwsersCount: Int ) { self.maxPollTextLength = maxPollTextLength self.maxPollOptionLength = maxPollOptionLength + self.maxPollAnswersCount = maxPollAnwsersCount } } @@ -1577,9 +1580,14 @@ public class ComposePollScreen: ViewControllerComponentContainer, AttachmentCont } public static func initialData(context: AccountContext) -> InitialData { + var maxPollAnwsersCount: Int = 10 + if let data = context.currentAppConfiguration.with({ $0 }).data, let value = data["poll_answers_max"] as? Double { + maxPollAnwsersCount = Int(value) + } return InitialData( maxPollTextLength: Int(200), - maxPollOptionLength: 100 + maxPollOptionLength: 100, + maxPollAnwsersCount: maxPollAnwsersCount ) } diff --git a/submodules/ContactListUI/Sources/ContactListNode.swift b/submodules/ContactListUI/Sources/ContactListNode.swift index fe89cebbd1..4be8b9e67c 100644 --- a/submodules/ContactListUI/Sources/ContactListNode.swift +++ b/submodules/ContactListUI/Sources/ContactListNode.swift @@ -426,7 +426,9 @@ private func contactListNodeEntries(accountPeer: EnginePeer?, peers: [ContactLis let text = strings.Contacts_PermissionsText switch authorizationStatus { case .limited: - entries.append(.permissionLimited(theme, strings)) + if displaySortOptions { + entries.append(.permissionLimited(theme, strings)) + } case .denied: entries.append(.permissionInfo(theme, title, text, suppressed)) entries.append(.permissionEnable(theme, strings.Permissions_ContactsAllowInSettings_v0)) diff --git a/submodules/TelegramUI/Sources/ChatControllerOpenAttachmentMenu.swift b/submodules/TelegramUI/Sources/ChatControllerOpenAttachmentMenu.swift index dc6721eaef..a7115e2b14 100644 --- a/submodules/TelegramUI/Sources/ChatControllerOpenAttachmentMenu.swift +++ b/submodules/TelegramUI/Sources/ChatControllerOpenAttachmentMenu.swift @@ -61,8 +61,10 @@ extension ChatControllerImpl { var canSendPolls = true if let peer = self.presentationInterfaceState.renderedPeer?.peer { - if let peer = peer as? TelegramUser, peer.botInfo == nil { - canSendPolls = false + if let peer = peer as? TelegramUser { + if peer.botInfo == nil && peer.id != self.context.account.peerId { + canSendPolls = false + } } else if peer is TelegramSecretChat { canSendPolls = false } else if let channel = peer as? TelegramChannel {