mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Improve profile opening animations
This commit is contained in:
parent
c351a0b2a3
commit
8b645037a6
@ -13004,7 +13004,13 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
} else {
|
} else {
|
||||||
if let peerId = peerId {
|
if let peerId = peerId {
|
||||||
do {
|
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 {
|
switch navigation {
|
||||||
case .info, .default:
|
case .info, .default:
|
||||||
let peerSignal: Signal<Peer?, NoError>
|
let peerSignal: Signal<Peer?, NoError>
|
||||||
@ -13016,8 +13022,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
self.navigationActionDisposable.set((peerSignal |> take(1) |> deliverOnMainQueue).start(next: { [weak self] peer in
|
self.navigationActionDisposable.set((peerSignal |> take(1) |> deliverOnMainQueue).start(next: { [weak self] peer in
|
||||||
if let strongSelf = self, let peer = peer {
|
if let strongSelf = self, let peer = peer {
|
||||||
var mode: PeerInfoControllerMode = .generic
|
var mode: PeerInfoControllerMode = .generic
|
||||||
if let _ = fromMessage {
|
if let _ = fromMessage, let chatPeerId = chatPeerId {
|
||||||
mode = .group(selfPeerId)
|
mode = .group(chatPeerId)
|
||||||
}
|
}
|
||||||
var expandAvatar = expandAvatar
|
var expandAvatar = expandAvatar
|
||||||
if peer.smallProfileImage == nil {
|
if peer.smallProfileImage == nil {
|
||||||
|
@ -590,11 +590,7 @@ func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: Presen
|
|||||||
if availablePanes != nil, groupsInCommon != nil, let cachedData = peerView.cachedData as? CachedUserData {
|
if availablePanes != nil, groupsInCommon != nil, let cachedData = peerView.cachedData as? CachedUserData {
|
||||||
if cachedData.commonGroupCount != 0 {
|
if cachedData.commonGroupCount != 0 {
|
||||||
availablePanes?.append(.groupsInCommon)
|
availablePanes?.append(.groupsInCommon)
|
||||||
} else if hintGroupInCommon != nil {
|
|
||||||
availablePanes?.append(.groupsInCommon)
|
|
||||||
}
|
}
|
||||||
} else if hintGroupInCommon != nil {
|
|
||||||
availablePanes = [.groupsInCommon]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return PeerInfoScreenData(
|
return PeerInfoScreenData(
|
||||||
|
@ -485,6 +485,7 @@ final class PeerInfoPaneContainerNode: ASDisplayNode, UIGestureRecognizerDelegat
|
|||||||
|
|
||||||
private var currentPanes: [PeerInfoPaneKey: PeerInfoPaneWrapper] = [:]
|
private var currentPanes: [PeerInfoPaneKey: PeerInfoPaneWrapper] = [:]
|
||||||
private var pendingPanes: [PeerInfoPaneKey: PeerInfoPendingPane] = [:]
|
private var pendingPanes: [PeerInfoPaneKey: PeerInfoPendingPane] = [:]
|
||||||
|
private var shouldFadeIn = false
|
||||||
|
|
||||||
private var transitionFraction: CGFloat = 0.0
|
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) {
|
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 ?? []
|
let availablePanes = data?.availablePanes ?? []
|
||||||
self.currentAvailablePanes = availablePanes
|
self.currentAvailablePanes = data?.availablePanes
|
||||||
|
|
||||||
|
let previousPaneKeys = Set<PeerInfoPaneKey>(self.currentPanes.keys)
|
||||||
|
|
||||||
let previousCurrentPaneKey = self.currentPaneKey
|
let previousCurrentPaneKey = self.currentPaneKey
|
||||||
var updateCurrentPaneStatus = false
|
var updateCurrentPaneStatus = false
|
||||||
|
|
||||||
if let currentPaneKey = self.currentPaneKey, !availablePanes.contains(currentPaneKey) {
|
if let currentPaneKey = self.currentPaneKey, !availablePanes.contains(currentPaneKey) {
|
||||||
var nextCandidatePaneKey: PeerInfoPaneKey?
|
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() {
|
for i in (0 ... index - 1).reversed() {
|
||||||
if availablePanes.contains(previousAvailablePanes[i]) {
|
if availablePanes.contains(previousAvailablePanes[i]) {
|
||||||
nextCandidatePaneKey = previousAvailablePanes[i]
|
nextCandidatePaneKey = previousAvailablePanes[i]
|
||||||
@ -859,6 +862,18 @@ final class PeerInfoPaneContainerNode: ASDisplayNode, UIGestureRecognizerDelegat
|
|||||||
|
|
||||||
paneDefaultTransition = .immediate
|
paneDefaultTransition = .immediate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let _ = data {
|
||||||
|
if let previousAvailablePanes = previousAvailablePanes, previousAvailablePanes.isEmpty, !availablePanes.isEmpty {
|
||||||
|
self.shouldFadeIn = true
|
||||||
|
}
|
||||||
|
|
||||||
|
let currentPaneKeys = Set<PeerInfoPaneKey>(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 {
|
for (key, pane) in self.currentPanes {
|
||||||
if let index = availablePanes.firstIndex(of: key), let updatedCurrentIndex = updatedCurrentIndex {
|
if let index = availablePanes.firstIndex(of: key), let updatedCurrentIndex = updatedCurrentIndex {
|
||||||
|
@ -2893,7 +2893,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
} else {
|
} 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
|
self.headerNode.displayAvatarContextMenu = { [weak self] node, gesture in
|
||||||
guard let strongSelf = self, let peer = strongSelf.data?.peer else {
|
guard let strongSelf = self, let peer = strongSelf.data?.peer else {
|
||||||
@ -3034,40 +3034,50 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
|||||||
var previousCall: CachedChannelData.ActiveCall?
|
var previousCall: CachedChannelData.ActiveCall?
|
||||||
var currentCall: 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 previousCallsPrivate: Bool?
|
||||||
var currentCallsPrivate: Bool?
|
var currentCallsPrivate: Bool?
|
||||||
var previousVideoCallsAvailable: Bool? = true
|
var previousVideoCallsAvailable: Bool? = true
|
||||||
var currentVideoCallsAvailable: Bool?
|
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
|
previousCallsPrivate = previousCachedData.callsPrivate
|
||||||
currentCallsPrivate = cachedData.callsPrivate
|
currentCallsPrivate = cachedData.callsPrivate
|
||||||
|
|
||||||
previousVideoCallsAvailable = previousCachedData.videoCallsAvailable
|
previousVideoCallsAvailable = previousCachedData.videoCallsAvailable
|
||||||
currentVideoCallsAvailable = cachedData.videoCallsAvailable
|
currentVideoCallsAvailable = cachedData.videoCallsAvailable
|
||||||
|
previousAbout = previousCachedData.about
|
||||||
|
currentAbout = cachedData.about
|
||||||
}
|
}
|
||||||
|
|
||||||
if let previousSuggestPhoneNumberConfirmation = previousData?.globalSettings?.suggestPhoneNumberConfirmation, previousSuggestPhoneNumberConfirmation != data.globalSettings?.suggestPhoneNumberConfirmation {
|
if self.isSettings {
|
||||||
infoUpdated = true
|
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 {
|
if previousCallsPrivate != currentCallsPrivate || (previousVideoCallsAvailable != currentVideoCallsAvailable && currentVideoCallsAvailable != nil) {
|
||||||
infoUpdated = true
|
|
||||||
}
|
|
||||||
if previousCallsPrivate != currentCallsPrivate || previousVideoCallsAvailable != currentVideoCallsAvailable {
|
|
||||||
infoUpdated = true
|
infoUpdated = true
|
||||||
}
|
}
|
||||||
if (previousCall == nil) != (currentCall == nil) {
|
if (previousCall == nil) != (currentCall == nil) {
|
||||||
infoUpdated = true
|
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)
|
self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: self.didSetReady && (membersUpdated || infoUpdated) ? .animated(duration: 0.3, curve: .spring) : .immediate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user