mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
c94ef88deb
commit
f38d77a985
@ -818,12 +818,12 @@ private func channelVisibilityControllerEntries(presentationData: PresentationDa
|
||||
}
|
||||
}
|
||||
|
||||
if isGroup && selectedType == .publicChannel {
|
||||
var isDiscussion = false
|
||||
if let cachedData = view.cachedData as? CachedChannelData, case .known = cachedData.linkedDiscussionPeerId {
|
||||
isDiscussion = true
|
||||
}
|
||||
var isDiscussion = false
|
||||
if let cachedData = view.cachedData as? CachedChannelData, case .known = cachedData.linkedDiscussionPeerId {
|
||||
isDiscussion = true
|
||||
}
|
||||
|
||||
if isGroup && (selectedType == .publicChannel || isDiscussion) {
|
||||
if isDiscussion {
|
||||
entries.append(.joinToSendHeader(presentationData.theme, presentationData.strings.Group_Setup_WhoCanSendMessages_Title.uppercased()))
|
||||
entries.append(.joinToSendEveryone(presentationData.theme, presentationData.strings.Group_Setup_WhoCanSendMessages_Everyone, joinToSend == .everyone))
|
||||
|
@ -75,7 +75,6 @@ func chatHistoryEntriesForView(
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
var groupBucket: [(Message, Bool, ChatHistoryMessageSelection, ChatMessageEntryAttributes, MessageHistoryEntryLocation?)] = []
|
||||
var count = 0
|
||||
loop: for entry in view.entries {
|
||||
|
@ -49,7 +49,7 @@ public enum ChatHistoryListMode: Equatable {
|
||||
enum ChatHistoryViewScrollPosition {
|
||||
case unread(index: MessageIndex)
|
||||
case positionRestoration(index: MessageIndex, relativeOffset: CGFloat)
|
||||
case index(index: MessageHistoryAnchorIndex, position: ListViewScrollPosition, directionHint: ListViewScrollToItemDirectionHint, animated: Bool, highlight: Bool)
|
||||
case index(index: MessageHistoryAnchorIndex, position: ListViewScrollPosition, directionHint: ListViewScrollToItemDirectionHint, animated: Bool, highlight: Bool, displayLink: Bool)
|
||||
}
|
||||
|
||||
enum ChatHistoryViewUpdateType {
|
||||
@ -800,7 +800,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
||||
|
||||
let scrollPosition: ChatHistoryViewScrollPosition?
|
||||
if isFirstTime, let messageIndex = messages.first(where: { $0.id == at })?.index {
|
||||
scrollPosition = .index(index: .message(messageIndex), position: .center(.bottom), directionHint: .Down, animated: false, highlight: false)
|
||||
scrollPosition = .index(index: .message(messageIndex), position: .center(.bottom), directionHint: .Down, animated: false, highlight: false, displayLink: false)
|
||||
isFirstTime = false
|
||||
} else {
|
||||
scrollPosition = nil
|
||||
@ -1183,10 +1183,10 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
||||
|
||||
if scrollPosition == nil, let originalScrollPosition = originalScrollPosition {
|
||||
switch originalScrollPosition {
|
||||
case let .index(index, position, _, _, highlight):
|
||||
case let .index(index, position, _, _, highlight, displayLink):
|
||||
if case .upperBound = index {
|
||||
if let previous = previous, previous.filteredEntries.isEmpty {
|
||||
updatedScrollPosition = .index(index: index, position: position, directionHint: .Down, animated: false, highlight: highlight)
|
||||
updatedScrollPosition = .index(index: index, position: position, directionHint: .Down, animated: false, highlight: highlight, displayLink: displayLink)
|
||||
}
|
||||
}
|
||||
default:
|
||||
@ -1226,7 +1226,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
||||
if isFirstTime {
|
||||
} else if case let .peer(peerId) = chatLocation, currentlyPlayingMessageId.id.peerId != peerId {
|
||||
} else {
|
||||
updatedScrollPosition = .index(index: .message(currentlyPlayingMessageId), position: .center(.bottom), directionHint: .Up, animated: true, highlight: true)
|
||||
updatedScrollPosition = .index(index: .message(currentlyPlayingMessageId), position: .center(.bottom), directionHint: .Up, animated: true, highlight: true, displayLink: true)
|
||||
scrollAnimationCurve = .Spring(duration: 0.4)
|
||||
}
|
||||
}
|
||||
@ -1270,7 +1270,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
||||
}
|
||||
|
||||
if fillsScreen, let firstNonAdIndex = firstNonAdIndex, previousNumAds == 0, updatedNumAds != 0 {
|
||||
updatedScrollPosition = .index(index: .message(firstNonAdIndex), position: .top(0.0), directionHint: .Up, animated: false, highlight: false)
|
||||
updatedScrollPosition = .index(index: .message(firstNonAdIndex), position: .top(0.0), directionHint: .Up, animated: false, highlight: false, displayLink: false)
|
||||
disableAnimations = true
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ func chatHistoryViewForLocation(_ location: ChatHistoryLocationInput, ignoreMess
|
||||
var chatScrollPosition: ChatHistoryViewScrollPosition?
|
||||
if case let .Scroll(index, _, sourceIndex, position, animated, highlight) = location.content {
|
||||
let directionHint: ListViewScrollToItemDirectionHint = sourceIndex > index ? .Down : .Up
|
||||
chatScrollPosition = .index(index: index, position: position, directionHint: directionHint, animated: animated, highlight: highlight)
|
||||
chatScrollPosition = .index(index: index, position: position, directionHint: directionHint, animated: animated, highlight: highlight, displayLink: false)
|
||||
}
|
||||
return account.viewTracker.scheduledMessagesViewForLocation(context.chatLocationInput(for: chatLocation, contextHolder: chatLocationContextHolder), additionalData: additionalData)
|
||||
|> map { view, updateType, initialData -> ChatHistoryViewUpdate in
|
||||
@ -220,7 +220,7 @@ func chatHistoryViewForLocation(_ location: ChatHistoryLocationInput, ignoreMess
|
||||
}
|
||||
|
||||
preloaded = true
|
||||
return .HistoryView(view: view, type: reportUpdateType, scrollPosition: .index(index: anchorIndex, position: .center(.bottom), directionHint: .Down, animated: false, highlight: highlight), flashIndicators: false, originalScrollPosition: nil, initialData: ChatHistoryCombinedInitialData(initialData: initialData, buttonKeyboardMessage: view.topTaggedMessages.first, cachedData: cachedData, cachedDataMessages: cachedDataMessages, readStateData: readStateData), id: location.id)
|
||||
return .HistoryView(view: view, type: reportUpdateType, scrollPosition: .index(index: anchorIndex, position: .center(.bottom), directionHint: .Down, animated: false, highlight: highlight, displayLink: false), flashIndicators: false, originalScrollPosition: nil, initialData: ChatHistoryCombinedInitialData(initialData: initialData, buttonKeyboardMessage: view.topTaggedMessages.first, cachedData: cachedData, cachedDataMessages: cachedDataMessages, readStateData: readStateData), id: location.id)
|
||||
}
|
||||
}
|
||||
case let .Navigation(index, anchorIndex, count, _):
|
||||
@ -239,7 +239,7 @@ func chatHistoryViewForLocation(_ location: ChatHistoryLocationInput, ignoreMess
|
||||
}
|
||||
case let .Scroll(index, anchorIndex, sourceIndex, scrollPosition, animated, highlight):
|
||||
let directionHint: ListViewScrollToItemDirectionHint = sourceIndex > index ? .Down : .Up
|
||||
let chatScrollPosition = ChatHistoryViewScrollPosition.index(index: index, position: scrollPosition, directionHint: directionHint, animated: animated, highlight: highlight)
|
||||
let chatScrollPosition = ChatHistoryViewScrollPosition.index(index: index, position: scrollPosition, directionHint: directionHint, animated: animated, highlight: highlight, displayLink: false)
|
||||
var first = true
|
||||
return account.viewTracker.aroundMessageHistoryViewForLocation(context.chatLocationInput(for: chatLocation, contextHolder: chatLocationContextHolder), ignoreMessagesInTimestampRange: ignoreMessagesInTimestampRange, index: index, anchorIndex: anchorIndex, count: 128, ignoreRelatedChats: ignoreRelatedChats, fixedCombinedReadStates: fixedCombinedReadStates, tagMask: tagMask, appendMessagesFromTheSameGroup: appendMessagesFromTheSameGroup, orderStatistics: orderStatistics, additionalData: additionalData)
|
||||
|> map { view, updateType, initialData -> ChatHistoryViewUpdate in
|
||||
|
@ -34,7 +34,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView, UIGestureRecognizerD
|
||||
private var appliedItem: ChatMessageItem?
|
||||
private var appliedForwardInfo: (Peer?, String?)?
|
||||
private var appliedHasAvatar = false
|
||||
private var appliedCurrentlyPlaying = false
|
||||
private var appliedCurrentlyPlaying: Bool?
|
||||
private var appliedAutomaticDownload = false
|
||||
private var avatarOffset: CGFloat?
|
||||
|
||||
@ -97,7 +97,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView, UIGestureRecognizerD
|
||||
if !strongSelf.interactiveVideoNode.frame.contains(location) {
|
||||
return false
|
||||
}
|
||||
if strongSelf.appliedCurrentlyPlaying && !strongSelf.interactiveVideoNode.isPlaying {
|
||||
if (strongSelf.appliedCurrentlyPlaying ?? false) && !strongSelf.interactiveVideoNode.isPlaying {
|
||||
return strongSelf.interactiveVideoNode.frame.insetBy(dx: 0.15 * strongSelf.interactiveVideoNode.frame.width, dy: 0.15 * strongSelf.interactiveVideoNode.frame.height).contains(location)
|
||||
}
|
||||
if let action = strongSelf.gestureRecognized(gesture: .tap, location: location, recognizer: nil) {
|
||||
@ -127,7 +127,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView, UIGestureRecognizerD
|
||||
case let .openContextMenu(tapMessage, selectAll, subFrame):
|
||||
strongSelf.recognizer?.cancel()
|
||||
item.controllerInteraction.openMessageContextMenu(tapMessage, selectAll, strongSelf, subFrame, gesture)
|
||||
if strongSelf.appliedCurrentlyPlaying && strongSelf.interactiveVideoNode.isPlaying {
|
||||
if (strongSelf.appliedCurrentlyPlaying ?? false) && strongSelf.interactiveVideoNode.isPlaying {
|
||||
strongSelf.wasPlaying = true
|
||||
strongSelf.interactiveVideoNode.pause()
|
||||
}
|
||||
@ -199,7 +199,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView, UIGestureRecognizerD
|
||||
if strongSelf.selectionNode != nil {
|
||||
return false
|
||||
}
|
||||
if strongSelf.appliedCurrentlyPlaying && !strongSelf.interactiveVideoNode.isPlaying {
|
||||
if (strongSelf.appliedCurrentlyPlaying ?? false) && !strongSelf.interactiveVideoNode.isPlaying {
|
||||
return false
|
||||
}
|
||||
let action = item.controllerInteraction.canSetupReply(item.message)
|
||||
@ -1098,7 +1098,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView, UIGestureRecognizerD
|
||||
selected = selectionState.selectedIds.contains(item.message.id)
|
||||
incoming = item.message.effectivelyIncoming(item.context.account.peerId)
|
||||
|
||||
let offset: CGFloat = incoming || self.appliedCurrentlyPlaying ? 42.0 : 0.0
|
||||
let offset: CGFloat = incoming || (self.appliedCurrentlyPlaying ?? false) ? 42.0 : 0.0
|
||||
|
||||
if let selectionNode = self.selectionNode {
|
||||
let selectionFrame = CGRect(origin: CGPoint(x: -offset, y: 0.0), size: CGSize(width: self.contentBounds.size.width, height: self.contentBounds.size.height))
|
||||
|
@ -885,15 +885,19 @@ public class ChatMessageItemView: ListViewItemNode, ChatMessageItemNodeProtocol
|
||||
private var attachedAvatarNodeOffset: CGFloat = 0.0
|
||||
|
||||
override public func attachedHeaderNodesUpdated() {
|
||||
self.updateAttachedAvatarNodeOffset(offset: self.attachedAvatarNodeOffset, transition: .immediate)
|
||||
for headerNode in self.attachedHeaderNodes {
|
||||
if let headerNode = headerNode as? ChatMessageAvatarHeaderNode {
|
||||
headerNode.updateSelectionState(animated: false)
|
||||
if !self.attachedAvatarNodeOffset.isZero {
|
||||
self.updateAttachedAvatarNodeOffset(offset: self.attachedAvatarNodeOffset, transition: .immediate)
|
||||
} else {
|
||||
for headerNode in self.attachedHeaderNodes {
|
||||
if let headerNode = headerNode as? ChatMessageAvatarHeaderNode {
|
||||
headerNode.updateSelectionState(animated: false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func updateAttachedAvatarNodeOffset(offset: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||
self.attachedAvatarNodeOffset = offset
|
||||
for headerNode in self.attachedHeaderNodes {
|
||||
if let headerNode = headerNode as? ChatMessageAvatarHeaderNode {
|
||||
transition.updateSublayerTransformOffset(layer: headerNode.layer, offset: CGPoint(x: offset, y: 0.0))
|
||||
|
@ -191,14 +191,14 @@ func preparedChatHistoryViewTransition(from fromView: ChatHistoryView?, to toVie
|
||||
index += 1
|
||||
}
|
||||
}
|
||||
case let .index(scrollIndex, position, directionHint, animated, highlight):
|
||||
case let .index(scrollIndex, position, directionHint, animated, highlight, displayLink):
|
||||
if case .center = position, highlight {
|
||||
scrolledToIndex = scrollIndex
|
||||
}
|
||||
var index = toView.filteredEntries.count - 1
|
||||
for entry in toView.filteredEntries {
|
||||
if scrollIndex.isLessOrEqual(to: entry.index) {
|
||||
scrollToItem = ListViewScrollToItem(index: index, position: position, animated: animated, curve: curve, directionHint: directionHint)
|
||||
scrollToItem = ListViewScrollToItem(index: index, position: position, animated: animated, curve: curve, directionHint: directionHint, displayLink: displayLink)
|
||||
break
|
||||
}
|
||||
index -= 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user