Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin
2022-10-15 17:45:33 +03:00
66 changed files with 1916 additions and 378 deletions

View File

@@ -344,6 +344,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
private let selectAddMemberDisposable = MetaDisposable()
private let addMemberDisposable = MetaDisposable()
private let joinForumDisposable = MetaDisposable()
private let actionDisposables = DisposableSet()
public override func updateNavigationCustomData(_ data: Any?, progress: CGFloat, transition: ContainedViewLayoutTransition) {
if self.isNodeLoaded {
@@ -747,7 +748,9 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
editItem.accessibilityLabel = strongSelf.presentationData.strings.Common_Edit
strongSelf.navigationItem.setRightBarButton(editItem, animated: true)
case .forum:
strongSelf.navigationItem.setRightBarButton(strongSelf.moreBarButtonItem, animated: true)
if strongSelf.navigationItem.rightBarButtonItem !== strongSelf.moreBarButtonItem {
strongSelf.navigationItem.setRightBarButton(strongSelf.moreBarButtonItem, animated: true)
}
}
}
@@ -1174,6 +1177,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
self.selectAddMemberDisposable.dispose()
self.addMemberDisposable.dispose()
self.joinForumDisposable.dispose()
self.actionDisposables.dispose()
}
private func openStatusSetup(sourceView: UIView) {
@@ -1333,6 +1337,18 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
}
strongSelf.deletePeerThread(peerId: peerId, threadId: threadId)
}
self.chatListDisplayNode.containerNode.setPeerThreadStopped = { [weak self] peerId, threadId, isStopped in
guard let strongSelf = self else {
return
}
strongSelf.setPeerThreadStopped(peerId: peerId, threadId: threadId, isStopped: isStopped)
}
self.chatListDisplayNode.containerNode.setPeerThreadPinned = { [weak self] peerId, threadId, isPinned in
guard let strongSelf = self else {
return
}
strongSelf.setPeerThreadPinned(peerId: peerId, threadId: threadId, isPinned: isPinned)
}
self.chatListDisplayNode.containerNode.peerSelected = { [weak self] peer, threadId, animated, activateInput, promoInfo in
if let strongSelf = self {
@@ -3678,6 +3694,14 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
})
}
private func setPeerThreadStopped(peerId: EnginePeer.Id, threadId: Int64, isStopped: Bool) {
self.actionDisposables.add(self.context.engine.peers.setForumChannelTopicClosed(id: peerId, threadId: threadId, isClosed: isStopped).start())
}
private func setPeerThreadPinned(peerId: EnginePeer.Id, threadId: Int64, isPinned: Bool) {
self.actionDisposables.add(self.context.engine.peers.setForumChannelTopicPinned(id: peerId, threadId: threadId, isPinned: isPinned).start())
}
public func maybeAskForPeerChatRemoval(peer: EngineRenderedPeer, joined: Bool = false, deleteGloballyIfPossible: Bool = false, completion: @escaping (Bool) -> Void, removed: @escaping () -> Void) {
guard let chatPeer = peer.peers[peer.peerId], let mainPeer = peer.chatMainPeer else {
completion(false)