Various improvements

This commit is contained in:
Ilya Laktyushin 2022-10-19 00:34:56 +03:00
parent 3d5218b3f6
commit 22fae501e6
4 changed files with 10 additions and 9 deletions

View File

@ -186,7 +186,7 @@ public final class SelectablePeerNode: ASDisplayNode {
if let fileId = iconId { if let fileId = iconId {
iconContent = .animation(content: .customEmoji(fileId: fileId), size: CGSize(width: 18.0, height: 18.0), placeholderColor: theme.actionSheet.disabledActionTextColor, themeColor: theme.actionSheet.primaryTextColor, loopMode: .count(2)) iconContent = .animation(content: .customEmoji(fileId: fileId), size: CGSize(width: 18.0, height: 18.0), placeholderColor: theme.actionSheet.disabledActionTextColor, themeColor: theme.actionSheet.primaryTextColor, loopMode: .count(2))
} else if let customTitle = customTitle { } else if let customTitle = customTitle {
iconContent = .topic(title: String(customTitle.prefix(1)), color: iconColor ?? 0, size: CGSize(width: 18.0, height: 18.0)) iconContent = .topic(title: String(customTitle.prefix(1)), color: iconColor ?? 0, size: CGSize(width: 32.0, height: 32.0))
} else { } else {
iconContent = nil iconContent = nil
} }

View File

@ -298,13 +298,14 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
} }
}, selectTopic: { [weak self] peer, threadId, threadData in }, selectTopic: { [weak self] peer, threadId, threadData in
if let strongSelf = self { if let strongSelf = self {
strongSelf.controllerInteraction?.selectedPeerIds.insert(peer) strongSelf.controllerInteraction?.selectedPeers.append(peer)
strongSelf.controllerInteraction?.selectedTopics[peer] = (threadId, threadData) strongSelf.controllerInteraction?.selectedPeerIds.insert(peer.peerId)
strongSelf.controllerInteraction?.selectedTopics[peer.peerId] = (threadId, threadData)
strongSelf.peersContentNode?.update() strongSelf.peersContentNode?.update()
strongSelf.peersContentNode?.updateSelectedPeers(animated: false) strongSelf.peersContentNode?.updateSelectedPeers(animated: false)
strongSelf.updateButton() strongSelf.updateButton()
Queue.mainQueue().after(0.01, { Queue.mainQueue().after(0.01, {
strongSelf.closePeerTopics(peer) strongSelf.closePeerTopics(peer.peerId)
}) })
} }
}) })
@ -1063,7 +1064,7 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
} }
private func updateButton() { private func updateButton() {
let count = self.controllerInteraction!.selectedPeerIds.count let count = self.controllerInteraction!.selectedPeers.count
if count == 0 { if count == 0 {
if self.presetText != nil { if self.presetText != nil {
self.actionButtonNode.setTitle(self.presentationData.strings.ShareMenu_Send, with: Font.medium(20.0), with: self.presentationData.theme.actionSheet.disabledActionTextColor, for: .normal) self.actionButtonNode.setTitle(self.presentationData.strings.ShareMenu_Send, with: Font.medium(20.0), with: self.presentationData.theme.actionSheet.disabledActionTextColor, for: .normal)

View File

@ -20,9 +20,9 @@ final class ShareControllerInteraction {
var selectedTopics: [EnginePeer.Id: (Int64, MessageHistoryThreadData)] = [:] var selectedTopics: [EnginePeer.Id: (Int64, MessageHistoryThreadData)] = [:]
let togglePeer: (EngineRenderedPeer, Bool) -> Void let togglePeer: (EngineRenderedPeer, Bool) -> Void
let selectTopic: (EnginePeer.Id, Int64, MessageHistoryThreadData) -> Void let selectTopic: (EngineRenderedPeer, Int64, MessageHistoryThreadData) -> Void
init(togglePeer: @escaping (EngineRenderedPeer, Bool) -> Void, selectTopic: @escaping (EnginePeer.Id, Int64, MessageHistoryThreadData) -> Void) { init(togglePeer: @escaping (EngineRenderedPeer, Bool) -> Void, selectTopic: @escaping (EngineRenderedPeer, Int64, MessageHistoryThreadData) -> Void) {
self.togglePeer = togglePeer self.togglePeer = togglePeer
self.selectTopic = selectTopic self.selectTopic = selectTopic
} }

View File

@ -76,8 +76,8 @@ final class ShareTopicGridItemNode: GridItemNode {
} }
@objc private func tapped() { @objc private func tapped() {
if let item = self.currentItem, let peerId = item.peer?.peerId { if let item = self.currentItem, let peer = item.peer {
item.controllerInteraction.selectTopic(peerId, item.id, item.threadInfo) item.controllerInteraction.selectTopic(peer, item.id, item.threadInfo)
} }
} }