Swiftgram/TelegramUI/ChatHistoryNode.swift
2017-02-19 23:21:03 +03:00

36 lines
1.1 KiB
Swift

import Foundation
import Postbox
import SwiftSignalKit
import Display
public enum ChatHistoryNodeHistoryState: Equatable {
case loading
case loaded(isEmpty: Bool)
public static func ==(lhs: ChatHistoryNodeHistoryState, rhs: ChatHistoryNodeHistoryState) -> Bool {
switch lhs {
case .loading:
if case .loading = rhs {
return true
} else {
return false
}
case let .loaded(isEmpty):
if case .loaded(isEmpty) = rhs {
return true
} else {
return false
}
}
}
}
public protocol ChatHistoryNode: class {
var historyState: ValuePromise<ChatHistoryNodeHistoryState> { get }
var preloadPages: Bool { get set }
func messageInCurrentHistoryView(_ id: MessageId) -> Message?
func updateLayout(transition: ContainedViewLayoutTransition, updateSizeAndInsets: ListViewUpdateSizeAndInsets)
func forEachItemNode(_ f: (ASDisplayNode) -> Void)
}