mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
Support for updated Postbox API
This commit is contained in:
parent
94705dd746
commit
aa9d43c9dc
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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<GalleryMessageHistoryView?, NoError> in
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user