Various Fixes

This commit is contained in:
Ilya Laktyushin 2021-01-25 13:27:50 +03:00
parent c934b92038
commit 3dc9d6ee20
9 changed files with 87 additions and 5 deletions

View File

@ -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) {

View File

@ -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

View File

@ -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

View File

@ -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] = []

View File

@ -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

View File

@ -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?

View File

@ -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?

View File

@ -13,6 +13,8 @@ import ContextUI
protocol PeerInfoPaneNode: ASDisplayNode {
var isReady: Signal<Bool, NoError> { 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

View File

@ -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)