Various improvements

This commit is contained in:
Ilya Laktyushin
2024-09-03 18:26:47 +04:00
parent 7e57a166dc
commit 3cdfb2031d
5 changed files with 36 additions and 6 deletions

View File

@@ -567,6 +567,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
var scheduledScrollToMessageId: (MessageId, NavigateToMessageParams)?
public var purposefulAction: (() -> Void)?
public var dismissPreviewing: (() -> Void)?
var updatedClosedPinnedMessageId: ((MessageId) -> Void)?
var requestedUnpinAllMessages: ((Int, MessageId) -> Void)?
@@ -4653,7 +4655,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
self.navigationItem.titleView = self.chatTitleView
self.chatTitleView?.longPressed = { [weak self] in
if let strongSelf = self, let peerView = strongSelf.peerView, let peer = peerView.peers[peerView.peerId], peer.restrictionText(platform: "ios", contentSettings: strongSelf.context.currentContentSettings.with { $0 }) == nil && !strongSelf.presentationInterfaceState.isNotAccessible {
strongSelf.interfaceInteraction?.beginMessageSearch(.everything, "")
if case .standard(.previewing) = strongSelf.mode {
} else {
strongSelf.interfaceInteraction?.beginMessageSearch(.everything, "")
}
}
}
@@ -5414,7 +5419,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
imageOverride = nil
}
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.setPeer(context: strongSelf.context, theme: strongSelf.presentationData.theme, peer: EnginePeer(peer), overrideImage: imageOverride)
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.contextActionIsEnabled = peer.restrictionText(platform: "ios", contentSettings: strongSelf.context.currentContentSettings.with { $0 }) == nil
if case .standard(.previewing) = strongSelf.mode {
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.contextActionIsEnabled = false
} else {
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.contextActionIsEnabled = peer.restrictionText(platform: "ios", contentSettings: strongSelf.context.currentContentSettings.with { $0 }) == nil
}
strongSelf.chatInfoNavigationButton?.buttonItem.accessibilityLabel = presentationInterfaceState.strings.Conversation_ContextMenuOpenProfile
strongSelf.storyStats = peerView.storyStats
@@ -6304,7 +6313,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
if strongSelf.isNodeLoaded {
strongSelf.chatDisplayNode.overlayTitle = strongSelf.overlayTitle
}
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.contextActionIsEnabled = true
if case .standard(.previewing) = strongSelf.mode {
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.contextActionIsEnabled = false
} else {
(strongSelf.chatInfoNavigationButton?.buttonItem.customDisplayNode as? ChatAvatarNavigationNode)?.contextActionIsEnabled = true
}
var peerDiscussionId: PeerId?
var peerGeoLocation: PeerGeoLocation?
@@ -8368,7 +8381,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
@objc func rightNavigationButtonAction() {
if let button = self.rightNavigationButton {
if case let .peer(peerId) = self.chatLocation, case .openChatInfo(expandAvatar: true, _) = button.action, let storyStats = self.storyStats, storyStats.unseenCount != 0, let avatarNode = self.avatarNode {
if case .standard(.previewing) = self.mode {
self.navigationButtonAction(button.action)
} else if case let .peer(peerId) = self.chatLocation, case .openChatInfo(expandAvatar: true, _) = button.action, let storyStats = self.storyStats, storyStats.unseenCount != 0, let avatarNode = self.avatarNode {
self.openStories(peerId: peerId, avatarHeaderNode: nil, avatarNode: avatarNode.avatarNode)
} else {
self.navigationButtonAction(button.action)