diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index 623811c589..798ec5d101 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -13004,7 +13004,13 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G } else { if let peerId = peerId { do { - let selfPeerId = self.chatLocation.peerId + var chatPeerId: PeerId? + if let peer = self.presentationInterfaceState.renderedPeer?.chatMainPeer as? TelegramGroup { + chatPeerId = peer.id + } else if let peer = self.presentationInterfaceState.renderedPeer?.chatMainPeer as? TelegramChannel, case .group = peer.info, case .member = peer.participationStatus { + chatPeerId = peer.id + } + switch navigation { case .info, .default: let peerSignal: Signal @@ -13016,8 +13022,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G self.navigationActionDisposable.set((peerSignal |> take(1) |> deliverOnMainQueue).start(next: { [weak self] peer in if let strongSelf = self, let peer = peer { var mode: PeerInfoControllerMode = .generic - if let _ = fromMessage { - mode = .group(selfPeerId) + if let _ = fromMessage, let chatPeerId = chatPeerId { + mode = .group(chatPeerId) } var expandAvatar = expandAvatar if peer.smallProfileImage == nil { diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoData.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoData.swift index d1ae497b0f..17eb17eefc 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoData.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoData.swift @@ -590,11 +590,7 @@ func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: Presen if availablePanes != nil, groupsInCommon != nil, let cachedData = peerView.cachedData as? CachedUserData { if cachedData.commonGroupCount != 0 { availablePanes?.append(.groupsInCommon) - } else if hintGroupInCommon != nil { - availablePanes?.append(.groupsInCommon) } - } else if hintGroupInCommon != nil { - availablePanes = [.groupsInCommon] } return PeerInfoScreenData( diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoPaneContainerNode.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoPaneContainerNode.swift index 960de1fea6..7755df9e70 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoPaneContainerNode.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoPaneContainerNode.swift @@ -485,6 +485,7 @@ final class PeerInfoPaneContainerNode: ASDisplayNode, UIGestureRecognizerDelegat private var currentPanes: [PeerInfoPaneKey: PeerInfoPaneWrapper] = [:] private var pendingPanes: [PeerInfoPaneKey: PeerInfoPendingPane] = [:] + private var shouldFadeIn = false private var transitionFraction: CGFloat = 0.0 @@ -690,16 +691,18 @@ final class PeerInfoPaneContainerNode: ASDisplayNode, UIGestureRecognizerDelegat } func update(size: CGSize, sideInset: CGFloat, bottomInset: CGFloat, visibleHeight: CGFloat, expansionFraction: CGFloat, presentationData: PresentationData, data: PeerInfoScreenData?, transition: ContainedViewLayoutTransition) { - let previousAvailablePanes = self.currentAvailablePanes ?? [] + let previousAvailablePanes = self.currentAvailablePanes let availablePanes = data?.availablePanes ?? [] - self.currentAvailablePanes = availablePanes + self.currentAvailablePanes = data?.availablePanes + + let previousPaneKeys = Set(self.currentPanes.keys) let previousCurrentPaneKey = self.currentPaneKey var updateCurrentPaneStatus = false if let currentPaneKey = self.currentPaneKey, !availablePanes.contains(currentPaneKey) { var nextCandidatePaneKey: PeerInfoPaneKey? - if let index = previousAvailablePanes.firstIndex(of: currentPaneKey), index != 0 { + if let previousAvailablePanes = previousAvailablePanes, let index = previousAvailablePanes.firstIndex(of: currentPaneKey), index != 0 { for i in (0 ... index - 1).reversed() { if availablePanes.contains(previousAvailablePanes[i]) { nextCandidatePaneKey = previousAvailablePanes[i] @@ -859,6 +862,18 @@ final class PeerInfoPaneContainerNode: ASDisplayNode, UIGestureRecognizerDelegat paneDefaultTransition = .immediate } + + if let _ = data { + if let previousAvailablePanes = previousAvailablePanes, previousAvailablePanes.isEmpty, !availablePanes.isEmpty { + self.shouldFadeIn = true + } + + let currentPaneKeys = Set(self.currentPanes.keys) + if previousPaneKeys.isEmpty && !currentPaneKeys.isEmpty && self.shouldFadeIn { + self.shouldFadeIn = false + self.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3) + } + } for (key, pane) in self.currentPanes { if let index = availablePanes.firstIndex(of: key), let updatedCurrentIndex = updatedCurrentIndex { diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index 3997fbe970..0ea45a6064 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -2893,7 +2893,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate })) } } else { - screenData = peerInfoScreenData(context: context, peerId: peerId, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, isSettings: self.isSettings, hintGroupInCommon: nil, existingRequestsContext: requestsContext) + screenData = peerInfoScreenData(context: context, peerId: peerId, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, isSettings: self.isSettings, hintGroupInCommon: hintGroupInCommon, existingRequestsContext: requestsContext) self.headerNode.displayAvatarContextMenu = { [weak self] node, gesture in guard let strongSelf = self, let peer = strongSelf.data?.peer else { @@ -3034,40 +3034,50 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate var previousCall: CachedChannelData.ActiveCall? var currentCall: CachedChannelData.ActiveCall? - if let previousCachedData = previousData?.cachedData as? CachedChannelData, let cachedData = data.cachedData as? CachedChannelData { - previousCall = previousCachedData.activeCall - currentCall = cachedData.activeCall - } else if let previousCachedData = previousData?.cachedData as? CachedGroupData, let cachedData = data.cachedData as? CachedGroupData { - previousCall = previousCachedData.activeCall - currentCall = cachedData.activeCall - } - - var previousCallsPrivate: Bool? var currentCallsPrivate: Bool? var previousVideoCallsAvailable: Bool? = true var currentVideoCallsAvailable: Bool? - - if let previousCachedData = previousData?.cachedData as? CachedUserData, let cachedData = data.cachedData as? CachedUserData { + + var previousAbout: String? + var currentAbout: String? + + if let previousCachedData = previousData?.cachedData as? CachedChannelData, let cachedData = data.cachedData as? CachedChannelData { + previousCall = previousCachedData.activeCall + currentCall = cachedData.activeCall + previousAbout = previousCachedData.about + currentAbout = cachedData.about + } else if let previousCachedData = previousData?.cachedData as? CachedGroupData, let cachedData = data.cachedData as? CachedGroupData { + previousCall = previousCachedData.activeCall + currentCall = cachedData.activeCall + previousAbout = previousCachedData.about + currentAbout = cachedData.about + } else if let previousCachedData = previousData?.cachedData as? CachedUserData, let cachedData = data.cachedData as? CachedUserData { previousCallsPrivate = previousCachedData.callsPrivate currentCallsPrivate = cachedData.callsPrivate - previousVideoCallsAvailable = previousCachedData.videoCallsAvailable currentVideoCallsAvailable = cachedData.videoCallsAvailable + previousAbout = previousCachedData.about + currentAbout = cachedData.about } - if let previousSuggestPhoneNumberConfirmation = previousData?.globalSettings?.suggestPhoneNumberConfirmation, previousSuggestPhoneNumberConfirmation != data.globalSettings?.suggestPhoneNumberConfirmation { - infoUpdated = true + if self.isSettings { + if let previousSuggestPhoneNumberConfirmation = previousData?.globalSettings?.suggestPhoneNumberConfirmation, previousSuggestPhoneNumberConfirmation != data.globalSettings?.suggestPhoneNumberConfirmation { + infoUpdated = true + } + if let previousSuggestPasswordConfirmation = previousData?.globalSettings?.suggestPasswordConfirmation, previousSuggestPasswordConfirmation != data.globalSettings?.suggestPasswordConfirmation { + infoUpdated = true + } } - if let previousSuggestPasswordConfirmation = previousData?.globalSettings?.suggestPasswordConfirmation, previousSuggestPasswordConfirmation != data.globalSettings?.suggestPasswordConfirmation { - infoUpdated = true - } - if previousCallsPrivate != currentCallsPrivate || previousVideoCallsAvailable != currentVideoCallsAvailable { + if previousCallsPrivate != currentCallsPrivate || (previousVideoCallsAvailable != currentVideoCallsAvailable && currentVideoCallsAvailable != nil) { infoUpdated = true } if (previousCall == nil) != (currentCall == nil) { infoUpdated = true } + if (previousAbout?.isEmpty ?? true) != (currentAbout?.isEmpty ?? true) { + infoUpdated = true + } self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: self.didSetReady && (membersUpdated || infoUpdated) ? .animated(duration: 0.3, curve: .spring) : .immediate) } }