mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 19:30:29 +00:00
Initial holes 2.0 support
This commit is contained in:
parent
a95da7736f
commit
4be6d0bfbb
@ -12,7 +12,6 @@ struct CallListNodeView {
|
||||
enum CallListNodeViewTransitionReason {
|
||||
case initial
|
||||
case interactiveChanges
|
||||
case holeChanges(filledHoleDirections: [MessageIndex: HoleFillDirection], removeHoleDirections: [MessageIndex: HoleFillDirection])
|
||||
case reload
|
||||
case reloadAnimated
|
||||
}
|
||||
@ -90,32 +89,6 @@ func preparedCallListNodeViewTransition(from fromView: CallListNodeView?, to toV
|
||||
let _ = options.insert(.LowLatency)
|
||||
let _ = options.insert(.Synchronous)
|
||||
let _ = options.insert(.AnimateCrossfade)
|
||||
case let .holeChanges(filledHoleDirections, removeHoleDirections):
|
||||
if let (_, removeDirection) = removeHoleDirections.first {
|
||||
switch removeDirection {
|
||||
case .LowerToUpper:
|
||||
var holeIndex: MessageIndex?
|
||||
for (index, _) in filledHoleDirections {
|
||||
if holeIndex == nil || index < holeIndex! {
|
||||
holeIndex = index
|
||||
}
|
||||
}
|
||||
|
||||
if let holeIndex = holeIndex {
|
||||
for i in 0 ..< toView.filteredEntries.count {
|
||||
if toView.filteredEntries[i].index >= holeIndex {
|
||||
let index = toView.filteredEntries.count - 1 - (i - 1)
|
||||
stationaryItemRange = (index, Int.max)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
case .UpperToLower:
|
||||
break
|
||||
case .AroundId, .AroundIndex:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (index, entry, previousIndex) in indicesAndItems {
|
||||
|
||||
@ -29,7 +29,7 @@ public final class ChatControllerOverlayPresentationData {
|
||||
|
||||
private enum ChatLocationInfoData {
|
||||
case peer(Promise<PeerView>)
|
||||
case group(Promise<ChatListTopPeersView>)
|
||||
//case group(Promise<ChatListTopPeersView>)
|
||||
}
|
||||
|
||||
private enum ChatRecordingActivity {
|
||||
@ -237,9 +237,9 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
||||
case let .peer(peerId):
|
||||
locationBroadcastPanelSource = .peer(peerId)
|
||||
self.chatLocationInfoData = .peer(Promise())
|
||||
case .group:
|
||||
/*case .group:
|
||||
locationBroadcastPanelSource = .none
|
||||
self.chatLocationInfoData = .group(Promise())
|
||||
self.chatLocationInfoData = .group(Promise())*/
|
||||
}
|
||||
|
||||
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
@ -682,8 +682,8 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
||||
if (peerId.namespace == Namespaces.Peer.CloudChannel || peerId.namespace == Namespaces.Peer.CloudGroup) {
|
||||
postAsReply = true
|
||||
}
|
||||
case .group:
|
||||
postAsReply = true
|
||||
/*case .group:
|
||||
postAsReply = true*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -1200,8 +1200,8 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
||||
let avatarNode = ChatAvatarNavigationNode()
|
||||
avatarNode.chatController = self
|
||||
chatInfoButtonItem = UIBarButtonItem(customDisplayNode: avatarNode)!
|
||||
case .group:
|
||||
chatInfoButtonItem = UIBarButtonItem(customDisplayNode: ChatMultipleAvatarsNavigationNode())!
|
||||
/*case .group:
|
||||
chatInfoButtonItem = UIBarButtonItem(customDisplayNode: ChatMultipleAvatarsNavigationNode())!*/
|
||||
}
|
||||
chatInfoButtonItem.target = self
|
||||
chatInfoButtonItem.action = #selector(self.rightNavigationButtonAction)
|
||||
@ -1337,7 +1337,7 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
||||
}
|
||||
}))
|
||||
}
|
||||
case let .group(groupId):
|
||||
/*case let .group(groupId):
|
||||
if case let .group(topPeersView) = self.chatLocationInfoData {
|
||||
let key: PostboxViewKey = .chatListTopPeers(groupId: groupId)
|
||||
topPeersView.set(context.account.postbox.combinedView(keys: [key])
|
||||
@ -1359,7 +1359,7 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
||||
}
|
||||
}
|
||||
}))
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
self.botCallbackAlertMessageDisposable = (self.botCallbackAlertMessage.get()
|
||||
@ -2406,8 +2406,8 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
||||
switch strongSelf.chatLocation {
|
||||
case .peer:
|
||||
strongSelf.navigateToMessage(from: nil, to: .index(navigateIndex), forceInCurrentChat: true)
|
||||
case .group:
|
||||
strongSelf.navigateToMessage(from: nil, to: .index(navigateIndex))
|
||||
/*case .group:
|
||||
strongSelf.navigateToMessage(from: nil, to: .index(navigateIndex))*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2899,9 +2899,9 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
||||
strongSelf.chatDisplayNode.historyNode.scrollToNextMessage()
|
||||
}
|
||||
}, openGrouping: { [weak self] in
|
||||
if let strongSelf = self, case let .group(groupId) = strongSelf.chatLocation {
|
||||
/*if let strongSelf = self, case let .group(groupId) = strongSelf.chatLocation {
|
||||
(strongSelf.navigationController as? NavigationController)?.pushViewController(FeedGroupingController(context: strongSelf.context, groupId: groupId))
|
||||
}
|
||||
}*/
|
||||
}, toggleSilentPost: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
var value: Bool = false
|
||||
@ -3149,7 +3149,7 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
||||
strongSelf.present(standardTextAlertController(theme: AlertControllerTheme(presentationTheme: strongSelf.presentationData.theme), title: nil, text: text, actions: actions), in: .window(.root))
|
||||
}
|
||||
}))
|
||||
case let .group(groupId):
|
||||
/*case let .group(groupId):
|
||||
let unreadCountsKey: PostboxViewKey = .unreadCounts(items: [.group(groupId), .total(nil)])
|
||||
self.chatUnreadCountDisposable = (self.context.account.postbox.combinedView(keys: [unreadCountsKey]) |> deliverOnMainQueue).start(next: { [weak self] views in
|
||||
if let strongSelf = self {
|
||||
@ -3169,7 +3169,7 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
||||
|
||||
strongSelf.chatDisplayNode.navigateButtons.unreadCount = unreadCount
|
||||
}
|
||||
})
|
||||
})*/
|
||||
}
|
||||
|
||||
self.interfaceInteraction = interfaceInteraction
|
||||
@ -3834,10 +3834,10 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
||||
}
|
||||
}
|
||||
}))
|
||||
case .group:
|
||||
/*case .group:
|
||||
if case let .group(groupId) = self.chatLocation {
|
||||
(self.navigationController as? NavigationController)?.pushViewController(ChatListController(context: self.context, groupId: groupId, controlsHistoryPreload: false))
|
||||
}
|
||||
}*/
|
||||
}
|
||||
case .search:
|
||||
self.interfaceInteraction?.beginMessageSearch(.everything, "")
|
||||
@ -4705,8 +4705,8 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
||||
switch self.chatLocation {
|
||||
case let .peer(peerId):
|
||||
derivedSearchState = ChatSearchState(query: search.query, location: .peer(peerId: peerId, fromId: nil, tags: nil), loadMoreState: loadMoreStateFromResultsState(search.resultsState))
|
||||
case let .group(groupId):
|
||||
derivedSearchState = ChatSearchState(query: search.query, location: .group(groupId), loadMoreState: loadMoreStateFromResultsState(search.resultsState))
|
||||
/*case let .group(groupId):
|
||||
derivedSearchState = ChatSearchState(query: search.query, location: .group(groupId), loadMoreState: loadMoreStateFromResultsState(search.resultsState))*/
|
||||
}
|
||||
case .members:
|
||||
derivedSearchState = nil
|
||||
@ -4714,8 +4714,8 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
||||
switch self.chatLocation {
|
||||
case let .peer(peerId):
|
||||
derivedSearchState = ChatSearchState(query: search.query, location: .peer(peerId: peerId, fromId: peer.id, tags: nil), loadMoreState: loadMoreStateFromResultsState(search.resultsState))
|
||||
case .group:
|
||||
derivedSearchState = nil
|
||||
/*case .group:
|
||||
derivedSearchState = nil*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4781,8 +4781,8 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
||||
switch strongSelf.chatLocation {
|
||||
case .peer:
|
||||
strongSelf.navigateToMessage(from: nil, to: .index(navigateIndex), forceInCurrentChat: true)
|
||||
case .group:
|
||||
strongSelf.navigateToMessage(from: nil, to: .index(navigateIndex))
|
||||
/*case .group:
|
||||
strongSelf.navigateToMessage(from: nil, to: .index(navigateIndex))*/
|
||||
}
|
||||
}
|
||||
strongSelf.updateItemNodesSearchTextHighlightStates()
|
||||
@ -5160,8 +5160,8 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
||||
default:
|
||||
break
|
||||
}
|
||||
case .group:
|
||||
(self.navigationController as? NavigationController)?.pushViewController(ChatController(context: self.context, chatLocation: .peer(peerId), messageId: fromMessage?.id, botStart: nil))
|
||||
/*case .group:
|
||||
(self.navigationController as? NavigationController)?.pushViewController(ChatController(context: self.context, chatLocation: .peer(peerId), messageId: fromMessage?.id, botStart: nil))*/
|
||||
}
|
||||
} else {
|
||||
switch navigation {
|
||||
@ -5649,8 +5649,8 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
||||
switch chatLocation {
|
||||
case let .peer(peerId):
|
||||
let _ = data.swap(PreviewActionsData(notificationSettings: transaction.getPeerNotificationSettings(peerId), peer: transaction.getPeer(peerId)))
|
||||
case .group:
|
||||
let _ = data.swap(PreviewActionsData(notificationSettings: nil, peer: nil))
|
||||
/*case .group:
|
||||
let _ = data.swap(PreviewActionsData(notificationSettings: nil, peer: nil))*/
|
||||
}
|
||||
semaphore.signal()
|
||||
}).start()
|
||||
|
||||
@ -300,8 +300,8 @@ public final class ChatHistoryGridNode: GridNode, ChatHistoryNode {
|
||||
reason = ChatHistoryViewTransitionReason.InteractiveChanges
|
||||
case .UpdateVisible:
|
||||
reason = ChatHistoryViewTransitionReason.Reload
|
||||
case let .FillHole(insertions, deletions):
|
||||
reason = ChatHistoryViewTransitionReason.HoleChanges(filledHoleDirections: insertions, removeHoleDirections: deletions)
|
||||
case .FillHole:
|
||||
reason = ChatHistoryViewTransitionReason.Reload
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -69,8 +69,8 @@ struct ChatHistoryView {
|
||||
enum ChatHistoryViewTransitionReason {
|
||||
case Initial(fadeIn: Bool)
|
||||
case InteractiveChanges
|
||||
case HoleChanges(filledHoleDirections: [MessageIndex: HoleFillDirection], removeHoleDirections: [MessageIndex: HoleFillDirection])
|
||||
case Reload
|
||||
case HoleReload
|
||||
}
|
||||
|
||||
struct ChatHistoryViewTransitionInsertEntry {
|
||||
@ -576,8 +576,9 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
||||
reason = ChatHistoryViewTransitionReason.InteractiveChanges
|
||||
case .UpdateVisible:
|
||||
reason = ChatHistoryViewTransitionReason.Reload
|
||||
case let .FillHole(insertions, deletions):
|
||||
reason = ChatHistoryViewTransitionReason.HoleChanges(filledHoleDirections: insertions, removeHoleDirections: deletions)
|
||||
case .FillHole:
|
||||
assertionFailure()
|
||||
reason = ChatHistoryViewTransitionReason.Reload
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -614,10 +615,10 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
||||
switch chatLocation {
|
||||
case .peer:
|
||||
let _ = applyMaxReadIndexInteractively(postbox: context.account.postbox, stateManager: context.account.stateManager, index: messageIndex).start()
|
||||
case let .group(groupId):
|
||||
/*case let .group(groupId):
|
||||
let _ = context.account.postbox.transaction({ transaction -> Void in
|
||||
transaction.applyGroupFeedInteractiveReadMaxIndex(groupId: groupId, index: messageIndex)
|
||||
}).start()
|
||||
}).start()*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,8 +204,8 @@ private func extractAdditionalData(view: MessageHistoryView, chatLocation: ChatL
|
||||
readStateData[peerId] = ChatHistoryCombinedInitialReadStateData(unreadCount: readState.count, totalState: totalUnreadState, notificationSettings: notificationSettings)
|
||||
}
|
||||
}
|
||||
case .group:
|
||||
break
|
||||
/*case .group:
|
||||
break*/
|
||||
}
|
||||
default:
|
||||
break
|
||||
|
||||
@ -155,8 +155,8 @@ final class ChatInfoTitlePanelNode: ChatTitleAccessoryPanelNode {
|
||||
} else {
|
||||
updatedButtons = []
|
||||
}
|
||||
case .group:
|
||||
updatedButtons = groupButtons()
|
||||
/*case .group:
|
||||
updatedButtons = groupButtons()*/
|
||||
}
|
||||
|
||||
var buttonsUpdated = false
|
||||
|
||||
@ -38,8 +38,8 @@ func canReplyInChat(_ chatPresentationInterfaceState: ChatPresentationInterfaceS
|
||||
} else {
|
||||
canReply = true
|
||||
}
|
||||
case .group:
|
||||
break
|
||||
/*case .group:
|
||||
break*/
|
||||
}
|
||||
return canReply
|
||||
}
|
||||
@ -223,8 +223,8 @@ func contextMenuForChatPresentationIntefaceState(chatPresentationInterfaceState:
|
||||
canPin = true
|
||||
}
|
||||
}
|
||||
case .group:
|
||||
break
|
||||
/*case .group:
|
||||
break*/
|
||||
}
|
||||
} else {
|
||||
canReply = false
|
||||
|
||||
@ -57,7 +57,7 @@ func inputPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState
|
||||
|
||||
var displayInputTextPanel = false
|
||||
|
||||
if case .group = chatPresentationInterfaceState.chatLocation {
|
||||
/*if case .group = chatPresentationInterfaceState.chatLocation {
|
||||
if chatPresentationInterfaceState.interfaceState.editMessage != nil {
|
||||
displayInputTextPanel = true
|
||||
} else {
|
||||
@ -72,7 +72,7 @@ func inputPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState
|
||||
return panel
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if let peer = chatPresentationInterfaceState.renderedPeer?.peer {
|
||||
if let secretChat = peer as? TelegramSecretChat {
|
||||
|
||||
@ -505,7 +505,7 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie
|
||||
}
|
||||
}
|
||||
|
||||
self.chatListDisplayNode.chatListNode.groupSelected = { [weak self] groupId in
|
||||
/*self.chatListDisplayNode.chatListNode.groupSelected = { [weak self] groupId in
|
||||
if let strongSelf = self {
|
||||
if let navigationController = strongSelf.navigationController as? NavigationController {
|
||||
var scrollToEndIfExists = false
|
||||
@ -522,7 +522,7 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie
|
||||
if let strongSelf = self {
|
||||
let _ = updatePeerGroupIdInteractively(postbox: strongSelf.context.account.postbox, peerId: peerId, groupId: group ? Namespaces.PeerGroup.feed : nil).start()
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
self.chatListDisplayNode.requestOpenMessageFromSearch = { [weak self] peer, messageId in
|
||||
if let strongSelf = self {
|
||||
@ -973,10 +973,10 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
case let .groupReference(groupId, _, _, _):
|
||||
/*case let .groupReference(groupId, _, _, _):
|
||||
let chatListController = ChatListController(context: self.context, groupId: groupId, controlsHistoryPreload: false)
|
||||
chatListController.containerLayoutUpdated(ContainerViewLayout(size: contentSize, metrics: LayoutMetrics(), intrinsicInsets: UIEdgeInsets(), safeInsets: UIEdgeInsets(), statusBarHeight: nil, inputHeight: nil, standardInputHeight: 216.0, inputHeightIsInteractivellyChanging: false, inVoiceOver: false), transition: .immediate)
|
||||
return (chatListController, sourceRect)
|
||||
return (chatListController, sourceRect)*/
|
||||
}
|
||||
} else {
|
||||
return nil
|
||||
|
||||
@ -8,14 +8,14 @@ import TelegramCore
|
||||
|
||||
enum ChatListItemContent {
|
||||
case peer(message: Message?, peer: RenderedPeer, combinedReadState: CombinedPeerReadState?, notificationSettings: PeerNotificationSettings?, summaryInfo: ChatListMessageTagSummaryInfo, embeddedState: PeerChatListEmbeddedInterfaceState?, inputActivities: [(Peer, PeerInputActivity)]?, isAd: Bool, ignoreUnreadBadge: Bool)
|
||||
case groupReference(groupId: PeerGroupId, message: Message?, topPeers: [Peer], counters: GroupReferenceUnreadCounters)
|
||||
//case groupReference(groupId: PeerGroupId, message: Message?, topPeers: [Peer], counters: GroupReferenceUnreadCounters)
|
||||
|
||||
var chatLocation: ChatLocation {
|
||||
switch self {
|
||||
case let .peer(_, peer, _, _, _, _, _, _, _):
|
||||
return .peer(peer.peerId)
|
||||
case let .groupReference(groupId, _, _, _):
|
||||
return .group(groupId)
|
||||
/*case let .groupReference(groupId, _, _, _):
|
||||
return .group(groupId)*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -107,8 +107,8 @@ class ChatListItem: ListViewItem {
|
||||
} else if let peer = peer.peers[peer.peerId] {
|
||||
self.interaction.peerSelected(peer)
|
||||
}
|
||||
case let .groupReference(groupId, _, _, _):
|
||||
self.interaction.groupSelected(groupId)
|
||||
/*case let .groupReference(groupId, _, _, _):
|
||||
self.interaction.groupSelected(groupId)*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,8 +275,8 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
return nil
|
||||
}
|
||||
switch item.content {
|
||||
case .groupReference:
|
||||
return nil
|
||||
/*case .groupReference:
|
||||
return nil*/
|
||||
case let .peer(peer):
|
||||
guard let chatMainPeer = peer.peer.chatMainPeer else {
|
||||
return nil
|
||||
@ -293,8 +293,8 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
return nil
|
||||
}
|
||||
switch item.content {
|
||||
case .groupReference:
|
||||
return nil
|
||||
/*case .groupReference:
|
||||
return nil*/
|
||||
case let .peer(peer):
|
||||
if let message = peer.message {
|
||||
var result = ""
|
||||
@ -402,8 +402,8 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
switch item.content {
|
||||
case let .peer(_, peerValue, _, _, _, _, _, _, _):
|
||||
peer = peerValue.chatMainPeer
|
||||
case .groupReference:
|
||||
break
|
||||
/*case .groupReference:
|
||||
break*/
|
||||
}
|
||||
|
||||
if let peer = peer {
|
||||
@ -521,7 +521,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
inputActivities = inputActivitiesValue
|
||||
isPeerGroup = false
|
||||
isAd = isAdValue
|
||||
case let .groupReference(_, messageValue, topPeersValue, counters):
|
||||
/*case let .groupReference(_, messageValue, topPeersValue, counters):
|
||||
if let messageValue = messageValue {
|
||||
itemPeer = RenderedPeer(message: messageValue)
|
||||
} else {
|
||||
@ -543,7 +543,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
} else{
|
||||
unreadCount = (0, false, false)
|
||||
}
|
||||
isAd = false
|
||||
isAd = false*/
|
||||
}
|
||||
|
||||
let theme = item.presentationData.theme.chatList
|
||||
@ -612,11 +612,11 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
} else {
|
||||
peerText = author.id == account.peerId ? item.presentationData.strings.DialogList_You : author.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
|
||||
}
|
||||
} else if case .groupReference = item.content {
|
||||
}/* else if case .groupReference = item.content {
|
||||
if let messagePeer = itemPeer.chatMainPeer {
|
||||
peerText = messagePeer.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if let peerText = peerText {
|
||||
authorAttributedString = NSAttributedString(string: peerText, font: textFont, textColor: theme.authorNameColor)
|
||||
@ -632,8 +632,8 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
} else if let displayTitle = peer?.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder) {
|
||||
titleAttributedString = NSAttributedString(string: displayTitle, font: titleFont, textColor: item.index.messageIndex.id.peerId.namespace == Namespaces.Peer.SecretChat ? theme.secretTitleColor : theme.titleColor)
|
||||
}
|
||||
case .groupReference:
|
||||
titleAttributedString = NSAttributedString(string: "Feed", font: titleFont, textColor: theme.titleColor)
|
||||
/*case .groupReference:
|
||||
titleAttributedString = NSAttributedString(string: "Feed", font: titleFont, textColor: theme.titleColor)*/
|
||||
}
|
||||
|
||||
textAttributedString = attributedText
|
||||
@ -807,7 +807,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
peerRevealOptions = []
|
||||
peerLeftRevealOptions = []
|
||||
}
|
||||
case .groupReference:
|
||||
/*case .groupReference:
|
||||
let isPinned = item.index.pinningIndex != nil
|
||||
|
||||
if item.enableContextActions {
|
||||
@ -815,7 +815,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
} else {
|
||||
peerRevealOptions = []
|
||||
}
|
||||
peerLeftRevealOptions = []
|
||||
peerLeftRevealOptions = []*/
|
||||
}
|
||||
|
||||
return (layout, { [weak self] synchronousLoads, animated in
|
||||
@ -1267,8 +1267,8 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
switch item.content {
|
||||
case .peer:
|
||||
itemId = .peer(item.index.messageIndex.id.peerId)
|
||||
case let .groupReference(groupId, _, _, _):
|
||||
itemId = .group(groupId)
|
||||
/*case let .groupReference(groupId, _, _, _):
|
||||
itemId = .group(groupId)*/
|
||||
}
|
||||
item.interaction.setItemPinned(itemId, true)
|
||||
case RevealOptionKey.unpin.rawValue:
|
||||
@ -1276,8 +1276,8 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
switch item.content {
|
||||
case .peer:
|
||||
itemId = .peer(item.index.messageIndex.id.peerId)
|
||||
case let .groupReference(groupId, _, _, _):
|
||||
itemId = .group(groupId)
|
||||
/*case let .groupReference(groupId, _, _, _):
|
||||
itemId = .group(groupId)*/
|
||||
}
|
||||
item.interaction.setItemPinned(itemId, false)
|
||||
case RevealOptionKey.mute.rawValue:
|
||||
|
||||
@ -204,8 +204,8 @@ private func mappedInsertEntries(account: Account, nodeInteraction: ChatListNode
|
||||
}
|
||||
case let .HoleEntry(_, theme):
|
||||
return ListViewInsertItem(index: entry.index, previousIndex: entry.previousIndex, item: ChatListHoleItem(theme: theme), directionHint: entry.directionHint)
|
||||
case let .GroupReferenceEntry(index, presentationData, groupId, message, topPeers, counters, editing):
|
||||
return ListViewInsertItem(index: entry.index, previousIndex: entry.previousIndex, item: ChatListItem(presentationData: presentationData, account: account, peerGroupId: peerGroupId, index: index, content: .groupReference(groupId: groupId, message: message, topPeers: topPeers, counters: counters), editing: editing, hasActiveRevealControls: false, selected: false, header: nil, enableContextActions: true, interaction: nodeInteraction), directionHint: entry.directionHint)
|
||||
/*case let .GroupReferenceEntry(index, presentationData, groupId, message, topPeers, counters, editing):
|
||||
return ListViewInsertItem(index: entry.index, previousIndex: entry.previousIndex, item: ChatListItem(presentationData: presentationData, account: account, peerGroupId: peerGroupId, index: index, content: .groupReference(groupId: groupId, message: message, topPeers: topPeers, counters: counters), editing: editing, hasActiveRevealControls: false, selected: false, header: nil, enableContextActions: true, interaction: nodeInteraction), directionHint: entry.directionHint)*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -241,8 +241,8 @@ private func mappedUpdateEntries(account: Account, nodeInteraction: ChatListNode
|
||||
}
|
||||
case let .HoleEntry(_, theme):
|
||||
return ListViewUpdateItem(index: entry.index, previousIndex: entry.previousIndex, item: ChatListHoleItem(theme: theme), directionHint: entry.directionHint)
|
||||
case let .GroupReferenceEntry(index, presentationData, groupId, message, topPeers, counters, editing):
|
||||
return ListViewUpdateItem(index: entry.index, previousIndex: entry.previousIndex, item: ChatListItem(presentationData: presentationData, account: account, peerGroupId: peerGroupId, index: index, content: .groupReference(groupId: groupId, message: message, topPeers: topPeers, counters: counters), editing: editing, hasActiveRevealControls: false, selected: false, header: nil, enableContextActions: true, interaction: nodeInteraction), directionHint: entry.directionHint)
|
||||
/*case let .GroupReferenceEntry(index, presentationData, groupId, message, topPeers, counters, editing):
|
||||
return ListViewUpdateItem(index: entry.index, previousIndex: entry.previousIndex, item: ChatListItem(presentationData: presentationData, account: account, peerGroupId: peerGroupId, index: index, content: .groupReference(groupId: groupId, message: message, topPeers: topPeers, counters: counters), editing: editing, hasActiveRevealControls: false, selected: false, header: nil, enableContextActions: true, interaction: nodeInteraction), directionHint: entry.directionHint)*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -817,8 +817,8 @@ final class ChatListNode: ListView {
|
||||
} else {
|
||||
referenceId = .peer(index.messageIndex.id.peerId)
|
||||
}
|
||||
case let .GroupReferenceEntry(_, _, groupId, _, _, _, _):
|
||||
referenceId = .group(groupId)
|
||||
/*case let .GroupReferenceEntry(_, _, groupId, _, _, _, _):
|
||||
referenceId = .group(groupId)*/
|
||||
default:
|
||||
break
|
||||
}
|
||||
@ -831,8 +831,8 @@ final class ChatListNode: ListView {
|
||||
switch fromEntry {
|
||||
case let .PeerEntry(index, _, _, _, _, _, _, _, _, _, _, _, _):
|
||||
itemId = .peer(index.messageIndex.id.peerId)
|
||||
case let .GroupReferenceEntry(_, _, groupId, _, _, _, _):
|
||||
itemId = .group(groupId)
|
||||
/*case let .GroupReferenceEntry(_, _, groupId, _, _, _, _):
|
||||
itemId = .group(groupId)*/
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ enum ChatListNodeEntryId: Hashable {
|
||||
enum ChatListNodeEntry: Comparable, Identifiable {
|
||||
case PeerEntry(index: ChatListIndex, presentationData: ChatListPresentationData, message: Message?, readState: CombinedPeerReadState?, notificationSettings: PeerNotificationSettings?, embeddedInterfaceState: PeerChatListEmbeddedInterfaceState?, peer: RenderedPeer, summaryInfo: ChatListMessageTagSummaryInfo, editing: Bool, hasActiveRevealControls: Bool, selected: Bool, inputActivities: [(Peer, PeerInputActivity)]?, isAd: Bool)
|
||||
case HoleEntry(ChatListHole, theme: PresentationTheme)
|
||||
case GroupReferenceEntry(index: ChatListIndex, presentationData: ChatListPresentationData, groupId: PeerGroupId, message: Message?, topPeers: [Peer], counters: GroupReferenceUnreadCounters, editing: Bool)
|
||||
//case GroupReferenceEntry(index: ChatListIndex, presentationData: ChatListPresentationData, groupId: PeerGroupId, message: Message?, topPeers: [Peer], counters: GroupReferenceUnreadCounters, editing: Bool)
|
||||
|
||||
var index: ChatListIndex {
|
||||
switch self {
|
||||
@ -53,8 +53,8 @@ enum ChatListNodeEntry: Comparable, Identifiable {
|
||||
return index
|
||||
case let .HoleEntry(hole, _):
|
||||
return ChatListIndex(pinningIndex: nil, messageIndex: hole.index)
|
||||
case let .GroupReferenceEntry(index, _, _, _, _, _, _):
|
||||
return index
|
||||
/*case let .GroupReferenceEntry(index, _, _, _, _, _, _):
|
||||
return index*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,8 +64,8 @@ enum ChatListNodeEntry: Comparable, Identifiable {
|
||||
return .PeerId(index.messageIndex.id.peerId.toInt64())
|
||||
case let .HoleEntry(hole, _):
|
||||
return .Hole(Int64(hole.index.id.id))
|
||||
case let .GroupReferenceEntry(_, _, groupId, _, _, _, _):
|
||||
return .GroupId(groupId)
|
||||
/*case let .GroupReferenceEntry(_, _, groupId, _, _, _, _):
|
||||
return .GroupId(groupId)*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ enum ChatListNodeEntry: Comparable, Identifiable {
|
||||
default:
|
||||
return false
|
||||
}
|
||||
case let .GroupReferenceEntry(lhsIndex, lhsPresentationData, lhsGroupId, lhsMessage, lhsTopPeers, lhsCounters, lhsEditing):
|
||||
/*case let .GroupReferenceEntry(lhsIndex, lhsPresentationData, lhsGroupId, lhsMessage, lhsTopPeers, lhsCounters, lhsEditing):
|
||||
if case let .GroupReferenceEntry(rhsIndex, rhsPresentationData, rhsGroupId, rhsMessage, rhsTopPeers, rhsCounters, rhsEditing) = rhs {
|
||||
if lhsIndex != rhsIndex {
|
||||
return false
|
||||
@ -184,7 +184,7 @@ enum ChatListNodeEntry: Comparable, Identifiable {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -222,10 +222,10 @@ func chatListNodeEntriesForView(_ view: ChatListView, state: ChatListNodeState,
|
||||
result.append(.PeerEntry(index: offsetPinnedIndex(index, offset: pinnedIndexOffset), presentationData: state.presentationData, message: updatedMessage, readState: updatedCombinedReadState, notificationSettings: notificationSettings, embeddedInterfaceState: embeddedState, peer: peer, summaryInfo: summaryInfo, editing: state.editing, hasActiveRevealControls: index.messageIndex.id.peerId == state.peerIdWithRevealedOptions, selected: state.selectedPeerIds.contains(index.messageIndex.id.peerId), inputActivities: state.peerInputActivities?.activities[index.messageIndex.id.peerId], isAd: false))
|
||||
case let .HoleEntry(hole):
|
||||
result.append(.HoleEntry(hole, theme: state.presentationData.theme))
|
||||
case let .GroupReferenceEntry(groupId, index, message, topPeers, counters):
|
||||
/*case let .GroupReferenceEntry(groupId, index, message, topPeers, counters):
|
||||
if case .chatList = mode {
|
||||
result.append(.GroupReferenceEntry(index: index, presentationData: state.presentationData, groupId: groupId, message: message, topPeers: topPeers, counters: counters, editing: state.editing))
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
if view.laterIndex == nil {
|
||||
|
||||
@ -1177,8 +1177,8 @@ final class ChatListSearchContainerNode: SearchDisplayControllerContentNode {
|
||||
switch item.content {
|
||||
case let .peer(message, peer, _, _, _, _, _, _, _):
|
||||
return (selectedItemNode.view, bounds, message?.id ?? peer.peerId)
|
||||
case let .groupReference(groupId, _, _, _):
|
||||
return (selectedItemNode.view, bounds, groupId)
|
||||
/*case let .groupReference(groupId, _, _, _):
|
||||
return (selectedItemNode.view, bounds, groupId)*/
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
@ -13,7 +13,7 @@ struct ChatListNodeView {
|
||||
enum ChatListNodeViewTransitionReason {
|
||||
case initial
|
||||
case interactiveChanges
|
||||
case holeChanges(filledHoleDirections: [MessageIndex: HoleFillDirection], removeHoleDirections: [MessageIndex: HoleFillDirection])
|
||||
case holeChanges
|
||||
case reload
|
||||
}
|
||||
|
||||
@ -105,33 +105,9 @@ func preparedChatListNodeViewTransition(from fromView: ChatListNodeView?, to toV
|
||||
}
|
||||
case .reload:
|
||||
break
|
||||
case let .holeChanges(filledHoleDirections, removeHoleDirections):
|
||||
if let (_, removeDirection) = removeHoleDirections.first {
|
||||
switch removeDirection {
|
||||
case .LowerToUpper:
|
||||
var holeIndex: ChatListIndex?
|
||||
for (index, _) in filledHoleDirections {
|
||||
if holeIndex == nil || index < holeIndex!.messageIndex {
|
||||
holeIndex = ChatListIndex(pinningIndex: nil, messageIndex: index)
|
||||
}
|
||||
}
|
||||
|
||||
if let holeIndex = holeIndex {
|
||||
for i in 0 ..< toView.filteredEntries.count {
|
||||
if toView.filteredEntries[i].index >= holeIndex {
|
||||
let index = toView.filteredEntries.count - 1 - (i - 1)
|
||||
stationaryItemRange = (index, Int.max)
|
||||
case .holeChanges:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
case .UpperToLower:
|
||||
break
|
||||
case .AroundId, .AroundIndex:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (index, entry, previousIndex) in indicesAndItems {
|
||||
let adjustedIndex = updatedCount - 1 - index
|
||||
|
||||
@ -204,8 +204,8 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
||||
} else if incoming {
|
||||
hasAvatar = true
|
||||
}
|
||||
case .group:
|
||||
hasAvatar = true
|
||||
/*case .group:
|
||||
hasAvatar = true*/
|
||||
}
|
||||
|
||||
if hasAvatar {
|
||||
|
||||
@ -360,10 +360,10 @@ class ChatMessageBubbleItemNode: ChatMessageItemView {
|
||||
} else if incoming {
|
||||
hasAvatar = true
|
||||
}
|
||||
case .group:
|
||||
/*case .group:
|
||||
allowFullWidth = true
|
||||
hasAvatar = true
|
||||
displayAuthorInfo = true
|
||||
displayAuthorInfo = true*/
|
||||
}
|
||||
|
||||
if let forwardInfo = item.content.firstMessage.forwardInfo, forwardInfo.source == nil, forwardInfo.author.id.namespace == Namespaces.Peer.CloudUser {
|
||||
|
||||
@ -119,8 +119,8 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView {
|
||||
} else if incoming {
|
||||
hasAvatar = true
|
||||
}
|
||||
case .group:
|
||||
hasAvatar = true
|
||||
/*case .group:
|
||||
hasAvatar = true*/
|
||||
}
|
||||
|
||||
if hasAvatar {
|
||||
|
||||
@ -276,9 +276,9 @@ public final class ChatMessageItem: ListViewItem, CustomStringConvertible {
|
||||
effectiveAuthor = content.firstMessage.author
|
||||
displayAuthorInfo = incoming && peerId.isGroupOrChannel && effectiveAuthor != nil
|
||||
}
|
||||
case .group:
|
||||
/*case .group:
|
||||
effectiveAuthor = content.firstMessage.author
|
||||
displayAuthorInfo = incoming && effectiveAuthor != nil
|
||||
displayAuthorInfo = incoming && effectiveAuthor != nil*/
|
||||
}
|
||||
|
||||
self.effectiveAuthorId = effectiveAuthor?.id
|
||||
|
||||
@ -144,8 +144,8 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
} else if incoming {
|
||||
hasAvatar = true
|
||||
}
|
||||
case .group:
|
||||
hasAvatar = true
|
||||
/*case .group:
|
||||
hasAvatar = true*/
|
||||
}
|
||||
|
||||
if hasAvatar {
|
||||
|
||||
@ -66,7 +66,7 @@ private func filterOriginalMessageFlags(_ message: Message) -> Message {
|
||||
|
||||
private func filterMessageChannelPeer(_ peer: Peer) -> Peer {
|
||||
if let peer = peer as? TelegramChannel {
|
||||
return TelegramChannel(id: peer.id, accessHash: peer.accessHash, title: peer.title, username: peer.username, photo: peer.photo, creationDate: peer.creationDate, version: peer.version, participationStatus: peer.participationStatus, info: .group(TelegramChannelGroupInfo(flags: [])), flags: peer.flags, restrictionInfo: peer.restrictionInfo, adminRights: peer.adminRights, bannedRights: peer.bannedRights, defaultBannedRights: peer.defaultBannedRights, peerGroupId: peer.peerGroupId)
|
||||
return TelegramChannel(id: peer.id, accessHash: peer.accessHash, title: peer.title, username: peer.username, photo: peer.photo, creationDate: peer.creationDate, version: peer.version, participationStatus: peer.participationStatus, info: .group(TelegramChannelGroupInfo(flags: [])), flags: peer.flags, restrictionInfo: peer.restrictionInfo, adminRights: peer.adminRights, bannedRights: peer.bannedRights, defaultBannedRights: peer.defaultBannedRights)
|
||||
}
|
||||
return peer
|
||||
}
|
||||
|
||||
@ -25,8 +25,8 @@ final class ChatSearchNavigationContentNode: NavigationBarContentNode {
|
||||
switch chatLocation {
|
||||
case .peer:
|
||||
placeholderText = strings.Conversation_SearchPlaceholder
|
||||
case .group:
|
||||
placeholderText = "Search this feed"
|
||||
/*case .group:
|
||||
placeholderText = "Search this feed"*/
|
||||
}
|
||||
self.searchBar.placeholderString = NSAttributedString(string: placeholderText, font: searchBarFont, textColor: theme.rootController.activeNavigationSearchBar.inputPlaceholderTextColor)
|
||||
|
||||
@ -77,8 +77,8 @@ final class ChatSearchNavigationContentNode: NavigationBarContentNode {
|
||||
switch self.chatLocation {
|
||||
case .peer:
|
||||
placeholderText = self.strings.Conversation_SearchPlaceholder
|
||||
case .group:
|
||||
placeholderText = "Search this feed"
|
||||
/*case .group:
|
||||
placeholderText = "Search this feed"*/
|
||||
}
|
||||
self.searchBar.placeholderString = NSAttributedString(string: placeholderText, font: searchBarFont, textColor: theme.rootController.activeNavigationSearchBar.inputPlaceholderTextColor)
|
||||
case .members:
|
||||
|
||||
@ -4,7 +4,7 @@ import TelegramCore
|
||||
import Postbox
|
||||
import SwiftSignalKit
|
||||
|
||||
final class FeedGroupingController: ViewController {
|
||||
/*final class FeedGroupingController: ViewController {
|
||||
private var controllerNode: FeedGroupingControllerNode {
|
||||
return self.displayNode as! FeedGroupingControllerNode
|
||||
}
|
||||
@ -51,3 +51,4 @@ final class FeedGroupingController: ViewController {
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
@ -6,7 +6,7 @@ import Display
|
||||
|
||||
import SafariServices
|
||||
|
||||
private enum FeedGroupingControllerTransitionType {
|
||||
/*private enum FeedGroupingControllerTransitionType {
|
||||
case initial
|
||||
case initialLoad
|
||||
case generic
|
||||
@ -483,3 +483,4 @@ final class FeedGroupingControllerNode: ViewControllerTracingNode {
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
@ -55,8 +55,9 @@ func preparedChatHistoryViewTransition(from fromView: ChatHistoryView?, to toVie
|
||||
}
|
||||
case .Reload:
|
||||
stationaryItemRange = (0, Int.max)
|
||||
case let .HoleChanges(filledHoleDirections, removeHoleDirections):
|
||||
if let (_, removeDirection) = removeHoleDirections.first {
|
||||
case .HoleReload:
|
||||
stationaryItemRange = (0, Int.max)
|
||||
/*if let (_, removeDirection) = removeHoleDirections.first {
|
||||
switch removeDirection {
|
||||
case .LowerToUpper:
|
||||
var holeIndex: MessageIndex?
|
||||
@ -80,7 +81,7 @@ func preparedChatHistoryViewTransition(from fromView: ChatHistoryView?, to toVie
|
||||
case .AroundId, .AroundIndex:
|
||||
break
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
for (index, entry, previousIndex) in mergeResult.indicesAndItems {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user