Improve navigation stack

This commit is contained in:
Ali 2022-01-28 18:39:32 +04:00
parent 4afd49ee48
commit 7c78cb8230
2 changed files with 13 additions and 1 deletions

View File

@ -14875,7 +14875,9 @@ final class ChatControllerNavigationDataSummary: CustomViewControllerNavigationD
func adding(peerId: PeerId) -> ChatControllerNavigationDataSummary {
var peerIds = self.peerIds
peerIds.removeAll(where: { $0 == peerId })
if let index = peerIds.firstIndex(of: peerId) {
peerIds.removeSubrange(0 ... index)
}
peerIds.insert(peerId, at: 0)
return ChatControllerNavigationDataSummary(peerIds: peerIds)
}

View File

@ -7059,6 +7059,16 @@ public final class PeerInfoScreenImpl: ViewController, PeerInfoScreen {
return self._ready
}
override public var customNavigationData: CustomViewControllerNavigationData? {
get {
if !self.isSettings {
return ChatControllerNavigationData(peerId: self.peerId)
} else {
return nil
}
}
}
private var validLayout: (layout: ContainerViewLayout, navigationHeight: CGFloat)?
public init(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)?, peerId: PeerId, avatarInitiallyExpanded: Bool, isOpenedFromChat: Bool, nearbyPeerDistance: Int32?, callMessages: [Message], isSettings: Bool = false, hintGroupInCommon: PeerId? = nil, requestsContext: PeerInvitationImportersContext? = nil) {