mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-27 10:32:37 +00:00
Various improvements
This commit is contained in:
parent
7c0d5519bf
commit
1d7bf5aa12
@ -913,6 +913,7 @@ public protocol ChatController: ViewController {
|
|||||||
func activateSearch(domain: ChatSearchDomain, query: String)
|
func activateSearch(domain: ChatSearchDomain, query: String)
|
||||||
func beginClearHistory(type: InteractiveHistoryClearingType)
|
func beginClearHistory(type: InteractiveHistoryClearingType)
|
||||||
|
|
||||||
|
func performScrollToTop() -> Bool
|
||||||
func transferScrollingVelocity(_ velocity: CGFloat)
|
func transferScrollingVelocity(_ velocity: CGFloat)
|
||||||
func updateIsScrollingLockedAtTop(isScrollingLockedAtTop: Bool)
|
func updateIsScrollingLockedAtTop(isScrollingLockedAtTop: Bool)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1860,6 +1860,23 @@ public final class AccountViewTracker {
|
|||||||
return transaction.getMessageHistoryThreadInfo(peerId: peerId, threadId: threadId)?.data.get(MessageHistoryThreadData.self)
|
return transaction.getMessageHistoryThreadInfo(peerId: peerId, threadId: threadId)?.data.get(MessageHistoryThreadData.self)
|
||||||
}
|
}
|
||||||
|> mapToSignal { threadInfo -> Signal<(MessageHistoryView, ViewUpdateType, InitialMessageHistoryData?), NoError> in
|
|> mapToSignal { threadInfo -> Signal<(MessageHistoryView, ViewUpdateType, InitialMessageHistoryData?), NoError> in
|
||||||
|
if peerId == account.peerId {
|
||||||
|
return account.postbox.aroundMessageHistoryViewForLocation(
|
||||||
|
chatLocation,
|
||||||
|
anchor: .upperBound,
|
||||||
|
ignoreMessagesInTimestampRange: ignoreMessagesInTimestampRange,
|
||||||
|
count: count,
|
||||||
|
fixedCombinedReadStates: .peer([peerId: CombinedPeerReadState(states: [
|
||||||
|
(Namespaces.Message.Cloud, PeerReadState.idBased(maxIncomingReadId: Int32.max - 1, maxOutgoingReadId: Int32.max - 1, maxKnownId: Int32.max - 1, count: 0, markedUnread: false))
|
||||||
|
])]),
|
||||||
|
topTaggedMessageIdNamespaces: [],
|
||||||
|
tagMask: tagMask,
|
||||||
|
appendMessagesFromTheSameGroup: false,
|
||||||
|
namespaces: .not(Namespaces.Message.allScheduled),
|
||||||
|
orderStatistics: orderStatistics,
|
||||||
|
additionalData: wrappedHistoryViewAdditionalData(chatLocation: chatLocation, additionalData: additionalData)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
if let threadInfo = threadInfo {
|
if let threadInfo = threadInfo {
|
||||||
let anchor: HistoryViewInputAnchor
|
let anchor: HistoryViewInputAnchor
|
||||||
if threadInfo.maxIncomingReadId <= 1 {
|
if threadInfo.maxIncomingReadId <= 1 {
|
||||||
@ -1885,6 +1902,7 @@ public final class AccountViewTracker {
|
|||||||
additionalData: wrappedHistoryViewAdditionalData(chatLocation: chatLocation, additionalData: additionalData)
|
additionalData: wrappedHistoryViewAdditionalData(chatLocation: chatLocation, additionalData: additionalData)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return account.postbox.aroundMessageOfInterestHistoryViewForChatLocation(chatLocation, ignoreMessagesInTimestampRange: ignoreMessagesInTimestampRange, count: count, topTaggedMessageIdNamespaces: [Namespaces.Message.Cloud], tagMask: tagMask, appendMessagesFromTheSameGroup: appendMessagesFromTheSameGroup, namespaces: .not(Namespaces.Message.allScheduled), orderStatistics: orderStatistics, customUnreadMessageId: nil, additionalData: wrappedHistoryViewAdditionalData(chatLocation: chatLocation, additionalData: additionalData))
|
return account.postbox.aroundMessageOfInterestHistoryViewForChatLocation(chatLocation, ignoreMessagesInTimestampRange: ignoreMessagesInTimestampRange, count: count, topTaggedMessageIdNamespaces: [Namespaces.Message.Cloud], tagMask: tagMask, appendMessagesFromTheSameGroup: appendMessagesFromTheSameGroup, namespaces: .not(Namespaces.Message.allScheduled), orderStatistics: orderStatistics, customUnreadMessageId: nil, additionalData: wrappedHistoryViewAdditionalData(chatLocation: chatLocation, additionalData: additionalData))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -183,7 +183,17 @@ public final class ChatMessageAttachedContentNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let messageTheme = incoming ? presentationData.theme.theme.chat.message.incoming : presentationData.theme.theme.chat.message.outgoing
|
let messageTheme = incoming ? presentationData.theme.theme.chat.message.incoming : presentationData.theme.theme.chat.message.outgoing
|
||||||
let author = message.author
|
|
||||||
|
var author = message.effectiveAuthor
|
||||||
|
|
||||||
|
if let forwardInfo = message.forwardInfo {
|
||||||
|
if let peer = forwardInfo.author {
|
||||||
|
author = peer
|
||||||
|
} else if let authorSignature = forwardInfo.authorSignature {
|
||||||
|
author = TelegramUser(id: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt64Value(Int64(authorSignature.persistentHashValue % 32))), accessHash: nil, firstName: authorSignature, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let nameColors = author?.nameColor.flatMap { context.peerNameColors.get($0, dark: presentationData.theme.theme.overallDarkAppearance) }
|
let nameColors = author?.nameColor.flatMap { context.peerNameColors.get($0, dark: presentationData.theme.theme.overallDarkAppearance) }
|
||||||
|
|
||||||
let mainColor: UIColor
|
let mainColor: UIColor
|
||||||
|
|||||||
@ -203,7 +203,15 @@ public class ChatMessageReplyInfoNode: ASDisplayNode {
|
|||||||
var dashSecondaryColor: UIColor?
|
var dashSecondaryColor: UIColor?
|
||||||
var dashTertiaryColor: UIColor?
|
var dashTertiaryColor: UIColor?
|
||||||
|
|
||||||
let author = arguments.message?.effectiveAuthor
|
var author = arguments.message?.effectiveAuthor
|
||||||
|
|
||||||
|
if let forwardInfo = arguments.message?.forwardInfo {
|
||||||
|
if let peer = forwardInfo.author {
|
||||||
|
author = peer
|
||||||
|
} else if let authorSignature = forwardInfo.authorSignature {
|
||||||
|
author = TelegramUser(id: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt64Value(Int64(authorSignature.persistentHashValue % 32))), accessHash: nil, firstName: authorSignature, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: [], emojiStatus: nil, usernames: [], storiesHidden: nil, nameColor: nil, backgroundEmojiId: nil, profileColor: nil, profileBackgroundEmojiId: nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let colors = author?.nameColor.flatMap { arguments.context.peerNameColors.get($0, dark: arguments.presentationData.theme.theme.overallDarkAppearance) }
|
let colors = author?.nameColor.flatMap { arguments.context.peerNameColors.get($0, dark: arguments.presentationData.theme.theme.overallDarkAppearance) }
|
||||||
authorNameColor = colors?.main
|
authorNameColor = colors?.main
|
||||||
|
|||||||
@ -87,7 +87,7 @@ public final class PeerInfoChatPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScro
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func scrollToTop() -> Bool {
|
public func scrollToTop() -> Bool {
|
||||||
return false
|
return self.chatController.performScrollToTop()
|
||||||
}
|
}
|
||||||
|
|
||||||
public func hitTestResultForScrolling() -> UIView? {
|
public func hitTestResultForScrolling() -> UIView? {
|
||||||
|
|||||||
@ -393,7 +393,7 @@ extension ChatControllerImpl {
|
|||||||
quote = params.quote.flatMap { quote in ChatControllerSubject.MessageHighlight.Quote(string: quote.string, offset: quote.offset) }
|
quote = params.quote.flatMap { quote in ChatControllerSubject.MessageHighlight.Quote(string: quote.string, offset: quote.offset) }
|
||||||
}
|
}
|
||||||
|
|
||||||
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(peer), subject: messageLocation.messageId.flatMap { .message(id: .id($0), highlight: ChatControllerSubject.MessageHighlight(quote: quote), timecode: nil) }))
|
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(peer), subject: messageLocation.messageId.flatMap { .message(id: .id($0), highlight: ChatControllerSubject.MessageHighlight(quote: quote), timecode: nil) }, keepStack: .always))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
completion?()
|
completion?()
|
||||||
|
|||||||
@ -18986,6 +18986,17 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
public func transferScrollingVelocity(_ velocity: CGFloat) {
|
public func transferScrollingVelocity(_ velocity: CGFloat) {
|
||||||
self.chatDisplayNode.historyNode.transferVelocity(velocity)
|
self.chatDisplayNode.historyNode.transferVelocity(velocity)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func performScrollToTop() -> Bool {
|
||||||
|
let offset = self.chatDisplayNode.historyNode.visibleContentOffset()
|
||||||
|
switch offset {
|
||||||
|
case let .known(value) where value <= CGFloat.ulpOfOne:
|
||||||
|
return false
|
||||||
|
default:
|
||||||
|
self.chatDisplayNode.historyNode.scrollToEndOfHistory()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final class ChatContextControllerContentSourceImpl: ContextControllerContentSource {
|
final class ChatContextControllerContentSourceImpl: ContextControllerContentSource {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user