Saved messages view as chats

This commit is contained in:
Isaac
2024-01-28 18:59:00 +01:00
parent ea9c9ae777
commit 4bd4884887
33 changed files with 421 additions and 106 deletions

View File

@@ -122,6 +122,7 @@ import WallpaperGalleryScreen
import WallpaperGridScreen
import VideoMessageCameraScreen
import TopMessageReactions
import PeerInfoScreen
public enum ChatControllerPeekActions {
case standard
@@ -267,6 +268,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
var chatTitleView: ChatTitleView?
var leftNavigationButton: ChatNavigationButton?
var rightNavigationButton: ChatNavigationButton?
var secondaryRightNavigationButton: ChatNavigationButton?
var chatInfoNavigationButton: ChatNavigationButton?
var moreBarButton: MoreHeaderButton
@@ -4725,13 +4727,18 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
self.moreBarButton.setContent(.more(MoreHeaderButton.optionsCircleImage(color: self.presentationData.theme.rootController.navigationBar.buttonColor)))
self.moreInfoNavigationButton = ChatNavigationButton(action: .toggleInfoPanel, buttonItem: UIBarButtonItem(customDisplayNode: self.moreBarButton)!)
self.moreBarButton.contextAction = { [weak self] sourceNode, gesture in
guard let self = self else {
guard let self else {
return
}
guard case let .peer(peerId) = self.chatLocation else {
return
}
ChatListControllerImpl.openMoreMenu(context: self.context, peerId: peerId, sourceController: self, isViewingAsTopics: false, sourceView: sourceNode.view, gesture: gesture)
if peerId == self.context.account.peerId {
PeerInfoScreenImpl.openSavedMessagesMoreMenu(context: self.context, sourceController: self, isViewingAsTopics: false, sourceView: sourceNode.view, gesture: gesture)
} else {
ChatListControllerImpl.openMoreMenu(context: self.context, peerId: peerId, sourceController: self, isViewingAsTopics: false, sourceView: sourceNode.view, gesture: gesture)
}
}
self.moreBarButton.addTarget(self, action: #selector(self.moreButtonPressed), forControlEvents: .touchUpInside)
@@ -12087,6 +12094,12 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
}
@objc func secondaryRightNavigationButtonAction() {
if let button = self.secondaryRightNavigationButton {
self.navigationButtonAction(button.action)
}
}
@objc func moreButtonPressed() {
self.moreBarButton.play()
self.moreBarButton.contextAction?(self.moreBarButton.containerNode, nil)