diff --git a/submodules/ChatListUI/Sources/ChatListController.swift b/submodules/ChatListUI/Sources/ChatListController.swift index 9623840fc5..a5e961741c 100644 --- a/submodules/ChatListUI/Sources/ChatListController.swift +++ b/submodules/ChatListUI/Sources/ChatListController.swift @@ -1089,8 +1089,14 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController self.ready.set(self.chatListDisplayNode.containerNode.ready) self.displayNodeDidLoad() + } + + public override func displayNodeDidLoad() { + super.displayNodeDidLoad() - self.prepareRandomGreetingSticker() + Queue.mainQueue().after(1.0) { + self.prepareRandomGreetingSticker() + } } override public func viewDidAppear(_ animated: Bool) { diff --git a/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift b/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift index 5ce611da18..e0b5e68a3b 100644 --- a/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift +++ b/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift @@ -26,6 +26,7 @@ import GalleryData import AppBundle import ShimmerEffect import ChatListSearchRecentPeersNode +import UndoUI private enum ChatListRecentEntryStableId: Hashable { case topPeers @@ -1750,6 +1751,35 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode { return } strongSelf.context.sharedContext.mediaManager.playlistControl(.setBaseRate(baseRate), type: type) + + if let controller = strongSelf.navigationController?.topViewController as? ViewController { + var hasTooltip = false + controller.forEachController({ controller in + if let controller = controller as? UndoOverlayController { + hasTooltip = true + controller.dismissWithCommitAction() + } + return true + }) + + let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 } + let slowdown = baseRate == .x1 + controller.present( + UndoOverlayController( + presentationData: presentationData, + content: .audioRate( + slowdown: slowdown, + text: slowdown ? presentationData.strings.Conversation_AudioRateTooltipNormal : presentationData.strings.Conversation_AudioRateTooltipSpeedUp + ), + elevatedLayout: false, + animateInAsReplacement: hasTooltip, + action: { action in + return true + } + ), + in: .current + ) + } }) } mediaAccessoryPanel.togglePlayPause = { [weak self] in diff --git a/submodules/TelegramBaseController/Sources/TelegramBaseController.swift b/submodules/TelegramBaseController/Sources/TelegramBaseController.swift index 98cad854e3..830f3fa4c2 100644 --- a/submodules/TelegramBaseController/Sources/TelegramBaseController.swift +++ b/submodules/TelegramBaseController/Sources/TelegramBaseController.swift @@ -691,7 +691,7 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder { let slowdown = baseRate == .x1 strongSelf.present( UndoOverlayController( - presentationData: strongSelf.presentationData, + presentationData: presentationData, content: .audioRate( slowdown: slowdown, text: slowdown ? presentationData.strings.Conversation_AudioRateTooltipNormal : presentationData.strings.Conversation_AudioRateTooltipSpeedUp diff --git a/submodules/TelegramUI/Sources/PeerInfo/Panes/PeerInfoGroupsInCommonPaneNode.swift b/submodules/TelegramUI/Sources/PeerInfo/Panes/PeerInfoGroupsInCommonPaneNode.swift index 54e361b68a..6c6a7ad051 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/Panes/PeerInfoGroupsInCommonPaneNode.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/Panes/PeerInfoGroupsInCommonPaneNode.swift @@ -64,6 +64,8 @@ final class PeerInfoGroupsInCommonPaneNode: ASDisplayNode, PeerInfoPaneNode { private let openPeerContextAction: (Peer, ASDisplayNode, ContextGesture?) -> Void private let groupsInCommonContext: GroupsInCommonContext + weak var parentController: ViewController? + private let listNode: ListView private var state: GroupsInCommonState? private var currentEntries: [GroupsInCommonListEntry] = [] diff --git a/submodules/TelegramUI/Sources/PeerInfo/Panes/PeerInfoListPaneNode.swift b/submodules/TelegramUI/Sources/PeerInfo/Panes/PeerInfoListPaneNode.swift index dee5eafaa8..d90a5a3c1d 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/Panes/PeerInfoListPaneNode.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/Panes/PeerInfoListPaneNode.swift @@ -14,12 +14,15 @@ import UniversalMediaPlayer import TelegramBaseController import OverlayStatusController import ListMessageItem +import UndoUI final class PeerInfoListPaneNode: ASDisplayNode, PeerInfoPaneNode { private let context: AccountContext private let peerId: PeerId private let chatControllerInteraction: ChatControllerInteraction + weak var parentController: ViewController? + private let listNode: ChatHistoryListNode private var currentParams: (size: CGSize, sideInset: CGFloat, bottomInset: CGFloat, visibleHeight: CGFloat, isScrollingLockedAtTop: Bool, expandProgress: CGFloat, presentationData: PresentationData)? @@ -232,6 +235,35 @@ final class PeerInfoListPaneNode: ASDisplayNode, PeerInfoPaneNode { return } strongSelf.context.sharedContext.mediaManager.playlistControl(.setBaseRate(baseRate), type: type) + + if let controller = strongSelf.parentController { + var hasTooltip = false + controller.forEachController({ controller in + if let controller = controller as? UndoOverlayController { + hasTooltip = true + controller.dismissWithCommitAction() + } + return true + }) + + let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 } + let slowdown = baseRate == .x1 + controller.present( + UndoOverlayController( + presentationData: presentationData, + content: .audioRate( + slowdown: slowdown, + text: slowdown ? presentationData.strings.Conversation_AudioRateTooltipNormal : presentationData.strings.Conversation_AudioRateTooltipSpeedUp + ), + elevatedLayout: false, + animateInAsReplacement: hasTooltip, + action: { action in + return true + } + ), + in: .current + ) + } }) } mediaAccessoryPanel.togglePlayPause = { [weak self] in diff --git a/submodules/TelegramUI/Sources/PeerInfo/Panes/PeerInfoMembersPane.swift b/submodules/TelegramUI/Sources/PeerInfo/Panes/PeerInfoMembersPane.swift index 097443f276..9375e5b61c 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/Panes/PeerInfoMembersPane.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/Panes/PeerInfoMembersPane.swift @@ -104,6 +104,8 @@ final class PeerInfoMembersPaneNode: ASDisplayNode, PeerInfoPaneNode { private let membersContext: PeerInfoMembersContext private let action: (PeerInfoMember, PeerMembersListAction) -> Void + weak var parentController: ViewController? + private let listNode: ListView private var currentEntries: [PeerMembersListEntry] = [] private var enclosingPeer: Peer? diff --git a/submodules/TelegramUI/Sources/PeerInfo/Panes/PeerInfoVisualMediaPaneNode.swift b/submodules/TelegramUI/Sources/PeerInfo/Panes/PeerInfoVisualMediaPaneNode.swift index dd3faa9b9e..05fe77e053 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/Panes/PeerInfoVisualMediaPaneNode.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/Panes/PeerInfoVisualMediaPaneNode.swift @@ -764,6 +764,8 @@ final class PeerInfoVisualMediaPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScro private let chatControllerInteraction: ChatControllerInteraction private let contentType: ContentType + weak var parentController: ViewController? + private let scrollNode: ASScrollNode private let floatingHeaderNode: FloatingHeaderNode private var flashHeaderDelayTimer: Foundation.Timer? diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoPaneContainerNode.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoPaneContainerNode.swift index f6f3051656..57857f1ad5 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoPaneContainerNode.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoPaneContainerNode.swift @@ -13,6 +13,8 @@ import ContextUI protocol PeerInfoPaneNode: ASDisplayNode { var isReady: Signal { get } + var parentController: ViewController? { get set } + func update(size: CGSize, sideInset: CGFloat, bottomInset: CGFloat, visibleHeight: CGFloat, isScrollingLockedAtTop: Bool, expandProgress: CGFloat, presentationData: PresentationData, synchronous: Bool, transition: ContainedViewLayoutTransition) func scrollToTop() -> Bool func transferVelocity(_ velocity: CGFloat) @@ -375,7 +377,8 @@ private final class PeerInfoPendingPane { requestPerformPeerMemberAction: @escaping (PeerInfoMember, PeerMembersListAction) -> Void, peerId: PeerId, key: PeerInfoPaneKey, - hasBecomeReady: @escaping (PeerInfoPaneKey) -> Void + hasBecomeReady: @escaping (PeerInfoPaneKey) -> Void, + parentController: ViewController? ) { let paneNode: PeerInfoPaneNode switch key { @@ -402,7 +405,7 @@ private final class PeerInfoPendingPane { preconditionFailure() } } - + paneNode.parentController = parentController self.pane = PeerInfoPaneWrapper(key: key, node: paneNode) self.disposable = (paneNode.isReady |> take(1) @@ -421,6 +424,8 @@ final class PeerInfoPaneContainerNode: ASDisplayNode, UIGestureRecognizerDelegat private let context: AccountContext private let peerId: PeerId + weak var parentController: ViewController? + private let coveringBackgroundNode: ASDisplayNode private let separatorNode: ASDisplayNode private let tabsContainerNode: PeerInfoPaneTabsContainerNode @@ -750,7 +755,8 @@ final class PeerInfoPaneContainerNode: ASDisplayNode, UIGestureRecognizerDelegat if leftScope { apply() } - } + }, + parentController: self.parentController ) self.pendingPanes[key] = pane pane.pane.node.frame = paneFrame diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index 2253f889f8..a0fea1ac74 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -1530,6 +1530,8 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD super.init() + self.paneContainerNode.parentController = controller + self._interaction = PeerInfoInteraction( openUsername: { [weak self] value in self?.openUsername(value: value)