mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Various fixes
This commit is contained in:
@@ -488,6 +488,8 @@ final class ComposePollScreenComponent: Component {
|
||||
self.environment = environment
|
||||
|
||||
if self.component == nil {
|
||||
self.isQuiz = component.isQuiz ?? false
|
||||
|
||||
self.pollOptions.append(ComposePollScreenComponent.PollOption(
|
||||
id: self.nextPollOptionId
|
||||
))
|
||||
@@ -1002,28 +1004,35 @@ final class ComposePollScreenComponent: Component {
|
||||
contentHeight += pollOptionsSectionFooterSize.height
|
||||
contentHeight += sectionSpacing
|
||||
|
||||
var canBePublic = true
|
||||
if case let .channel(channel) = component.peer, case .broadcast = channel.info {
|
||||
canBePublic = false
|
||||
}
|
||||
|
||||
var pollSettingsSectionItems: [AnyComponentWithIdentity<Empty>] = []
|
||||
pollSettingsSectionItems.append(AnyComponentWithIdentity(id: "anonymous", component: AnyComponent(ListActionItemComponent(
|
||||
theme: environment.theme,
|
||||
title: AnyComponent(VStack([
|
||||
AnyComponentWithIdentity(id: AnyHashable(0), component: AnyComponent(MultilineTextComponent(
|
||||
text: .plain(NSAttributedString(
|
||||
string: environment.strings.CreatePoll_Anonymous,
|
||||
font: Font.regular(presentationData.listsFontSize.baseDisplaySize),
|
||||
textColor: environment.theme.list.itemPrimaryTextColor
|
||||
)),
|
||||
maximumNumberOfLines: 1
|
||||
))),
|
||||
], alignment: .left, spacing: 2.0)),
|
||||
accessory: .toggle(ListActionItemComponent.Toggle(style: .regular, isOn: self.isAnonymous, action: { [weak self] _ in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
self.isAnonymous = !self.isAnonymous
|
||||
self.state?.updated(transition: .spring(duration: 0.4))
|
||||
})),
|
||||
action: nil
|
||||
))))
|
||||
if canBePublic {
|
||||
pollSettingsSectionItems.append(AnyComponentWithIdentity(id: "anonymous", component: AnyComponent(ListActionItemComponent(
|
||||
theme: environment.theme,
|
||||
title: AnyComponent(VStack([
|
||||
AnyComponentWithIdentity(id: AnyHashable(0), component: AnyComponent(MultilineTextComponent(
|
||||
text: .plain(NSAttributedString(
|
||||
string: environment.strings.CreatePoll_Anonymous,
|
||||
font: Font.regular(presentationData.listsFontSize.baseDisplaySize),
|
||||
textColor: environment.theme.list.itemPrimaryTextColor
|
||||
)),
|
||||
maximumNumberOfLines: 1
|
||||
))),
|
||||
], alignment: .left, spacing: 2.0)),
|
||||
accessory: .toggle(ListActionItemComponent.Toggle(style: .regular, isOn: self.isAnonymous, action: { [weak self] _ in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
self.isAnonymous = !self.isAnonymous
|
||||
self.state?.updated(transition: .spring(duration: 0.4))
|
||||
})),
|
||||
action: nil
|
||||
))))
|
||||
}
|
||||
pollSettingsSectionItems.append(AnyComponentWithIdentity(id: "multiAnswer", component: AnyComponent(ListActionItemComponent(
|
||||
theme: environment.theme,
|
||||
title: AnyComponent(VStack([
|
||||
@@ -1569,7 +1578,7 @@ public class ComposePollScreen: ViewControllerComponentContainer, AttachmentCont
|
||||
|
||||
public static func initialData(context: AccountContext) -> InitialData {
|
||||
return InitialData(
|
||||
maxPollTextLength: Int(255),
|
||||
maxPollTextLength: Int(200),
|
||||
maxPollOptionLength: 100
|
||||
)
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ private struct OrderedLinkedList<T: Equatable>: Sequence, Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
private let maxTextLength = 255
|
||||
private let maxTextLength = 200
|
||||
private let maxOptionLength = 100
|
||||
private let maxOptionCount = 10
|
||||
|
||||
|
||||
Reference in New Issue
Block a user