mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-31 01:42:18 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
773ed45e7b
@ -30,6 +30,7 @@ struct ChatListNodeListViewTransition {
|
||||
let scrollToItem: ListViewScrollToItem?
|
||||
let stationaryItemRange: (Int, Int)?
|
||||
let adjustScrollToFirstItem: Bool
|
||||
let animateCrossfade: Bool
|
||||
}
|
||||
|
||||
final class ChatListHighlightedLocation {
|
||||
@ -349,7 +350,7 @@ private func mappedUpdateEntries(context: AccountContext, nodeInteraction: ChatL
|
||||
}
|
||||
|
||||
private func mappedChatListNodeViewListTransition(context: AccountContext, nodeInteraction: ChatListNodeInteraction, peerGroupId: PeerGroupId, isInFilter: Bool, mode: ChatListNodeMode, transition: ChatListNodeViewTransition) -> ChatListNodeListViewTransition {
|
||||
return ChatListNodeListViewTransition(chatListView: transition.chatListView, deleteItems: transition.deleteItems, insertItems: mappedInsertEntries(context: context, nodeInteraction: nodeInteraction, peerGroupId: peerGroupId, isInFilter: isInFilter, mode: mode, entries: transition.insertEntries), updateItems: mappedUpdateEntries(context: context, nodeInteraction: nodeInteraction, peerGroupId: peerGroupId, isInFilter: isInFilter, mode: mode, entries: transition.updateEntries), options: transition.options, scrollToItem: transition.scrollToItem, stationaryItemRange: transition.stationaryItemRange, adjustScrollToFirstItem: transition.adjustScrollToFirstItem)
|
||||
return ChatListNodeListViewTransition(chatListView: transition.chatListView, deleteItems: transition.deleteItems, insertItems: mappedInsertEntries(context: context, nodeInteraction: nodeInteraction, peerGroupId: peerGroupId, isInFilter: isInFilter, mode: mode, entries: transition.insertEntries), updateItems: mappedUpdateEntries(context: context, nodeInteraction: nodeInteraction, peerGroupId: peerGroupId, isInFilter: isInFilter, mode: mode, entries: transition.updateEntries), options: transition.options, scrollToItem: transition.scrollToItem, stationaryItemRange: transition.stationaryItemRange, adjustScrollToFirstItem: transition.adjustScrollToFirstItem, animateCrossfade: transition.animateCrossfade)
|
||||
}
|
||||
|
||||
private final class ChatListOpaqueTransactionState {
|
||||
@ -1428,7 +1429,7 @@ public final class ChatListNode: ListView {
|
||||
}
|
||||
|
||||
var isEmptyUpdate: ContainedViewLayoutTransition = .immediate
|
||||
if transition.options.contains(.AnimateInsertion) {
|
||||
if transition.options.contains(.AnimateInsertion) || transition.animateCrossfade {
|
||||
isEmptyUpdate = .animated(duration: 0.25, curve: .easeInOut)
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,7 @@ struct ChatListNodeViewTransition {
|
||||
let scrollToItem: ListViewScrollToItem?
|
||||
let stationaryItemRange: (Int, Int)?
|
||||
let adjustScrollToFirstItem: Bool
|
||||
let animateCrossfade: Bool
|
||||
}
|
||||
|
||||
enum ChatListNodeViewScrollPosition {
|
||||
@ -166,6 +167,7 @@ func preparedChatListNodeViewTransition(from fromView: ChatListNodeView?, to toV
|
||||
}
|
||||
|
||||
var fromEmptyView = false
|
||||
var animateCrossfade = false
|
||||
if let fromView = fromView {
|
||||
var wasSingleHeader = false
|
||||
if fromView.filteredEntries.count == 1, case .HeaderEntry = fromView.filteredEntries[0] {
|
||||
@ -176,7 +178,15 @@ func preparedChatListNodeViewTransition(from fromView: ChatListNodeView?, to toV
|
||||
isSingleHeader = true
|
||||
}
|
||||
if (wasSingleHeader || isSingleHeader), case .interactiveChanges = reason {
|
||||
let _ = options.insert(.AnimateInsertion)
|
||||
if wasSingleHeader != isSingleHeader {
|
||||
if wasSingleHeader {
|
||||
animateCrossfade = true
|
||||
options.remove(.AnimateInsertion)
|
||||
options.remove(.AnimateAlpha)
|
||||
} else {
|
||||
let _ = options.insert(.AnimateInsertion)
|
||||
}
|
||||
}
|
||||
} else if fromView.filteredEntries.isEmpty || fromView.filter != toView.filter {
|
||||
options.remove(.AnimateInsertion)
|
||||
options.remove(.AnimateAlpha)
|
||||
@ -191,7 +201,7 @@ func preparedChatListNodeViewTransition(from fromView: ChatListNodeView?, to toV
|
||||
adjustScrollToFirstItem = true
|
||||
}
|
||||
|
||||
subscriber.putNext(ChatListNodeViewTransition(chatListView: toView, deleteItems: adjustedDeleteIndices, insertEntries: adjustedIndicesAndItems, updateEntries: adjustedUpdateItems, options: options, scrollToItem: scrollToItem, stationaryItemRange: nil, adjustScrollToFirstItem: adjustScrollToFirstItem))
|
||||
subscriber.putNext(ChatListNodeViewTransition(chatListView: toView, deleteItems: adjustedDeleteIndices, insertEntries: adjustedIndicesAndItems, updateEntries: adjustedUpdateItems, options: options, scrollToItem: scrollToItem, stationaryItemRange: nil, adjustScrollToFirstItem: adjustScrollToFirstItem, animateCrossfade: animateCrossfade))
|
||||
subscriber.putCompletion()
|
||||
|
||||
return EmptyDisposable
|
||||
|
@ -894,7 +894,13 @@ private func synchronizeChatListFilters(transaction: Transaction, postbox: Postb
|
||||
|
||||
var addSignals: Signal<Never, NoError> = .complete()
|
||||
for filter in mergedFilters {
|
||||
if !remoteFilters.contains(where: { $0.id == filter.id }) {
|
||||
let updated: Bool
|
||||
if let index = remoteFilters.firstIndex(where: { $0.id == filter.id }) {
|
||||
updated = remoteFilters[index] != filter
|
||||
} else {
|
||||
updated = true
|
||||
}
|
||||
if updated {
|
||||
addSignals = addSignals
|
||||
|> then(
|
||||
requestUpdateChatListFilter(postbox: postbox, network: network, id: filter.id, filter: filter)
|
||||
@ -906,7 +912,6 @@ private func synchronizeChatListFilters(transaction: Transaction, postbox: Postb
|
||||
}
|
||||
}
|
||||
|
||||
let localFilterIds = localFilters.map { $0.id }
|
||||
let reorderFilters: Signal<Never, NoError>
|
||||
if mergedFilterIds != remoteFilterIds {
|
||||
reorderFilters = network.request(Api.functions.messages.updateDialogFiltersOrder(order: mergedFilters.map { $0.id }))
|
||||
|
@ -253,8 +253,11 @@ final class ContactMultiselectionControllerNode: ASDisplayNode {
|
||||
case let .contacts(contactsNode):
|
||||
contactsNode.containerLayoutUpdated(ContainerViewLayout(size: layout.size, metrics: layout.metrics, deviceMetrics: layout.deviceMetrics, intrinsicInsets: insets, safeInsets: layout.safeInsets, statusBarHeight: layout.statusBarHeight, inputHeight: layout.inputHeight, inputHeightIsInteractivellyChanging: layout.inputHeightIsInteractivellyChanging, inVoiceOver: layout.inVoiceOver), headerInsets: headerInsets, transition: transition)
|
||||
case let .chats(chatsNode):
|
||||
var combinedInsets = insets
|
||||
combinedInsets.left += layout.safeInsets.left
|
||||
combinedInsets.right += layout.safeInsets.right
|
||||
let (duration, curve) = listViewAnimationDurationAndCurve(transition: transition)
|
||||
let updateSizeAndInsets = ListViewUpdateSizeAndInsets(size: layout.size, insets: insets, headerInsets: headerInsets, duration: duration, curve: curve)
|
||||
let updateSizeAndInsets = ListViewUpdateSizeAndInsets(size: layout.size, insets: combinedInsets, headerInsets: headerInsets, duration: duration, curve: curve)
|
||||
chatsNode.updateLayout(transition: transition, updateSizeAndInsets: updateSizeAndInsets)
|
||||
}
|
||||
self.contentNode.node.frame = CGRect(origin: CGPoint(), size: layout.size)
|
||||
|
Loading…
x
Reference in New Issue
Block a user