Support for updated Postbox API

This commit is contained in:
Peter 2019-04-12 10:07:39 +01:00
parent 94705dd746
commit aa9d43c9dc
6 changed files with 10 additions and 10 deletions

View File

@ -6070,7 +6070,7 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, { $0.updatedInterfaceState { $0.withoutSelectionState() } }) strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, { $0.updatedInterfaceState { $0.withoutSelectionState() } })
if actions.contains(3) { if actions.contains(3) {
let _ = strongSelf.context.account.postbox.transaction({ transaction -> Void in 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() }).start()
let _ = clearAuthorHistory(account: strongSelf.context.account, peerId: peerId, memberId: author.id).start() let _ = clearAuthorHistory(account: strongSelf.context.account, peerId: peerId, memberId: author.id).start()
} else if actions.contains(0) { } else if actions.contains(0) {

View File

@ -289,7 +289,7 @@ public final class ChatHistoryGridNode: GridNode, ChatHistoryNode {
prepareOnMainQueue = !fadeIn prepareOnMainQueue = !fadeIn
case let .Generic(genericType): case let .Generic(genericType):
switch genericType { switch genericType {
case .InitialUnread: case .InitialUnread, .Initial:
reason = ChatHistoryViewTransitionReason.Initial(fadeIn: false) reason = ChatHistoryViewTransitionReason.Initial(fadeIn: false)
case .Generic: case .Generic:
reason = ChatHistoryViewTransitionReason.InteractiveChanges reason = ChatHistoryViewTransitionReason.InteractiveChanges

View File

@ -587,7 +587,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
prepareOnMainQueue = !fadeIn prepareOnMainQueue = !fadeIn
case let .Generic(genericType): case let .Generic(genericType):
switch genericType { switch genericType {
case .InitialUnread: case .InitialUnread, .Initial:
reason = ChatHistoryViewTransitionReason.Initial(fadeIn: false) reason = ChatHistoryViewTransitionReason.Initial(fadeIn: false)
case .Generic: case .Generic:
reason = ChatHistoryViewTransitionReason.InteractiveChanges reason = ChatHistoryViewTransitionReason.InteractiveChanges

View File

@ -561,7 +561,7 @@ final class ChatListNode: ListView {
updatedScrollPosition = nil updatedScrollPosition = nil
} else { } else {
switch update.type { switch update.type {
case .InitialUnread: case .InitialUnread, .Initial:
reason = .initial reason = .initial
prepareOnMainQueue = true prepareOnMainQueue = true
case .Generic: case .Generic:

View File

@ -376,7 +376,7 @@ class GalleryController: ViewController {
switch source { switch source {
case .peerMessagesAtId: case .peerMessagesAtId:
if let tags = tagsForMessage(message!) { 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 return view
|> mapToSignal { (view, _, _) -> Signal<GalleryMessageHistoryView?, NoError> in |> mapToSignal { (view, _, _) -> Signal<GalleryMessageHistoryView?, NoError> in

View File

@ -496,7 +496,7 @@ final class PeerMessagesMediaPlaylist: SharedMediaPlaylist {
guard let message = message else { guard let message = message else {
return .single(nil) 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 |> mapToSignal { view -> Signal<(Message, [Message])?, NoError> in
if let (message, aroundMessages, _) = navigatedMessageFromView(view.0, anchorIndex: message.index, position: .exact) { if let (message, aroundMessages, _) = navigatedMessageFromView(view.0, anchorIndex: message.index, position: .exact) {
return .single((message, aroundMessages)) 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 let historySignal = inputIndex
|> mapToSignal { inputIndex -> Signal<(Message, [Message])?, NoError> in |> 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 |> mapToSignal { view -> Signal<(Message, [Message])?, NoError> in
let position: NavigatedMessageFromViewPosition let position: NavigatedMessageFromViewPosition
switch navigation { switch navigation {
@ -594,13 +594,13 @@ final class PeerMessagesMediaPlaylist: SharedMediaPlaylist {
} }
if case .all = looping { if case .all = looping {
let viewIndex: MessageHistoryAnchorIndex let viewIndex: HistoryViewInputAnchor
if case .earlier = navigation { if case .earlier = navigation {
viewIndex = .upperBound viewIndex = .upperBound
} else { } else {
viewIndex = .lowerBound 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 |> mapToSignal { view -> Signal<(Message, [Message])?, NoError> in
let position: NavigatedMessageFromViewPosition let position: NavigatedMessageFromViewPosition
switch navigation { switch navigation {