From aa9d43c9dc304f8b6edb13f3925d666c8ae5092e Mon Sep 17 00:00:00 2001 From: Peter <> Date: Fri, 12 Apr 2019 10:07:39 +0100 Subject: [PATCH] Support for updated Postbox API --- TelegramUI/ChatController.swift | 2 +- TelegramUI/ChatHistoryGridNode.swift | 2 +- TelegramUI/ChatHistoryListNode.swift | 2 +- TelegramUI/ChatListNode.swift | 2 +- TelegramUI/GalleryController.swift | 2 +- TelegramUI/PeerMessagesMediaPlaylist.swift | 10 +++++----- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/TelegramUI/ChatController.swift b/TelegramUI/ChatController.swift index 0683b1fa14..c741947736 100644 --- a/TelegramUI/ChatController.swift +++ b/TelegramUI/ChatController.swift @@ -6070,7 +6070,7 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, { $0.updatedInterfaceState { $0.withoutSelectionState() } }) if actions.contains(3) { let _ = strongSelf.context.account.postbox.transaction({ transaction -> Void in - transaction.removeAllMessagesWithAuthor(peerId, authorId: author.id) + transaction.removeAllMessagesWithAuthor(peerId, authorId: author.id, namespace: Namespaces.Message.Cloud) }).start() let _ = clearAuthorHistory(account: strongSelf.context.account, peerId: peerId, memberId: author.id).start() } else if actions.contains(0) { diff --git a/TelegramUI/ChatHistoryGridNode.swift b/TelegramUI/ChatHistoryGridNode.swift index 2e67006159..52c3c70de1 100644 --- a/TelegramUI/ChatHistoryGridNode.swift +++ b/TelegramUI/ChatHistoryGridNode.swift @@ -289,7 +289,7 @@ public final class ChatHistoryGridNode: GridNode, ChatHistoryNode { prepareOnMainQueue = !fadeIn case let .Generic(genericType): switch genericType { - case .InitialUnread: + case .InitialUnread, .Initial: reason = ChatHistoryViewTransitionReason.Initial(fadeIn: false) case .Generic: reason = ChatHistoryViewTransitionReason.InteractiveChanges diff --git a/TelegramUI/ChatHistoryListNode.swift b/TelegramUI/ChatHistoryListNode.swift index b7f0c16fa6..dbb1bf737e 100644 --- a/TelegramUI/ChatHistoryListNode.swift +++ b/TelegramUI/ChatHistoryListNode.swift @@ -587,7 +587,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode { prepareOnMainQueue = !fadeIn case let .Generic(genericType): switch genericType { - case .InitialUnread: + case .InitialUnread, .Initial: reason = ChatHistoryViewTransitionReason.Initial(fadeIn: false) case .Generic: reason = ChatHistoryViewTransitionReason.InteractiveChanges diff --git a/TelegramUI/ChatListNode.swift b/TelegramUI/ChatListNode.swift index 79e8f4b06f..5d4cc7bbc4 100644 --- a/TelegramUI/ChatListNode.swift +++ b/TelegramUI/ChatListNode.swift @@ -561,7 +561,7 @@ final class ChatListNode: ListView { updatedScrollPosition = nil } else { switch update.type { - case .InitialUnread: + case .InitialUnread, .Initial: reason = .initial prepareOnMainQueue = true case .Generic: diff --git a/TelegramUI/GalleryController.swift b/TelegramUI/GalleryController.swift index c6f0efd31a..dfa59c18db 100644 --- a/TelegramUI/GalleryController.swift +++ b/TelegramUI/GalleryController.swift @@ -376,7 +376,7 @@ class GalleryController: ViewController { switch source { case .peerMessagesAtId: if let tags = tagsForMessage(message!) { - let view = context.account.postbox.aroundMessageHistoryViewForLocation(.peer(message!.id.peerId), index: .message(message!.index), anchorIndex: .message(message!.index), count: 50, clipHoles: false, fixedCombinedReadStates: nil, topTaggedMessageIdNamespaces: [], tagMask: tags, orderStatistics: [.combinedLocation]) + let view = context.account.postbox.aroundMessageHistoryViewForLocation(.peer(message!.id.peerId), anchor: .index(message!.index), count: 50, fixedCombinedReadStates: nil, topTaggedMessageIdNamespaces: [], tagMask: tags, orderStatistics: [.combinedLocation]) return view |> mapToSignal { (view, _, _) -> Signal in diff --git a/TelegramUI/PeerMessagesMediaPlaylist.swift b/TelegramUI/PeerMessagesMediaPlaylist.swift index 579475dac9..625f78434b 100644 --- a/TelegramUI/PeerMessagesMediaPlaylist.swift +++ b/TelegramUI/PeerMessagesMediaPlaylist.swift @@ -496,7 +496,7 @@ final class PeerMessagesMediaPlaylist: SharedMediaPlaylist { guard let message = message else { return .single(nil) } - return self.postbox.aroundMessageHistoryViewForLocation(.peer(peerId), index: .message(message.index), anchorIndex: .message(message.index), count: 10, clipHoles: false, fixedCombinedReadStates: nil, topTaggedMessageIdNamespaces: [], tagMask: tagMask, orderStatistics: []) + return self.postbox.aroundMessageHistoryViewForLocation(.peer(peerId), anchor: .index(message.index), count: 10, fixedCombinedReadStates: nil, topTaggedMessageIdNamespaces: [], tagMask: tagMask, orderStatistics: []) |> mapToSignal { view -> Signal<(Message, [Message])?, NoError> in if let (message, aroundMessages, _) = navigatedMessageFromView(view.0, anchorIndex: message.index, position: .exact) { return .single((message, aroundMessages)) @@ -565,12 +565,12 @@ final class PeerMessagesMediaPlaylist: SharedMediaPlaylist { } } } - return transaction.findRandomMessage(peerId: peerId, tagMask: tagMask, ignoreIds: (playbackStack.ids, playbackStack.set)) ?? index + return transaction.findRandomMessage(peerId: peerId, namespace: Namespaces.Message.Cloud, tag: tagMask, ignoreIds: (playbackStack.ids, playbackStack.set)) ?? index } } let historySignal = inputIndex |> mapToSignal { inputIndex -> Signal<(Message, [Message])?, NoError> in - return self.postbox.aroundMessageHistoryViewForLocation(.peer(peerId), index: .message(inputIndex), anchorIndex: .message(inputIndex), count: 10, clipHoles: false, fixedCombinedReadStates: nil, topTaggedMessageIdNamespaces: [], tagMask: tagMask, orderStatistics: []) + return self.postbox.aroundMessageHistoryViewForLocation(.peer(peerId), anchor: .index(inputIndex), count: 10, fixedCombinedReadStates: nil, topTaggedMessageIdNamespaces: [], tagMask: tagMask, orderStatistics: []) |> mapToSignal { view -> Signal<(Message, [Message])?, NoError> in let position: NavigatedMessageFromViewPosition switch navigation { @@ -594,13 +594,13 @@ final class PeerMessagesMediaPlaylist: SharedMediaPlaylist { } if case .all = looping { - let viewIndex: MessageHistoryAnchorIndex + let viewIndex: HistoryViewInputAnchor if case .earlier = navigation { viewIndex = .upperBound } else { viewIndex = .lowerBound } - return self.postbox.aroundMessageHistoryViewForLocation(.peer(peerId), index: viewIndex, anchorIndex: viewIndex, count: 10, clipHoles: false, fixedCombinedReadStates: nil, topTaggedMessageIdNamespaces: [], tagMask: tagMask, orderStatistics: []) + return self.postbox.aroundMessageHistoryViewForLocation(.peer(peerId), anchor: viewIndex, count: 10, fixedCombinedReadStates: nil, topTaggedMessageIdNamespaces: [], tagMask: tagMask, orderStatistics: []) |> mapToSignal { view -> Signal<(Message, [Message])?, NoError> in let position: NavigatedMessageFromViewPosition switch navigation {