mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Assorted fixes
This commit is contained in:
parent
000a1ebc31
commit
48c7c19537
@ -628,9 +628,9 @@ final class ChatListFilterTabContainerNode: ASDisplayNode {
|
||||
self.selectedLineNode.image = generateImage(CGSize(width: 5.0, height: 3.0), rotatedContext: { size, context in
|
||||
context.clear(CGRect(origin: CGPoint(), size: size))
|
||||
context.setFillColor(presentationData.theme.list.itemAccentColor.cgColor)
|
||||
context.fillEllipse(in: CGRect(origin: CGPoint(), size: CGSize(width: 3.0, height: 3.0)))
|
||||
context.fillEllipse(in: CGRect(origin: CGPoint(x: size.width - 3.0, y: 0.0), size: CGSize(width: 3.0, height: 3.0)))
|
||||
context.fill(CGRect(x: 1.5, y: 0.0, width: size.width - 3.0, height: 3.0))
|
||||
context.fillEllipse(in: CGRect(origin: CGPoint(), size: CGSize(width: 4.0, height: 4.0)))
|
||||
context.fillEllipse(in: CGRect(origin: CGPoint(x: size.width - 4.0, y: 0.0), size: CGSize(width: 4.0, height: 4.0)))
|
||||
context.fill(CGRect(x: 2.0, y: 0.0, width: size.width - 4.0, height: 4.0))
|
||||
context.fill(CGRect(x: 0.0, y: 2.0, width: size.width, height: 2.0))
|
||||
})?.resizableImage(withCapInsets: UIEdgeInsets(top: 3.0, left: 3.0, bottom: 0.0, right: 3.0), resizingMode: .stretch)
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ final class ChatListBadgeNode: ASDisplayNode {
|
||||
|
||||
self.textNode = TextNode()
|
||||
self.textNode.isUserInteractionEnabled = false
|
||||
self.textNode.displaysAsynchronously = true
|
||||
self.textNode.displaysAsynchronously = false
|
||||
|
||||
self.measureTextNode = TextNode()
|
||||
|
||||
|
@ -95,6 +95,9 @@ public enum TabBarItemContextActionType {
|
||||
if !self.lockOrientation {
|
||||
self.lockedOrientation = nil
|
||||
}
|
||||
if let window = self.window {
|
||||
window.invalidateSupportedOrientations()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2992,6 +2992,9 @@ func replayFinalState(accountManager: AccountManager, postbox: Postbox, accountP
|
||||
}
|
||||
if upperId >= messageId.id {
|
||||
transaction.addHole(peerId: messageId.peerId, namespace: messageId.namespace, space: .everywhere, range: messageId.id ... upperId)
|
||||
|
||||
transaction.addHole(peerId: messageId.peerId, namespace: messageId.namespace, space: .tag(.pinned), range: 1 ... upperId)
|
||||
|
||||
Logger.shared.log("State", "adding hole for peer \(messageId.peerId), \(messageId.id) ... \(upperId)")
|
||||
} else {
|
||||
Logger.shared.log("State", "not adding hole for peer \(messageId.peerId), \(upperId) >= \(messageId.id) = false")
|
||||
|
@ -601,9 +601,18 @@ func contextMenuForChatPresentationIntefaceState(chatPresentationInterfaceState:
|
||||
|
||||
var threadId: Int64?
|
||||
var threadMessageCount: Int = 0
|
||||
if case .peer = chatPresentationInterfaceState.chatLocation, let channel = chatPresentationInterfaceState.renderedPeer?.peer as? TelegramChannel, case .group = channel.info, let cachedData = cachedData as? CachedChannelData, case let .known(maybeValue) = cachedData.linkedDiscussionPeerId, let _ = maybeValue {
|
||||
if let value = messages[0].threadId {
|
||||
threadId = value
|
||||
if case .peer = chatPresentationInterfaceState.chatLocation, let channel = chatPresentationInterfaceState.renderedPeer?.peer as? TelegramChannel, case .group = channel.info {
|
||||
if let cachedData = cachedData as? CachedChannelData, case let .known(maybeValue) = cachedData.linkedDiscussionPeerId, let _ = maybeValue {
|
||||
if let value = messages[0].threadId {
|
||||
threadId = value
|
||||
} else {
|
||||
for attribute in messages[0].attributes {
|
||||
if let attribute = attribute as? ReplyThreadMessageAttribute, attribute.count > 0 {
|
||||
threadId = makeMessageThreadId(messages[0].id)
|
||||
threadMessageCount = Int(attribute.count)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for attribute in messages[0].attributes {
|
||||
if let attribute = attribute as? ReplyThreadMessageAttribute, attribute.count > 0 {
|
||||
@ -612,13 +621,6 @@ func contextMenuForChatPresentationIntefaceState(chatPresentationInterfaceState:
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for attribute in messages[0].attributes {
|
||||
if let attribute = attribute as? ReplyThreadMessageAttribute, attribute.count > 0 {
|
||||
threadId = makeMessageThreadId(messages[0].id)
|
||||
threadMessageCount = Int(attribute.count)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let _ = threadId, !isPinnedMessages {
|
||||
|
@ -37,7 +37,7 @@ class ChatMessageActionBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
required init() {
|
||||
self.labelNode = TextNode()
|
||||
self.labelNode.isUserInteractionEnabled = false
|
||||
self.labelNode.displaysAsynchronously = true
|
||||
self.labelNode.displaysAsynchronously = false
|
||||
|
||||
self.filledBackgroundNode = LinkHighlightingNode(color: .clear)
|
||||
|
||||
|
@ -252,7 +252,7 @@ final class ChatMessageAttachedContentNode: ASDisplayNode {
|
||||
|
||||
self.textNode = TextNode()
|
||||
self.textNode.isUserInteractionEnabled = false
|
||||
self.textNode.displaysAsynchronously = true
|
||||
self.textNode.displaysAsynchronously = false
|
||||
self.textNode.contentsScale = UIScreenScale
|
||||
self.textNode.contentMode = .topLeft
|
||||
|
||||
|
@ -39,13 +39,13 @@ class ChatMessageCallBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
self.titleNode.isUserInteractionEnabled = false
|
||||
self.titleNode.contentMode = .topLeft
|
||||
self.titleNode.contentsScale = UIScreenScale
|
||||
self.titleNode.displaysAsynchronously = true
|
||||
self.titleNode.displaysAsynchronously = false
|
||||
self.addSubnode(self.titleNode)
|
||||
|
||||
self.labelNode.isUserInteractionEnabled = false
|
||||
self.labelNode.contentMode = .topLeft
|
||||
self.labelNode.contentsScale = UIScreenScale
|
||||
self.labelNode.displaysAsynchronously = true
|
||||
self.labelNode.displaysAsynchronously = false
|
||||
self.addSubnode(self.labelNode)
|
||||
|
||||
self.addSubnode(self.iconNode)
|
||||
|
@ -173,7 +173,7 @@ class ChatMessageDateAndStatusNode: ASDisplayNode {
|
||||
override init() {
|
||||
self.dateNode = TextNode()
|
||||
self.dateNode.isUserInteractionEnabled = false
|
||||
self.dateNode.displaysAsynchronously = true
|
||||
self.dateNode.displaysAsynchronously = false
|
||||
|
||||
super.init()
|
||||
|
||||
|
@ -94,17 +94,17 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
|
||||
override init() {
|
||||
self.titleNode = TextNode()
|
||||
self.titleNode.displaysAsynchronously = true
|
||||
self.titleNode.displaysAsynchronously = false
|
||||
self.titleNode.isUserInteractionEnabled = false
|
||||
|
||||
self.descriptionNode = TextNode()
|
||||
self.descriptionNode.displaysAsynchronously = true
|
||||
self.descriptionNode.displaysAsynchronously = false
|
||||
self.descriptionNode.isUserInteractionEnabled = false
|
||||
|
||||
self.descriptionMeasuringNode = TextNode()
|
||||
|
||||
self.fetchingTextNode = ImmediateTextNode()
|
||||
self.fetchingTextNode.displaysAsynchronously = true
|
||||
self.fetchingTextNode.displaysAsynchronously = false
|
||||
self.fetchingTextNode.isUserInteractionEnabled = false
|
||||
self.fetchingTextNode.maximumNumberOfLines = 1
|
||||
self.fetchingTextNode.contentMode = .left
|
||||
@ -112,7 +112,7 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
||||
self.fetchingTextNode.isHidden = true
|
||||
|
||||
self.fetchingCompactTextNode = ImmediateTextNode()
|
||||
self.fetchingCompactTextNode.displaysAsynchronously = true
|
||||
self.fetchingCompactTextNode.displaysAsynchronously = false
|
||||
self.fetchingCompactTextNode.isUserInteractionEnabled = false
|
||||
self.fetchingCompactTextNode.maximumNumberOfLines = 1
|
||||
self.fetchingCompactTextNode.contentMode = .left
|
||||
|
@ -862,13 +862,13 @@ class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
self.textNode.isUserInteractionEnabled = false
|
||||
self.textNode.contentMode = .topLeft
|
||||
self.textNode.contentsScale = UIScreenScale
|
||||
self.textNode.displaysAsynchronously = true
|
||||
self.textNode.displaysAsynchronously = false
|
||||
|
||||
self.typeNode = TextNode()
|
||||
self.typeNode.isUserInteractionEnabled = false
|
||||
self.typeNode.contentMode = .topLeft
|
||||
self.typeNode.contentsScale = UIScreenScale
|
||||
self.typeNode.displaysAsynchronously = true
|
||||
self.typeNode.displaysAsynchronously = false
|
||||
|
||||
self.avatarsNode = MergedAvatarsNode()
|
||||
|
||||
@ -876,7 +876,7 @@ class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
self.votersNode.isUserInteractionEnabled = false
|
||||
self.votersNode.contentMode = .topLeft
|
||||
self.votersNode.contentsScale = UIScreenScale
|
||||
self.votersNode.displaysAsynchronously = true
|
||||
self.votersNode.displaysAsynchronously = false
|
||||
|
||||
var displaySolution: (() -> Void)?
|
||||
self.solutionButtonNode = SolutionButtonNode(pressed: {
|
||||
@ -888,19 +888,19 @@ class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
self.buttonSubmitInactiveTextNode.isUserInteractionEnabled = false
|
||||
self.buttonSubmitInactiveTextNode.contentMode = .topLeft
|
||||
self.buttonSubmitInactiveTextNode.contentsScale = UIScreenScale
|
||||
self.buttonSubmitInactiveTextNode.displaysAsynchronously = true
|
||||
self.buttonSubmitInactiveTextNode.displaysAsynchronously = false
|
||||
|
||||
self.buttonSubmitActiveTextNode = TextNode()
|
||||
self.buttonSubmitActiveTextNode.isUserInteractionEnabled = false
|
||||
self.buttonSubmitActiveTextNode.contentMode = .topLeft
|
||||
self.buttonSubmitActiveTextNode.contentsScale = UIScreenScale
|
||||
self.buttonSubmitActiveTextNode.displaysAsynchronously = true
|
||||
self.buttonSubmitActiveTextNode.displaysAsynchronously = false
|
||||
|
||||
self.buttonViewResultsTextNode = TextNode()
|
||||
self.buttonViewResultsTextNode.isUserInteractionEnabled = false
|
||||
self.buttonViewResultsTextNode.contentMode = .topLeft
|
||||
self.buttonViewResultsTextNode.contentsScale = UIScreenScale
|
||||
self.buttonViewResultsTextNode.displaysAsynchronously = true
|
||||
self.buttonViewResultsTextNode.displaysAsynchronously = false
|
||||
|
||||
self.buttonNode = HighlightableButtonNode()
|
||||
|
||||
|
@ -28,7 +28,7 @@ class ChatMessageReplyInfoNode: ASDisplayNode {
|
||||
override init() {
|
||||
self.contentNode = ASDisplayNode()
|
||||
self.contentNode.isUserInteractionEnabled = false
|
||||
self.contentNode.displaysAsynchronously = true
|
||||
self.contentNode.displaysAsynchronously = false
|
||||
self.contentNode.contentMode = .left
|
||||
self.contentNode.contentsScale = UIScreenScale
|
||||
|
||||
|
@ -22,7 +22,7 @@ class ChatMessageRestrictedBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
self.textNode.isUserInteractionEnabled = false
|
||||
self.textNode.contentMode = .topLeft
|
||||
self.textNode.contentsScale = UIScreenScale
|
||||
self.textNode.displaysAsynchronously = true
|
||||
self.textNode.displaysAsynchronously = false
|
||||
self.addSubnode(self.textNode)
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
self.textNode.isUserInteractionEnabled = false
|
||||
self.textNode.contentMode = .topLeft
|
||||
self.textNode.contentsScale = UIScreenScale
|
||||
self.textNode.displaysAsynchronously = true
|
||||
self.textNode.displaysAsynchronously = false
|
||||
self.addSubnode(self.textNode)
|
||||
self.addSubnode(self.textAccessibilityOverlayNode)
|
||||
|
||||
|
@ -317,7 +317,7 @@ final class ChatPinnedMessageTitlePanelNode: ChatTitleAccessoryPanelNode {
|
||||
} else {
|
||||
titleStrings.append(.text(0, NSAttributedString(string: "\(strings.Conversation_PinnedMessage) ", font: Font.medium(15.0), textColor: theme.chat.inputPanel.panelControlAccentColor)))
|
||||
}
|
||||
} else if pinnedMessage.totalCount > 1 || pinnedMessage.index == pinnedMessage.totalCount - 1 {
|
||||
} else if pinnedMessage.totalCount > 1 && pinnedMessage.index != pinnedMessage.totalCount - 1 {
|
||||
titleStrings.append(.text(0, NSAttributedString(string: "\(strings.Conversation_PinnedMessage)", font: Font.medium(15.0), textColor: theme.chat.inputPanel.panelControlAccentColor)))
|
||||
titleStrings.append(.text(1, NSAttributedString(string: " #", font: Font.medium(15.0), textColor: theme.chat.inputPanel.panelControlAccentColor)))
|
||||
titleStrings.append(.number(pinnedMessage.index + 1, NSAttributedString(string: "\(pinnedMessage.index + 1)", font: Font.medium(15.0), textColor: theme.chat.inputPanel.panelControlAccentColor)))
|
||||
|
@ -414,10 +414,22 @@ final class ChatReportPeerTitlePanelNode: ChatTitleAccessoryPanelNode {
|
||||
var nextButtonOrigin = maxInset + floor((areaWidth - updatedButtonsWidth) / 2.0)
|
||||
|
||||
let buttonWidth = floor(updatedButtonsWidth / CGFloat(self.buttons.count))
|
||||
for (_, view) in self.buttons {
|
||||
view.frame = CGRect(origin: CGPoint(x: nextButtonOrigin, y: 0.0), size: CGSize(width: buttonWidth, height: panelHeight))
|
||||
|
||||
var buttonFrames: [CGRect] = []
|
||||
for _ in 0 ..< self.buttons.count {
|
||||
buttonFrames.append(CGRect(origin: CGPoint(x: nextButtonOrigin, y: 0.0), size: CGSize(width: buttonWidth, height: panelHeight)))
|
||||
nextButtonOrigin += buttonWidth
|
||||
}
|
||||
|
||||
if buttonFrames[buttonFrames.count - 1].maxX >= width - 20.0 {
|
||||
for i in 0 ..< buttonFrames.count {
|
||||
buttonFrames[i].origin.x -= 16.0
|
||||
}
|
||||
}
|
||||
|
||||
for i in 0 ..< self.buttons.count {
|
||||
self.buttons[i].1.frame = buttonFrames[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -931,7 +931,7 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
|
||||
interaction.requestLayout()
|
||||
}))
|
||||
} else if let about = cachedData.about, !about.isEmpty {
|
||||
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: user.botInfo == nil ? presentationData.strings.Profile_About : presentationData.strings.Profile_BotInfo, text: about, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: []), action: nil, longTapAction: bioContextAction, linkItemAction: bioLinkAction, requestLayout: {
|
||||
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: user.botInfo == nil ? presentationData.strings.Profile_About : presentationData.strings.Profile_BotInfo, text: about, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: enabledBioEntities), action: nil, longTapAction: bioContextAction, linkItemAction: bioLinkAction, requestLayout: {
|
||||
interaction.requestLayout()
|
||||
}))
|
||||
}
|
||||
|
@ -108,7 +108,12 @@ final class PeerSelectionControllerNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
self.chatListNode.contentOffsetChanged = { [weak self] offset in
|
||||
self?.contentOffsetChanged?(offset)
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
if strongSelf.chatListNode.supernode != nil {
|
||||
strongSelf.contentOffsetChanged?(offset)
|
||||
}
|
||||
}
|
||||
|
||||
self.chatListNode.contentScrollingEnded = { [weak self] listView in
|
||||
@ -293,7 +298,7 @@ final class PeerSelectionControllerNode: ASDisplayNode {
|
||||
if self.chatListNode.supernode != nil {
|
||||
self.chatListNode.scrollToPosition(.top)
|
||||
} else if let contactListNode = self.contactListNode, contactListNode.supernode != nil {
|
||||
contactListNode.scrollToTop()
|
||||
//contactListNode.scrollToTop()
|
||||
}
|
||||
}
|
||||
|
||||
@ -331,7 +336,12 @@ final class PeerSelectionControllerNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
contactListNode.contentOffsetChanged = { [weak self] offset in
|
||||
self?.contentOffsetChanged?(offset)
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
if strongSelf.contactListNode?.supernode != nil {
|
||||
strongSelf.contentOffsetChanged?(offset)
|
||||
}
|
||||
}
|
||||
|
||||
contactListNode.contentScrollingEnded = { [weak self] listView in
|
||||
|
Loading…
x
Reference in New Issue
Block a user