Fix sharing to topics

This commit is contained in:
Ilya Laktyushin
2022-10-23 00:17:15 +03:00
parent 5c9a7b8068
commit 23e6f10a12
7 changed files with 124 additions and 65 deletions

View File

@@ -176,20 +176,23 @@ final class ShareTopicsContainerNode: ASDisplayNode, ShareContentContainerNode {
private var validLayout: (CGSize, CGFloat)?
private var overrideGridOffsetTransition: ContainedViewLayoutTransition?
let peersValue = Promise<[EngineChatList.Item]>()
let topicsValue = Promise<[EngineChatList.Item]>()
var backPressed: () -> Void = {}
init(sharedContext: SharedAccountContext, context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, peer: EnginePeer, topics: [EngineChatList.Item], controllerInteraction: ShareControllerInteraction) {
init(sharedContext: SharedAccountContext, context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, peer: EnginePeer, topics: Signal<EngineChatList, NoError>, controllerInteraction: ShareControllerInteraction) {
self.sharedContext = sharedContext
self.context = context
self.theme = theme
self.strings = strings
self.controllerInteraction = controllerInteraction
self.peersValue.set(.single(topics))
self.topicsValue.set(topics
|> map {
return $0.items
})
let items: Signal<[ShareTopicEntry], NoError> = self.peersValue.get()
let items: Signal<[ShareTopicEntry], NoError> = self.topicsValue.get()
|> map { topics -> [ShareTopicEntry] in
var entries: [ShareTopicEntry] = []
var index: Int32 = 0