Skip to content

Commit f854ed2

Browse files
committed
Revert the profile action-button card, back to the stock profile header
The circular action buttons in their own card are reverted; the profile header returns to the stock layout with labelled action buttons.
1 parent f23a1f7 commit f854ed2

6 files changed

Lines changed: 20 additions & 304 deletions

File tree

‎submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/ListItems/PeerInfoScreenActionButtonsItem.swift‎

Lines changed: 0 additions & 218 deletions
This file was deleted.

‎submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoHeaderButtonNode.swift‎

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ final class PeerInfoHeaderButtonNode: HighlightableButtonNode {
5050
private var theme: PresentationTheme?
5151
private var icon: PeerInfoHeaderButtonIcon?
5252
private var isActive: Bool?
53-
private var circularStyle: Bool = false
5453

5554
let backgroundContainerView: UIView
5655
let backgroundView: UIView
@@ -127,18 +126,16 @@ final class PeerInfoHeaderButtonNode: HighlightableButtonNode {
127126
self.action(self, nil)
128127
}
129128

130-
func update(size: CGSize, text: String, icon: PeerInfoHeaderButtonIcon, isActive: Bool, presentationData: PresentationData, backgroundColor: UIColor, foregroundColor: UIColor, fraction: CGFloat, circularStyle: Bool = false, transition: ContainedViewLayoutTransition) {
129+
func update(size: CGSize, text: String, icon: PeerInfoHeaderButtonIcon, isActive: Bool, presentationData: PresentationData, backgroundColor: UIColor, foregroundColor: UIColor, fraction: CGFloat, transition: ContainedViewLayoutTransition) {
131130
let previousIcon = self.icon
132131
let themeUpdated = self.theme != presentationData.theme
133132
let iconUpdated = self.icon != icon
134133
let isActiveUpdated = self.isActive != isActive
135-
let circularStyleUpdated = self.circularStyle != circularStyle
136134
self.isActive = isActive
137-
self.circularStyle = circularStyle
138135

139-
let iconSize = CGSize(width: circularStyle ? 24.0 : 40.0, height: circularStyle ? 24.0 : 40.0)
136+
let iconSize = CGSize(width: 40.0, height: 40.0)
140137

141-
if themeUpdated || iconUpdated || circularStyleUpdated {
138+
if themeUpdated || iconUpdated {
142139
self.theme = presentationData.theme
143140
self.icon = icon
144141

@@ -263,32 +260,25 @@ final class PeerInfoHeaderButtonNode: HighlightableButtonNode {
263260
self.accessibilityLabel = text
264261
let titleSize = self.textNode.updateLayout(CGSize(width: 120.0, height: .greatestFiniteMagnitude))
265262

266-
let effectiveFraction = circularStyle ? 1.0 : fraction
267-
268263
transition.updateFrame(node: self.containerNode, frame: CGRect(origin: CGPoint(), size: size))
269-
transition.updateFrame(node: self.contentNode, frame: CGRect(origin: CGPoint(x: 0.0, y: size.height * 0.5 * (1.0 - effectiveFraction)), size: size))
270-
transition.updateAlpha(node: self.contentNode, alpha: effectiveFraction)
264+
transition.updateFrame(node: self.contentNode, frame: CGRect(origin: CGPoint(x: 0.0, y: size.height * 0.5 * (1.0 - fraction)), size: size))
265+
transition.updateAlpha(node: self.contentNode, alpha: fraction)
271266

272-
let backgroundY: CGFloat = circularStyle ? 0.0 : size.height * (1.0 - effectiveFraction)
273-
let backgroundFrame = CGRect(origin: CGPoint(x: 0.0, y: backgroundY), size: CGSize(width: size.width, height: circularStyle ? size.height : max(0.0, size.height - backgroundY)))
267+
let backgroundY: CGFloat = size.height * (1.0 - fraction)
268+
let backgroundFrame = CGRect(origin: CGPoint(x: 0.0, y: backgroundY), size: CGSize(width: size.width, height: max(0.0, size.height - backgroundY)))
269+
//transition.updateFrame(node: self.backgroundNode, frame: backgroundFrame)
274270
transition.updateFrame(view: self.backgroundView, frame: backgroundFrame)
275-
transition.updateBackgroundColor(layer: self.backgroundView.layer, color: backgroundColor)
276-
277-
transition.updateSublayerTransformScale(node: self.contentNode, scale: 1.0 * effectiveFraction + 0.001 * (1.0 - effectiveFraction))
278271

279-
let cornerRadius = circularStyle ? size.width * 0.5 : min(16.0, backgroundFrame.height * 0.5)
280-
transition.updateCornerRadius(layer: self.backgroundView.layer, cornerRadius: cornerRadius)
272+
transition.updateSublayerTransformScale(node: self.contentNode, scale: 1.0 * fraction + 0.001 * (1.0 - fraction))
281273

282-
let iconY = circularStyle ? floor((size.height - iconSize.height) / 2.0) : 1.0
283-
transition.updateFrame(node: self.iconNode, frame: CGRect(origin: CGPoint(x: floor((size.width - iconSize.width) / 2.0), y: iconY), size: iconSize))
274+
transition.updateCornerRadius(layer: self.backgroundView.layer, cornerRadius: min(16.0, backgroundFrame.height * 0.5))
275+
//self.backgroundNode.update(size: backgroundFrame.size, cornerRadius: min(11.0, backgroundFrame.height * 0.5), transition: transition)
276+
//self.backgroundNode.updateColor(color: backgroundColor, transition: transition)
277+
transition.updateFrame(node: self.iconNode, frame: CGRect(origin: CGPoint(x: floor((size.width - iconSize.width) / 2.0), y: 1.0), size: iconSize))
284278
if let animatedIconView = self.animatedIcon?.view {
285-
transition.updateFrame(view: animatedIconView, frame: CGRect(origin: CGPoint(x: floor((size.width - iconSize.width) / 2.0), y: iconY), size: iconSize))
286-
}
287-
if circularStyle {
288-
transition.updateAlpha(node: self.textNode, alpha: 0.0)
289-
} else {
290-
transition.updateFrameAdditiveToCenter(node: self.textNode, frame: CGRect(origin: CGPoint(x: floor((size.width - titleSize.width) / 2.0), y: size.height - titleSize.height - 9.0), size: titleSize))
279+
transition.updateFrame(view: animatedIconView, frame: CGRect(origin: CGPoint(x: floor((size.width - iconSize.width) / 2.0), y: 1.0), size: iconSize))
291280
}
281+
transition.updateFrameAdditiveToCenter(node: self.textNode, frame: CGRect(origin: CGPoint(x: floor((size.width - titleSize.width) / 2.0), y: size.height - titleSize.height - 9.0), size: titleSize))
292282

293283
self.referenceNode.frame = self.containerNode.bounds
294284
}

0 commit comments

Comments
 (0)