mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
[WIP] Topics
This commit is contained in:
@@ -25,6 +25,9 @@ final class ViewTracker {
|
||||
private let chatListHolesView = MutableChatListHolesView()
|
||||
private let chatListHolesViewSubscribers = Bag<ValuePipe<ChatListHolesView>>()
|
||||
|
||||
private let forumTopicListHolesView = MutableForumTopicListHolesView()
|
||||
private let forumTopicListHolesViewSubscribers = Bag<ValuePipe<ForumTopicListHolesView>>()
|
||||
|
||||
private var unsentMessageView: UnsentMessageHistoryView
|
||||
private let unsendMessageIdsViewSubscribers = Bag<ValuePipe<UnsentMessageIdsView>>()
|
||||
|
||||
@@ -407,6 +410,8 @@ final class ViewTracker {
|
||||
pipe.putNext(view.immutableView())
|
||||
}
|
||||
}
|
||||
|
||||
self.updateTrackedForumTopicListHoles()
|
||||
}
|
||||
|
||||
private func updateTrackedChatListHoles() {
|
||||
@@ -425,6 +430,26 @@ final class ViewTracker {
|
||||
}
|
||||
}
|
||||
|
||||
private func updateTrackedForumTopicListHoles() {
|
||||
var firstHoles = Set<ForumTopicListHolesEntry>()
|
||||
|
||||
for (views) in self.combinedViews.copyItems() {
|
||||
for (key, view) in views.0.views {
|
||||
if case .messageHistoryThreadIndex = key, let view = view as? MutableMessageHistoryThreadIndexView {
|
||||
if let hole = view.topHole() {
|
||||
firstHoles.insert(hole)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if self.forumTopicListHolesView.update(holes: firstHoles) {
|
||||
for pipe in self.forumTopicListHolesViewSubscribers.copyItems() {
|
||||
pipe.putNext(ForumTopicListHolesView(self.forumTopicListHolesView))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func updateTrackedHoles() {
|
||||
var firstHolesAndTags = Set<MessageHistoryHolesViewEntry>()
|
||||
for (view, _) in self.messageHistoryViews.copyItems() {
|
||||
@@ -506,6 +531,30 @@ final class ViewTracker {
|
||||
}
|
||||
}
|
||||
|
||||
func forumTopicListHolesViewSignal() -> Signal<ForumTopicListHolesView, NoError> {
|
||||
return Signal { subscriber in
|
||||
let disposable = MetaDisposable()
|
||||
self.queue.async {
|
||||
subscriber.putNext(ForumTopicListHolesView(self.forumTopicListHolesView))
|
||||
|
||||
let pipe = ValuePipe<ForumTopicListHolesView>()
|
||||
let index = self.forumTopicListHolesViewSubscribers.add(pipe)
|
||||
|
||||
let pipeDisposable = pipe.signal().start(next: { view in
|
||||
subscriber.putNext(view)
|
||||
})
|
||||
|
||||
disposable.set(ActionDisposable {
|
||||
self.queue.async {
|
||||
pipeDisposable.dispose()
|
||||
self.forumTopicListHolesViewSubscribers.remove(index)
|
||||
}
|
||||
})
|
||||
}
|
||||
return disposable
|
||||
}
|
||||
}
|
||||
|
||||
func unsentMessageIdsViewSignal() -> Signal<UnsentMessageIdsView, NoError> {
|
||||
return Signal { subscriber in
|
||||
let disposable = MetaDisposable()
|
||||
|
||||
Reference in New Issue
Block a user