mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-29 11:25:38 +00:00
Fix close poll appearance
This commit is contained in:
parent
9f2c27072c
commit
49d76ffce7
@ -614,7 +614,7 @@ class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
totalVoterCount = totalVoters
|
totalVoterCount = totalVoters
|
||||||
if didVote {
|
if didVote || poll.isClosed {
|
||||||
for i in 0 ..< poll.options.count {
|
for i in 0 ..< poll.options.count {
|
||||||
inner: for optionVoters in voters {
|
inner: for optionVoters in voters {
|
||||||
if optionVoters.opaqueIdentifier == poll.options[i].opaqueIdentifier {
|
if optionVoters.opaqueIdentifier == poll.options[i].opaqueIdentifier {
|
||||||
|
|||||||
@ -348,12 +348,12 @@ class CreatePollOptionItemNode: ItemListRevealOptionsItemNode, ItemListItemNode,
|
|||||||
let editableControlFrame = CGRect(origin: CGPoint(x: params.leftInset + 6.0 + revealOffset, y: 0.0), size: controlSizeAndApply.0)
|
let editableControlFrame = CGRect(origin: CGPoint(x: params.leftInset + 6.0 + revealOffset, y: 0.0), size: controlSizeAndApply.0)
|
||||||
strongSelf.editableControlNode.frame = editableControlFrame
|
strongSelf.editableControlNode.frame = editableControlFrame
|
||||||
|
|
||||||
let _ = reorderSizeAndApply.1(displayTextLimit)
|
let _ = reorderSizeAndApply.1(displayTextLimit && layout.contentSize.height <= 44.0)
|
||||||
let reorderControlFrame = CGRect(origin: CGPoint(x: params.width + revealOffset - params.rightInset - reorderSizeAndApply.0.width, y: 0.0), size: reorderSizeAndApply.0)
|
let reorderControlFrame = CGRect(origin: CGPoint(x: params.width + revealOffset - params.rightInset - reorderSizeAndApply.0.width, y: 0.0), size: reorderSizeAndApply.0)
|
||||||
strongSelf.reorderControlNode.frame = reorderControlFrame
|
strongSelf.reorderControlNode.frame = reorderControlFrame
|
||||||
|
|
||||||
let _ = textLimitApply()
|
let _ = textLimitApply()
|
||||||
strongSelf.textLimitNode.frame = CGRect(origin: CGPoint(x: reorderControlFrame.minX + floor((reorderControlFrame.width - textLimitLayout.size.width) / 2.0) - 4.0 - UIScreenPixel, y: floor(reorderControlFrame.midY + 2.0)), size: textLimitLayout.size)
|
strongSelf.textLimitNode.frame = CGRect(origin: CGPoint(x: reorderControlFrame.minX + floor((reorderControlFrame.width - textLimitLayout.size.width) / 2.0) - 4.0 - UIScreenPixel, y: max(floor(reorderControlFrame.midY + 2.0), layout.contentSize.height - 15.0 - textLimitLayout.size.height)), size: textLimitLayout.size)
|
||||||
strongSelf.textLimitNode.isHidden = !displayTextLimit
|
strongSelf.textLimitNode.isHidden = !displayTextLimit
|
||||||
|
|
||||||
strongSelf.updateLayout(size: layout.contentSize, leftInset: params.leftInset, rightInset: params.rightInset)
|
strongSelf.updateLayout(size: layout.contentSize, leftInset: params.leftInset, rightInset: params.rightInset)
|
||||||
|
|||||||
@ -17,6 +17,7 @@ public enum MessageContentKindKey {
|
|||||||
case liveLocation
|
case liveLocation
|
||||||
case expiredImage
|
case expiredImage
|
||||||
case expiredVideo
|
case expiredVideo
|
||||||
|
case poll
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum MessageContentKind: Equatable {
|
public enum MessageContentKind: Equatable {
|
||||||
@ -34,6 +35,7 @@ public enum MessageContentKind: Equatable {
|
|||||||
case liveLocation
|
case liveLocation
|
||||||
case expiredImage
|
case expiredImage
|
||||||
case expiredVideo
|
case expiredVideo
|
||||||
|
case poll(String)
|
||||||
|
|
||||||
public var key: MessageContentKindKey {
|
public var key: MessageContentKindKey {
|
||||||
switch self {
|
switch self {
|
||||||
@ -65,6 +67,8 @@ public enum MessageContentKind: Equatable {
|
|||||||
return .expiredImage
|
return .expiredImage
|
||||||
case .expiredVideo:
|
case .expiredVideo:
|
||||||
return .expiredVideo
|
return .expiredVideo
|
||||||
|
case .poll:
|
||||||
|
return .poll
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,7 +145,7 @@ public func mediaContentKind(_ media: Media, message: Message? = nil, strings: P
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
case let poll as TelegramMediaPoll:
|
case let poll as TelegramMediaPoll:
|
||||||
return .text(poll.text)
|
return .poll(poll.text)
|
||||||
default:
|
default:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -185,6 +189,8 @@ func stringForMediaKind(_ kind: MessageContentKind, strings: PresentationStrings
|
|||||||
return (strings.Message_ImageExpired, true)
|
return (strings.Message_ImageExpired, true)
|
||||||
case .expiredVideo:
|
case .expiredVideo:
|
||||||
return (strings.Message_VideoExpired, true)
|
return (strings.Message_VideoExpired, true)
|
||||||
|
case let .poll(text):
|
||||||
|
return ("📊 \(text)", false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user