Postbox -> TelegramEngine wave 45
PeerInfoHeader* update(peer:) bundle: Peer? -> EnginePeer?. Four update methods across PeerInfoHeaderNode, PeerInfoHeaderEditingContentNode, PeerInfoEditingAvatarNode, PeerInfoEditingAvatarOverlayNode. Drops wave-43 ADD-WRAP bridges (net ~-11 wraps). Stored PeerInfoHeaderNode.peer: Peer? field stays raw (out of scope). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
de21dedbe3
commit
6b7a23867c
5 changed files with 41 additions and 41 deletions
|
|
@ -58,12 +58,12 @@ final class PeerInfoEditingAvatarNode: ASDisplayNode {
|
|||
}
|
||||
|
||||
var removedPhotoResourceIds = Set<String>()
|
||||
func update(peer: Peer?, threadData: MessageHistoryThreadData?, chatLocation: ChatLocation, item: PeerInfoAvatarListItem?, updatingAvatar: PeerInfoUpdatingAvatar?, uploadProgress: AvatarUploadProgress?, theme: PresentationTheme, avatarSize: CGFloat, isEditing: Bool) {
|
||||
func update(peer: EnginePeer?, threadData: MessageHistoryThreadData?, chatLocation: ChatLocation, item: PeerInfoAvatarListItem?, updatingAvatar: PeerInfoUpdatingAvatar?, uploadProgress: AvatarUploadProgress?, theme: PresentationTheme, avatarSize: CGFloat, isEditing: Bool) {
|
||||
guard let peer = peer else {
|
||||
return
|
||||
}
|
||||
|
||||
let canEdit = canEditPeerInfo(context: self.context, peer: EnginePeer(peer), chatLocation: chatLocation, threadData: threadData)
|
||||
let canEdit = canEditPeerInfo(context: self.context, peer: peer, chatLocation: chatLocation, threadData: threadData)
|
||||
|
||||
let previousItem = self.item
|
||||
var item = item
|
||||
|
|
@ -85,12 +85,12 @@ final class PeerInfoEditingAvatarNode: ASDisplayNode {
|
|||
overrideImage = item == nil && canEdit ? .editAvatarIcon(forceNone: true) : nil
|
||||
}
|
||||
self.avatarNode.font = avatarPlaceholderFont(size: floor(avatarSize * 16.0 / 37.0))
|
||||
self.avatarNode.setPeer(context: self.context, theme: theme, peer: EnginePeer(peer), overrideImage: overrideImage, clipStyle: .none, synchronousLoad: false, displayDimensions: CGSize(width: avatarSize, height: avatarSize))
|
||||
self.avatarNode.setPeer(context: self.context, theme: theme, peer: peer, overrideImage: overrideImage, clipStyle: .none, synchronousLoad: false, displayDimensions: CGSize(width: avatarSize, height: avatarSize))
|
||||
self.avatarNode.frame = CGRect(origin: CGPoint(x: -avatarSize / 2.0, y: -avatarSize / 2.0), size: CGSize(width: avatarSize, height: avatarSize))
|
||||
|
||||
var isForum = false
|
||||
let avatarCornerRadius: CGFloat
|
||||
if let channel = peer as? TelegramChannel, channel.isForumOrMonoForum {
|
||||
if case let .channel(channel) = peer, channel.isForumOrMonoForum {
|
||||
isForum = true
|
||||
avatarCornerRadius = floor(avatarSize * 0.25)
|
||||
} else {
|
||||
|
|
@ -156,14 +156,14 @@ final class PeerInfoEditingAvatarNode: ASDisplayNode {
|
|||
}
|
||||
markupNode.update(markup: markup, size: CGSize(width: 320.0, height: 320.0))
|
||||
markupNode.updateVisibility(true)
|
||||
} else if threadData == nil, let video = videoRepresentations.last, let peerReference = PeerReference(peer) {
|
||||
} else if threadData == nil, let video = videoRepresentations.last, let peerReference = PeerReference(peer._asPeer()) {
|
||||
if let markupNode = self.markupNode {
|
||||
self.markupNode = nil
|
||||
markupNode.removeFromSupernode()
|
||||
}
|
||||
|
||||
let videoFileReference = FileMediaReference.avatarList(peer: peerReference, media: TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: 0), partialReference: nil, resource: video.representation.resource, previewRepresentations: representations.map { $0.representation }, videoThumbnails: [], immediateThumbnailData: immediateThumbnailData, mimeType: "video/mp4", size: nil, attributes: [.Animated, .Video(duration: 0, size: video.representation.dimensions, flags: [], preloadSize: nil, coverTime: nil, videoCodec: nil)], alternativeRepresentations: []))
|
||||
let videoContent = NativeVideoContent(id: .profileVideo(videoId, nil), userLocation: .other, fileReference: videoFileReference, streamVideo: isMediaStreamable(resource: video.representation.resource) ? .conservative : .none, loopVideo: true, enableSound: false, fetchAutomatically: true, onlyFullSizeThumbnail: false, useLargeThumbnail: true, autoFetchFullSizeThumbnail: true, startTimestamp: video.representation.startTimestamp, continuePlayingWithoutSoundOnLostAudioSession: false, placeholderColor: .clear, captureProtected: peer.isCopyProtectionEnabled, storeAfterDownload: nil)
|
||||
let videoContent = NativeVideoContent(id: .profileVideo(videoId, nil), userLocation: .other, fileReference: videoFileReference, streamVideo: isMediaStreamable(resource: video.representation.resource) ? .conservative : .none, loopVideo: true, enableSound: false, fetchAutomatically: true, onlyFullSizeThumbnail: false, useLargeThumbnail: true, autoFetchFullSizeThumbnail: true, startTimestamp: video.representation.startTimestamp, continuePlayingWithoutSoundOnLostAudioSession: false, placeholderColor: .clear, captureProtected: peer._asPeer().isCopyProtectionEnabled, storeAfterDownload: nil)
|
||||
if videoContent.id != self.videoContent?.id {
|
||||
self.videoNode?.removeFromSupernode()
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ final class PeerInfoEditingAvatarOverlayNode: ASDisplayNode {
|
|||
transition.updateAlpha(node: self, alpha: 1.0 - fraction)
|
||||
}
|
||||
|
||||
func update(peer: Peer?, threadData: MessageHistoryThreadData?, chatLocation: ChatLocation, item: PeerInfoAvatarListItem?, updatingAvatar: PeerInfoUpdatingAvatar?, uploadProgress: AvatarUploadProgress?, theme: PresentationTheme, avatarSize: CGFloat, isEditing: Bool) {
|
||||
func update(peer: EnginePeer?, threadData: MessageHistoryThreadData?, chatLocation: ChatLocation, item: PeerInfoAvatarListItem?, updatingAvatar: PeerInfoUpdatingAvatar?, uploadProgress: AvatarUploadProgress?, theme: PresentationTheme, avatarSize: CGFloat, isEditing: Bool) {
|
||||
guard let peer = peer else {
|
||||
return
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@ final class PeerInfoEditingAvatarOverlayNode: ASDisplayNode {
|
|||
let transition = ContainedViewLayoutTransition.animated(duration: 0.2, curve: .linear)
|
||||
|
||||
let clipStyle: AvatarNodeClipStyle
|
||||
if let channel = peer as? TelegramChannel, channel.isForumOrMonoForum {
|
||||
if case let .channel(channel) = peer, channel.isForumOrMonoForum {
|
||||
clipStyle = .roundedRect
|
||||
} else {
|
||||
clipStyle = .round
|
||||
|
|
@ -82,7 +82,7 @@ final class PeerInfoEditingAvatarOverlayNode: ASDisplayNode {
|
|||
isPersonal = true
|
||||
}
|
||||
|
||||
if canEditPeerInfo(context: self.context, peer: EnginePeer(peer), chatLocation: chatLocation, threadData: threadData)
|
||||
if canEditPeerInfo(context: self.context, peer: peer, chatLocation: chatLocation, threadData: threadData)
|
||||
|| isPersonal
|
||||
|| self.currentRepresentation != nil && updatingAvatar == nil {
|
||||
var overlayHidden = true
|
||||
|
|
|
|||
|
|
@ -49,14 +49,14 @@ final class PeerInfoHeaderEditingContentNode: ASDisplayNode {
|
|||
self.itemNodes[key]?.layer.addShakeAnimation()
|
||||
}
|
||||
|
||||
func update(width: CGFloat, safeInset: CGFloat, statusBarHeight: CGFloat, navigationHeight: CGFloat, isModalOverlay: Bool, peer: Peer?, threadData: MessageHistoryThreadData?, chatLocation: ChatLocation, cachedData: CachedPeerData?, isContact: Bool, isSettings: Bool, presentationData: PresentationData, transition: ContainedViewLayoutTransition) -> CGFloat {
|
||||
func update(width: CGFloat, safeInset: CGFloat, statusBarHeight: CGFloat, navigationHeight: CGFloat, isModalOverlay: Bool, peer: EnginePeer?, threadData: MessageHistoryThreadData?, chatLocation: ChatLocation, cachedData: CachedPeerData?, isContact: Bool, isSettings: Bool, presentationData: PresentationData, transition: ContainedViewLayoutTransition) -> CGFloat {
|
||||
let avatarSize: CGFloat = isModalOverlay ? 200.0 : 100.0
|
||||
let avatarFrame = CGRect(origin: CGPoint(x: floor((width - avatarSize) / 2.0), y: statusBarHeight + 22.0), size: CGSize(width: avatarSize, height: avatarSize))
|
||||
transition.updateFrameAdditiveToCenter(node: self.avatarNode, frame: CGRect(origin: avatarFrame.center, size: CGSize()))
|
||||
|
||||
var contentHeight: CGFloat = statusBarHeight + 10.0 + avatarSize + 28.0
|
||||
|
||||
if canEditPeerInfo(context: self.context, peer: peer.flatMap(EnginePeer.init), chatLocation: chatLocation, threadData: threadData) {
|
||||
if canEditPeerInfo(context: self.context, peer: peer, chatLocation: chatLocation, threadData: threadData) {
|
||||
if self.avatarButtonNode.supernode == nil {
|
||||
self.addSubnode(self.avatarButtonNode)
|
||||
}
|
||||
|
|
@ -70,11 +70,11 @@ final class PeerInfoHeaderEditingContentNode: ASDisplayNode {
|
|||
}
|
||||
|
||||
var isEditableBot = false
|
||||
if let user = peer as? TelegramUser, let botInfo = user.botInfo, botInfo.flags.contains(.canEdit) {
|
||||
if case let .user(user) = peer, let botInfo = user.botInfo, botInfo.flags.contains(.canEdit) {
|
||||
isEditableBot = true
|
||||
}
|
||||
var fieldKeys: [PeerInfoHeaderTextFieldNodeKey] = []
|
||||
if let user = peer as? TelegramUser {
|
||||
if case let .user(user) = peer {
|
||||
if !user.isDeleted {
|
||||
fieldKeys.append(.firstName)
|
||||
if isEditableBot {
|
||||
|
|
@ -83,14 +83,14 @@ final class PeerInfoHeaderEditingContentNode: ASDisplayNode {
|
|||
fieldKeys.append(.lastName)
|
||||
}
|
||||
}
|
||||
} else if let _ = peer as? TelegramGroup {
|
||||
} else if case .legacyGroup = peer {
|
||||
fieldKeys.append(.title)
|
||||
if canEditPeerInfo(context: self.context, peer: peer.flatMap(EnginePeer.init), chatLocation: chatLocation, threadData: threadData) {
|
||||
if canEditPeerInfo(context: self.context, peer: peer, chatLocation: chatLocation, threadData: threadData) {
|
||||
fieldKeys.append(.description)
|
||||
}
|
||||
} else if let _ = peer as? TelegramChannel {
|
||||
} else if case .channel = peer {
|
||||
fieldKeys.append(.title)
|
||||
if canEditPeerInfo(context: self.context, peer: peer.flatMap(EnginePeer.init), chatLocation: chatLocation, threadData: threadData) {
|
||||
if canEditPeerInfo(context: self.context, peer: peer, chatLocation: chatLocation, threadData: threadData) {
|
||||
fieldKeys.append(.description)
|
||||
}
|
||||
}
|
||||
|
|
@ -104,15 +104,15 @@ final class PeerInfoHeaderEditingContentNode: ASDisplayNode {
|
|||
var isMultiline = false
|
||||
switch key {
|
||||
case .firstName:
|
||||
if let peer = peer as? TelegramUser {
|
||||
if case let .user(user) = peer {
|
||||
if let editableBotInfo = (cachedData as? CachedUserData)?.editableBotInfo {
|
||||
updateText = editableBotInfo.name
|
||||
} else {
|
||||
updateText = peer.firstName ?? ""
|
||||
updateText = user.firstName ?? ""
|
||||
}
|
||||
}
|
||||
case .lastName:
|
||||
updateText = (peer as? TelegramUser)?.lastName ?? ""
|
||||
updateText = (peer?._asPeer() as? TelegramUser)?.lastName ?? ""
|
||||
case .title:
|
||||
updateText = peer?.debugDisplayTitle ?? ""
|
||||
case .description:
|
||||
|
|
@ -151,15 +151,15 @@ final class PeerInfoHeaderEditingContentNode: ASDisplayNode {
|
|||
placeholder = presentationData.strings.UserInfo_LastNamePlaceholder
|
||||
isEnabled = isContact || isSettings
|
||||
case .title:
|
||||
if let channel = peer as? TelegramChannel, case .broadcast = channel.info {
|
||||
if case let .channel(channel) = peer, case .broadcast = channel.info {
|
||||
placeholder = presentationData.strings.GroupInfo_ChannelListNamePlaceholder
|
||||
} else {
|
||||
placeholder = presentationData.strings.GroupInfo_GroupNamePlaceholder
|
||||
}
|
||||
isEnabled = canEditPeerInfo(context: self.context, peer: peer.flatMap(EnginePeer.init), chatLocation: chatLocation, threadData: threadData)
|
||||
isEnabled = canEditPeerInfo(context: self.context, peer: peer, chatLocation: chatLocation, threadData: threadData)
|
||||
case .description:
|
||||
placeholder = presentationData.strings.Channel_Edit_AboutItem
|
||||
isEnabled = canEditPeerInfo(context: self.context, peer: peer.flatMap(EnginePeer.init), chatLocation: chatLocation, threadData: threadData) || isEditableBot
|
||||
isEnabled = canEditPeerInfo(context: self.context, peer: peer, chatLocation: chatLocation, threadData: threadData) || isEditableBot
|
||||
}
|
||||
let itemHeight = itemNode.update(width: width, safeInset: safeInset, isSettings: isSettings, hasPrevious: hasPrevious, hasNext: key != fieldKeys.last, placeholder: placeholder, isEnabled: isEnabled, presentationData: presentationData, updateText: updateText)
|
||||
transition.updateFrame(node: itemNode, frame: CGRect(origin: CGPoint(x: 0.0, y: contentHeight), size: CGSize(width: width, height: itemHeight)))
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||
guard let strongSelf = self, let state = strongSelf.state, let peer = strongSelf.peer, let presentationData = strongSelf.presentationData, let avatarSize = strongSelf.avatarSize else {
|
||||
return
|
||||
}
|
||||
strongSelf.editingContentNode.avatarNode.update(peer: peer, threadData: strongSelf.threadData, chatLocation: chatLocation, item: strongSelf.avatarListNode.item, updatingAvatar: state.updatingAvatar, uploadProgress: state.avatarUploadProgress, theme: presentationData.theme, avatarSize: avatarSize, isEditing: state.isEditing)
|
||||
strongSelf.editingContentNode.avatarNode.update(peer: EnginePeer(peer), threadData: strongSelf.threadData, chatLocation: chatLocation, item: strongSelf.avatarListNode.item, updatingAvatar: state.updatingAvatar, uploadProgress: state.avatarUploadProgress, theme: presentationData.theme, avatarSize: avatarSize, isEditing: state.isEditing)
|
||||
}
|
||||
|
||||
self.avatarListNode.animateOverlaysFadeIn = { [weak self] in
|
||||
|
|
@ -493,7 +493,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||
private var currentStatusIcon: CredibilityIcon?
|
||||
|
||||
private var currentPanelStatusData: PeerInfoStatusData?
|
||||
func update(width: CGFloat, containerHeight: CGFloat, containerInset: CGFloat, statusBarHeight: CGFloat, navigationHeight: CGFloat, isModalOverlay: Bool, isMediaOnly: Bool, contentOffset: CGFloat, paneContainerY: CGFloat, presentationData: PresentationData, peer: Peer?, cachedData: CachedPeerData?, threadData: MessageHistoryThreadData?, peerNotificationSettings: TelegramPeerNotificationSettings?, threadNotificationSettings: TelegramPeerNotificationSettings?, globalNotificationSettings: EngineGlobalNotificationSettings?, statusData: PeerInfoStatusData?, panelStatusData: (PeerInfoStatusData?, PeerInfoStatusData?, CGFloat?), isSecretChat: Bool, isContact: Bool, isSettings: Bool, state: PeerInfoState, profileGiftsContext: ProfileGiftsContext?, screenData: PeerInfoScreenData?, isSearching: Bool, metrics: LayoutMetrics, deviceMetrics: DeviceMetrics, transition: ContainedViewLayoutTransition, additive: Bool, animateHeader: Bool) -> CGFloat {
|
||||
func update(width: CGFloat, containerHeight: CGFloat, containerInset: CGFloat, statusBarHeight: CGFloat, navigationHeight: CGFloat, isModalOverlay: Bool, isMediaOnly: Bool, contentOffset: CGFloat, paneContainerY: CGFloat, presentationData: PresentationData, peer: EnginePeer?, cachedData: CachedPeerData?, threadData: MessageHistoryThreadData?, peerNotificationSettings: TelegramPeerNotificationSettings?, threadNotificationSettings: TelegramPeerNotificationSettings?, globalNotificationSettings: EngineGlobalNotificationSettings?, statusData: PeerInfoStatusData?, panelStatusData: (PeerInfoStatusData?, PeerInfoStatusData?, CGFloat?), isSecretChat: Bool, isContact: Bool, isSettings: Bool, state: PeerInfoState, profileGiftsContext: ProfileGiftsContext?, screenData: PeerInfoScreenData?, isSearching: Bool, metrics: LayoutMetrics, deviceMetrics: DeviceMetrics, transition: ContainedViewLayoutTransition, additive: Bool, animateHeader: Bool) -> CGFloat {
|
||||
if self.appliedCustomNavigationContentNode !== self.customNavigationContentNode {
|
||||
if let previous = self.appliedCustomNavigationContentNode {
|
||||
ComponentTransition(transition).setAlpha(view: previous.view, alpha: 0.0, completion: { [weak previous] _ in
|
||||
|
|
@ -518,10 +518,10 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||
}
|
||||
|
||||
self.state = state
|
||||
self.peer = peer
|
||||
self.peer = peer?._asPeer()
|
||||
self.threadData = threadData
|
||||
self.isSearching = isSearching
|
||||
self.avatarListNode.listContainerNode.peer = peer.flatMap(EnginePeer.init)
|
||||
self.avatarListNode.listContainerNode.peer = peer
|
||||
|
||||
let isFirstTime = self.validLayout == nil
|
||||
self.validLayout = (width, statusBarHeight, deviceMetrics)
|
||||
|
|
@ -545,8 +545,8 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||
}
|
||||
}
|
||||
|
||||
let actionButtonKeys: [PeerInfoHeaderButtonKey] = (self.isSettings || self.isMyProfile) ? [] : peerInfoHeaderActionButtons(peer: peer.flatMap(EnginePeer.init), isSecretChat: isSecretChat, isContact: isContact)
|
||||
let buttonKeys: [PeerInfoHeaderButtonKey] = (self.isSettings || self.isMyProfile) ? [] : peerInfoHeaderButtons(peer: peer.flatMap(EnginePeer.init), cachedData: cachedData, isOpenedFromChat: self.isOpenedFromChat, isExpanded: true, videoCallsEnabled: width > 320.0 && self.videoCallsEnabled, isSecretChat: isSecretChat, isContact: isContact, threadInfo: threadData?.info)
|
||||
let actionButtonKeys: [PeerInfoHeaderButtonKey] = (self.isSettings || self.isMyProfile) ? [] : peerInfoHeaderActionButtons(peer: peer, isSecretChat: isSecretChat, isContact: isContact)
|
||||
let buttonKeys: [PeerInfoHeaderButtonKey] = (self.isSettings || self.isMyProfile) ? [] : peerInfoHeaderButtons(peer: peer, cachedData: cachedData, isOpenedFromChat: self.isOpenedFromChat, isExpanded: true, videoCallsEnabled: width > 320.0 && self.videoCallsEnabled, isSecretChat: isSecretChat, isContact: isContact, threadInfo: threadData?.info)
|
||||
|
||||
let backgroundCoverSubject: PeerInfoCoverComponent.Subject?
|
||||
var backgroundCoverAnimateIn = false
|
||||
|
|
@ -568,7 +568,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||
}
|
||||
hasBackground = true
|
||||
} else if let peer {
|
||||
backgroundCoverSubject = .peer(EnginePeer(peer))
|
||||
backgroundCoverSubject = .peer(peer)
|
||||
if peer.effectiveProfileColor != nil {
|
||||
hasBackground = true
|
||||
}
|
||||
|
|
@ -619,7 +619,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||
}
|
||||
|
||||
var isForum = false
|
||||
if let channel = peer as? TelegramChannel, channel.isForumOrMonoForum {
|
||||
if case let .channel(channel) = peer, channel.isForumOrMonoForum {
|
||||
isForum = true
|
||||
}
|
||||
|
||||
|
|
@ -1215,14 +1215,14 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||
} else if let threadData = threadData {
|
||||
title = threadData.info.title
|
||||
} else {
|
||||
title = EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
title = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
}
|
||||
title = title.replacingOccurrences(of: "\u{1160}", with: "").replacingOccurrences(of: "\u{3164}", with: "")
|
||||
if title.replacingOccurrences(of: "\u{fe0e}", with: "").trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||||
title = "" //"\u{00A0}"
|
||||
}
|
||||
if title.isEmpty {
|
||||
if let peer = peer as? TelegramUser, let phone = peer.phone {
|
||||
if case let .user(user) = peer, let phone = user.phone {
|
||||
title = formatPhoneNumber(context: self.context, number: phone)
|
||||
} else if let addressName = peer.addressName {
|
||||
title = "@\(addressName)"
|
||||
|
|
@ -1235,7 +1235,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||
titleAttributes = MultiScaleTextState.Attributes(font: Font.medium(28.0), color: .white)
|
||||
smallTitleAttributes = MultiScaleTextState.Attributes(font: Font.medium(28.0), color: .white, shadowColor: titleShadowColor)
|
||||
|
||||
if self.isSettings, let user = peer as? TelegramUser {
|
||||
if self.isSettings, case let .user(user) = peer {
|
||||
var subtitle = formatPhoneNumber(context: self.context, number: user.phone ?? "")
|
||||
|
||||
if let mainUsername = user.addressName, !mainUsername.isEmpty {
|
||||
|
|
@ -1270,7 +1270,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||
let subtitleColor: UIColor = .white
|
||||
|
||||
let statusText: String
|
||||
if let user = peer as? TelegramUser, user.isForum {
|
||||
if case let .user(user) = peer, user.isForum {
|
||||
statusText = " "
|
||||
} else {
|
||||
statusText = peer.debugDisplayTitle
|
||||
|
|
@ -1812,7 +1812,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||
})
|
||||
}
|
||||
|
||||
self.avatarListNode.update(size: CGSize(), avatarSize: avatarSize, isExpanded: self.isAvatarExpanded, peer: peer, isForum: isForum, threadId: self.forumTopicThreadId, threadInfo: threadData?.info, theme: presentationData.theme, transition: transition)
|
||||
self.avatarListNode.update(size: CGSize(), avatarSize: avatarSize, isExpanded: self.isAvatarExpanded, peer: peer?._asPeer(), isForum: isForum, threadId: self.forumTopicThreadId, threadInfo: threadData?.info, theme: presentationData.theme, transition: transition)
|
||||
self.editingContentNode.avatarNode.update(peer: peer, threadData: threadData, chatLocation: self.chatLocation, item: self.avatarListNode.item, updatingAvatar: state.updatingAvatar, uploadProgress: state.avatarUploadProgress, theme: presentationData.theme, avatarSize: avatarSize, isEditing: state.isEditing)
|
||||
self.avatarOverlayNode.update(peer: peer, threadData: threadData, chatLocation: self.chatLocation, item: self.avatarListNode.item, updatingAvatar: state.updatingAvatar, uploadProgress: state.avatarUploadProgress, theme: presentationData.theme, avatarSize: avatarSize, isEditing: state.isEditing)
|
||||
if additive {
|
||||
|
|
@ -1961,7 +1961,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||
self.avatarListNode.containerNode.view.mask = nil
|
||||
}
|
||||
|
||||
self.avatarListNode.listContainerNode.update(size: expandedAvatarListSize, peer: peer.flatMap(EnginePeer.init), isExpanded: self.isAvatarExpanded, transition: transition)
|
||||
self.avatarListNode.listContainerNode.update(size: expandedAvatarListSize, peer: peer, isExpanded: self.isAvatarExpanded, transition: transition)
|
||||
if self.avatarListNode.listContainerNode.isCollapsing && !self.ignoreCollapse {
|
||||
self.avatarListNode.avatarContainerNode.canAttachVideo = false
|
||||
}
|
||||
|
|
@ -2351,14 +2351,14 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||
buttonText = presentationData.strings.PeerInfo_ButtonVideoCall
|
||||
buttonIcon = .videoCall
|
||||
case .voiceChat:
|
||||
if let channel = peer as? TelegramChannel, case .broadcast = channel.info {
|
||||
if case let .channel(channel) = peer, case .broadcast = channel.info {
|
||||
buttonText = presentationData.strings.PeerInfo_ButtonLiveStream
|
||||
} else {
|
||||
buttonText = presentationData.strings.PeerInfo_ButtonVoiceChat
|
||||
}
|
||||
buttonIcon = .voiceChat
|
||||
case .mute:
|
||||
let chatIsMuted = peerInfoIsChatMuted(peer: peer.flatMap(EnginePeer.init), peerNotificationSettings: peerNotificationSettings, threadNotificationSettings: threadNotificationSettings, globalNotificationSettings: globalNotificationSettings)
|
||||
let chatIsMuted = peerInfoIsChatMuted(peer: peer, peerNotificationSettings: peerNotificationSettings, threadNotificationSettings: threadNotificationSettings, globalNotificationSettings: globalNotificationSettings)
|
||||
if chatIsMuted {
|
||||
buttonText = presentationData.strings.PeerInfo_ButtonUnmute
|
||||
buttonIcon = .unmute
|
||||
|
|
|
|||
|
|
@ -5396,7 +5396,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||
}
|
||||
let headerInset = sectionInset
|
||||
|
||||
let headerHeight = self.headerNode.update(width: layout.size.width, containerHeight: layout.size.height, containerInset: headerInset, statusBarHeight: layout.statusBarHeight ?? 0.0, navigationHeight: navigationHeight, isModalOverlay: layout.isModalOverlay, isMediaOnly: self.isMediaOnly, contentOffset: self.isMediaOnly ? 212.0 : self.scrollNode.view.contentOffset.y, paneContainerY: self.paneContainerNode.frame.minY, presentationData: self.presentationData, peer: self.data?.savedMessagesPeer ?? self.data?.peer?._asPeer(), cachedData: self.data?.cachedData, threadData: self.data?.threadData, peerNotificationSettings: self.data?.peerNotificationSettings, threadNotificationSettings: self.data?.threadNotificationSettings, globalNotificationSettings: self.data?.globalNotificationSettings, statusData: self.data?.status, panelStatusData: self.customStatusData, isSecretChat: self.peerId.namespace == Namespaces.Peer.SecretChat, isContact: self.data?.isContact ?? false, isSettings: self.isSettings, state: self.state, profileGiftsContext: self.data?.profileGiftsContext, screenData: self.data, isSearching: self.searchDisplayController != nil, metrics: layout.metrics, deviceMetrics: layout.deviceMetrics, transition: self.headerNode.navigationTransition == nil ? transition : .immediate, additive: additive, animateHeader: transition.isAnimated && self.headerNode.navigationTransition == nil)
|
||||
let headerHeight = self.headerNode.update(width: layout.size.width, containerHeight: layout.size.height, containerInset: headerInset, statusBarHeight: layout.statusBarHeight ?? 0.0, navigationHeight: navigationHeight, isModalOverlay: layout.isModalOverlay, isMediaOnly: self.isMediaOnly, contentOffset: self.isMediaOnly ? 212.0 : self.scrollNode.view.contentOffset.y, paneContainerY: self.paneContainerNode.frame.minY, presentationData: self.presentationData, peer: self.data?.savedMessagesPeer.flatMap(EnginePeer.init) ?? self.data?.peer, cachedData: self.data?.cachedData, threadData: self.data?.threadData, peerNotificationSettings: self.data?.peerNotificationSettings, threadNotificationSettings: self.data?.threadNotificationSettings, globalNotificationSettings: self.data?.globalNotificationSettings, statusData: self.data?.status, panelStatusData: self.customStatusData, isSecretChat: self.peerId.namespace == Namespaces.Peer.SecretChat, isContact: self.data?.isContact ?? false, isSettings: self.isSettings, state: self.state, profileGiftsContext: self.data?.profileGiftsContext, screenData: self.data, isSearching: self.searchDisplayController != nil, metrics: layout.metrics, deviceMetrics: layout.deviceMetrics, transition: self.headerNode.navigationTransition == nil ? transition : .immediate, additive: additive, animateHeader: transition.isAnimated && self.headerNode.navigationTransition == nil)
|
||||
|
||||
let headerFrame = CGRect(origin: CGPoint(x: 0.0, y: contentHeight), size: CGSize(width: layout.size.width, height: layout.size.height))
|
||||
if additive {
|
||||
|
|
@ -5802,7 +5802,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
|||
}
|
||||
let headerInset = sectionInset
|
||||
|
||||
let _ = self.headerNode.update(width: layout.size.width, containerHeight: layout.size.height, containerInset: headerInset, statusBarHeight: layout.statusBarHeight ?? 0.0, navigationHeight: navigationHeight, isModalOverlay: layout.isModalOverlay, isMediaOnly: self.isMediaOnly, contentOffset: self.isMediaOnly ? 212.0 : offsetY, paneContainerY: self.paneContainerNode.frame.minY, presentationData: self.presentationData, peer: self.data?.savedMessagesPeer ?? self.data?.peer?._asPeer(), cachedData: self.data?.cachedData, threadData: self.data?.threadData, peerNotificationSettings: self.data?.peerNotificationSettings, threadNotificationSettings: self.data?.threadNotificationSettings, globalNotificationSettings: self.data?.globalNotificationSettings, statusData: self.data?.status, panelStatusData: self.customStatusData, isSecretChat: self.peerId.namespace == Namespaces.Peer.SecretChat, isContact: self.data?.isContact ?? false, isSettings: self.isSettings, state: self.state, profileGiftsContext: self.data?.profileGiftsContext, screenData: self.data, isSearching: self.searchDisplayController != nil, metrics: layout.metrics, deviceMetrics: layout.deviceMetrics, transition: self.headerNode.navigationTransition == nil ? transition : .immediate, additive: additive, animateHeader: animateHeader && self.headerNode.navigationTransition == nil)
|
||||
let _ = self.headerNode.update(width: layout.size.width, containerHeight: layout.size.height, containerInset: headerInset, statusBarHeight: layout.statusBarHeight ?? 0.0, navigationHeight: navigationHeight, isModalOverlay: layout.isModalOverlay, isMediaOnly: self.isMediaOnly, contentOffset: self.isMediaOnly ? 212.0 : offsetY, paneContainerY: self.paneContainerNode.frame.minY, presentationData: self.presentationData, peer: self.data?.savedMessagesPeer.flatMap(EnginePeer.init) ?? self.data?.peer, cachedData: self.data?.cachedData, threadData: self.data?.threadData, peerNotificationSettings: self.data?.peerNotificationSettings, threadNotificationSettings: self.data?.threadNotificationSettings, globalNotificationSettings: self.data?.globalNotificationSettings, statusData: self.data?.status, panelStatusData: self.customStatusData, isSecretChat: self.peerId.namespace == Namespaces.Peer.SecretChat, isContact: self.data?.isContact ?? false, isSettings: self.isSettings, state: self.state, profileGiftsContext: self.data?.profileGiftsContext, screenData: self.data, isSearching: self.searchDisplayController != nil, metrics: layout.metrics, deviceMetrics: layout.deviceMetrics, transition: self.headerNode.navigationTransition == nil ? transition : .immediate, additive: additive, animateHeader: animateHeader && self.headerNode.navigationTransition == nil)
|
||||
}
|
||||
|
||||
let paneAreaExpansionDistance: CGFloat = 32.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue