Merge commit 'e29d0a3ae955fcd9aebc9a7798a8b81a2fc5dd8c'

This commit is contained in:
Ali 2021-10-28 15:19:12 +04:00
commit 1054b38220
10 changed files with 168 additions and 109 deletions

View File

@ -5,6 +5,6 @@ public func horizontalContainerFillingSizeForLayout(layout: ContainerViewLayout,
if case .regular = layout.metrics.widthClass {
return min(layout.size.width, 414.0) - sideInset * 2.0
} else {
return min(layout.size.width, 414.0) - sideInset * 2.0
return min(layout.size.width, 428.0) - sideInset * 2.0
}
}

View File

@ -207,8 +207,17 @@ public final class HorizontalPeerItemNode: ListViewItemNode {
strongSelf.badgeBackgroundNode.isHidden = true
}
strongSelf.onlineNode.setImage(PresentationResourcesChatList.recentStatusOnlineIcon(item.theme, state: .regular), color: nil, transition: .immediate)
strongSelf.onlineNode.frame = CGRect(x: itemLayout.size.width - onlineLayout.width - 18.0, y: itemLayout.size.height - onlineLayout.height - 18.0, width: onlineLayout.width, height: onlineLayout.height)
var verticalOffset: CGFloat = 0.0
let state: RecentStatusOnlineIconState
if case .actionSheet = item.mode {
state = .panel
verticalOffset -= 9.0
} else {
state = .regular
}
strongSelf.onlineNode.setImage(PresentationResourcesChatList.recentStatusOnlineIcon(item.theme, state: state), color: nil, transition: .immediate)
strongSelf.onlineNode.frame = CGRect(x: itemLayout.size.width - onlineLayout.width - 18.0, y: itemLayout.size.height - onlineLayout.height - 18.0 + verticalOffset, width: onlineLayout.width, height: onlineLayout.height)
let _ = badgeApply()
let _ = onlineApply(animateContent)

View File

@ -112,7 +112,7 @@ const CGFloat TGPhotoEditorSliderViewInternalMargin = 7.0f;
CGContextRef context = UIGraphicsGetCurrentContext();
CGFloat margin = TGPhotoEditorSliderViewInternalMargin;
CGFloat visualMargin = _positionsCount > 1 ? margin : 1.0f;
CGFloat visualMargin = _positionsCount > 1 ? margin : 2.0f;
CGFloat totalLength = self.frame.size.width - margin * 2;
CGFloat visualTotalLength = self.frame.size.width - 2 * (_positionsCount > 1 ? margin : visualMargin);
CGFloat sideLength = self.frame.size.height;
@ -146,8 +146,8 @@ const CGFloat TGPhotoEditorSliderViewInternalMargin = 7.0f;
CGRect backFrame = CGRectMake(visualMargin, (sideLength - _lineSize) / 2, visualTotalLength, _lineSize);
CGRect trackFrame = CGRectMake(origin, (sideLength - _lineSize) / 2, track, _lineSize);
CGRect startFrame = CGRectMake(startPosition - 2 / 2, (sideLength - 8) / 2, 2, 8);
CGRect endFrame = CGRectMake(endPosition - 2 / 2, (sideLength - 8) / 2, 2, 8);
CGRect startFrame = CGRectMake(startPosition - 4 / 2, (sideLength - 12) / 2, 4, 12);
CGRect endFrame = CGRectMake(endPosition - 4 / 2, (sideLength - 12) / 2, 4, 12);
CGRect knobFrame = CGRectMake(knobPosition - _knobView.image.size.width / 2, (sideLength - _knobView.image.size.height) / 2, _knobView.image.size.width, _knobView.image.size.height);
if (vertical)
{

View File

@ -996,7 +996,11 @@ static CGFloat angleOffsetFromPortraitOrientationToOrientation(AVCaptureVideoOri
{
AVCaptureConnection *videoConnection = [_videoOutput connectionWithMediaType:AVMediaTypeVideo];
if (videoConnection.supportsVideoStabilization) {
videoConnection.preferredVideoStabilizationMode = AVCaptureVideoStabilizationModeStandard;
if (iosMajorVersion() >= 13) {
videoConnection.preferredVideoStabilizationMode = AVCaptureVideoStabilizationModeCinematicExtended;
} else {
videoConnection.preferredVideoStabilizationMode = AVCaptureVideoStabilizationModeCinematic;
}
}
}

View File

@ -212,7 +212,12 @@ private class RecentSessionScreenNode: ViewControllerTracingNode, UIScrollViewDe
self.contentBackgroundNode.backgroundColor = backgroundColor
self.titleNode = ImmediateTextNode()
self.titleNode.maximumNumberOfLines = 2
self.titleNode.textAlignment = .center
self.textNode = ImmediateTextNode()
self.textNode.maximumNumberOfLines = 1
self.textNode.textAlignment = .center
self.fieldBackgroundNode = ASDisplayNode()
self.fieldBackgroundNode.clipsToBounds = true
@ -510,8 +515,72 @@ private class RecentSessionScreenNode: ViewControllerTracingNode, UIScrollViewDe
insets.top = max(10.0, insets.top)
let bottomInset: CGFloat = 10.0 + cleanInsets.bottom
let titleHeight: CGFloat = 54.0
var contentHeight = titleHeight + bottomInset + 341.0
let width = horizontalContainerFillingSizeForLayout(layout: layout, sideInset: 0.0)
transition.updateFrame(node: self.wrappingScrollNode, frame: CGRect(origin: CGPoint(), size: layout.size))
transition.updateFrame(node: self.dimNode, frame: CGRect(origin: CGPoint(), size: layout.size))
let iconSize = CGSize(width: 72.0, height: 72.0)
let iconFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((width - iconSize.width) / 2.0), y: 36.0), size: iconSize)
if let iconNode = self.iconNode {
transition.updateFrame(node: iconNode, frame: iconFrame)
} else if let animationNode = self.animationNode {
transition.updateFrame(node: animationNode, frame: iconFrame)
animationNode.loop()
} else if let avatarNode = self.avatarNode {
transition.updateFrame(node: avatarNode, frame: iconFrame)
}
let inset: CGFloat = 16.0
let titleSize = self.titleNode.updateLayout(CGSize(width: width - inset * 2.0, height: 100.0))
let titleFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((width - titleSize.width) / 2.0), y: 120.0), size: titleSize)
transition.updateFrame(node: self.titleNode, frame: titleFrame)
let textSize = self.textNode.updateLayout(CGSize(width: width - inset * 2.0, height: 60.0))
let textFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((width - textSize.width) / 2.0), y: titleFrame.maxY), size: textSize)
transition.updateFrame(node: self.textNode, frame: textFrame)
let cancelSize = CGSize(width: 44.0, height: 44.0)
let cancelFrame = CGRect(origin: CGPoint(x: width - cancelSize.width - 3.0, y: 6.0), size: cancelSize)
transition.updateFrame(node: self.cancelButton, frame: cancelFrame)
let fieldItemHeight: CGFloat = 44.0
let fieldFrame = CGRect(x: inset, y: textFrame.maxY + 24.0, width: width - inset * 2.0, height: fieldItemHeight * 3.0)
transition.updateFrame(node: self.fieldBackgroundNode, frame: fieldFrame)
let maxFieldTitleWidth = (width - inset * 4.0) * 0.4
let deviceTitleTextSize = self.deviceTitleNode.updateLayout(CGSize(width: maxFieldTitleWidth, height: fieldItemHeight))
let deviceTitleTextFrame = CGRect(origin: CGPoint(x: fieldFrame.minX + inset, y: fieldFrame.minY + floorToScreenPixels((fieldItemHeight - deviceTitleTextSize.height) / 2.0)), size: deviceTitleTextSize)
transition.updateFrame(node: self.deviceTitleNode, frame: deviceTitleTextFrame)
let deviceValueTextSize = self.deviceValueNode.updateLayout(CGSize(width: fieldFrame.width - inset * 2.0 - deviceTitleTextSize.width - 10.0, height: fieldItemHeight))
let deviceValueTextFrame = CGRect(origin: CGPoint(x: fieldFrame.maxX - deviceValueTextSize.width - inset, y: fieldFrame.minY + floorToScreenPixels((fieldItemHeight - deviceValueTextSize.height) / 2.0)), size: deviceValueTextSize)
transition.updateFrame(node: self.deviceValueNode, frame: deviceValueTextFrame)
transition.updateFrame(node: self.firstSeparatorNode, frame: CGRect(x: fieldFrame.minX + inset, y: fieldFrame.minY + fieldItemHeight, width: fieldFrame.width - inset, height: UIScreenPixel))
let locationTitleTextSize = self.locationTitleNode.updateLayout(CGSize(width: maxFieldTitleWidth, height: fieldItemHeight))
let locationTitleTextFrame = CGRect(origin: CGPoint(x: fieldFrame.minX + inset, y: fieldFrame.minY + fieldItemHeight + floorToScreenPixels((fieldItemHeight - locationTitleTextSize.height) / 2.0)), size: locationTitleTextSize)
transition.updateFrame(node: self.locationTitleNode, frame: locationTitleTextFrame)
let locationValueTextSize = self.locationValueNode.updateLayout(CGSize(width: fieldFrame.width - inset * 2.0 - locationTitleTextSize.width - 10.0, height: fieldItemHeight))
let locationValueTextFrame = CGRect(origin: CGPoint(x: fieldFrame.maxX - locationValueTextSize.width - inset, y: fieldFrame.minY + fieldItemHeight + floorToScreenPixels((fieldItemHeight - locationValueTextSize.height) / 2.0)), size: locationValueTextSize)
transition.updateFrame(node: self.locationValueNode, frame: locationValueTextFrame)
transition.updateFrame(node: self.secondSeparatorNode, frame: CGRect(x: fieldFrame.minX + inset, y: fieldFrame.minY + fieldItemHeight + fieldItemHeight, width: fieldFrame.width - inset, height: UIScreenPixel))
let ipTitleTextSize = self.ipTitleNode.updateLayout(CGSize(width: maxFieldTitleWidth, height: fieldItemHeight))
let ipTitleTextFrame = CGRect(origin: CGPoint(x: fieldFrame.minX + inset, y: fieldFrame.minY + fieldItemHeight + fieldItemHeight + floorToScreenPixels((fieldItemHeight - ipTitleTextSize.height) / 2.0)), size: ipTitleTextSize)
transition.updateFrame(node: self.ipTitleNode, frame: ipTitleTextFrame)
let ipValueTextSize = self.ipValueNode.updateLayout(CGSize(width: fieldFrame.width - inset * 2.0 - ipTitleTextSize.width - 10.0, height: fieldItemHeight))
let ipValueTextFrame = CGRect(origin: CGPoint(x: fieldFrame.maxX - ipValueTextSize.width - inset, y: fieldFrame.minY + fieldItemHeight + fieldItemHeight + floorToScreenPixels((fieldItemHeight - ipValueTextSize.height) / 2.0)), size: ipValueTextSize)
transition.updateFrame(node: self.ipValueNode, frame: ipValueTextFrame)
var contentHeight = fieldFrame.maxY + bottomInset + 64.0
let isCurrent: Bool
if case let .session(session) = self.subject, session.isCurrent {
isCurrent = true
@ -526,91 +595,21 @@ private class RecentSessionScreenNode: ViewControllerTracingNode, UIScrollViewDe
self.terminateButton.isHidden = false
}
let width = horizontalContainerFillingSizeForLayout(layout: layout, sideInset: 0.0)
let sideInset = floor((layout.size.width - width) / 2.0)
let contentContainerFrame = CGRect(origin: CGPoint(x: sideInset, y: layout.size.height - contentHeight), size: CGSize(width: width, height: contentHeight))
let contentFrame = contentContainerFrame
var backgroundFrame = CGRect(origin: CGPoint(x: contentFrame.minX, y: contentFrame.minY), size: CGSize(width: contentFrame.width, height: contentFrame.height + 2000.0))
var backgroundFrame = CGRect(origin: CGPoint(x: contentFrame.minX, y: contentFrame.minY), size: CGSize(width: width, height: contentFrame.height + 2000.0))
if backgroundFrame.minY < contentFrame.minY {
backgroundFrame.origin.y = contentFrame.minY
}
transition.updateFrame(node: self.backgroundNode, frame: backgroundFrame)
transition.updateFrame(node: self.contentBackgroundNode, frame: CGRect(origin: CGPoint(), size: backgroundFrame.size))
transition.updateFrame(node: self.wrappingScrollNode, frame: CGRect(origin: CGPoint(), size: layout.size))
transition.updateFrame(node: self.dimNode, frame: CGRect(origin: CGPoint(), size: layout.size))
let iconSize = CGSize(width: 72.0, height: 72.0)
let iconFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((contentFrame.width - iconSize.width) / 2.0), y: 36.0), size: iconSize)
if let iconNode = self.iconNode {
transition.updateFrame(node: iconNode, frame: iconFrame)
} else if let animationNode = self.animationNode {
transition.updateFrame(node: animationNode, frame: iconFrame)
animationNode.loop()
} else if let avatarNode = self.avatarNode {
transition.updateFrame(node: avatarNode, frame: iconFrame)
}
let inset: CGFloat = 16.0
let titleSize = self.titleNode.updateLayout(CGSize(width: width - inset * 2.0, height: titleHeight))
let titleFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((contentFrame.width - titleSize.width) / 2.0), y: 120.0), size: titleSize)
transition.updateFrame(node: self.titleNode, frame: titleFrame)
let textSize = self.textNode.updateLayout(CGSize(width: width - inset * 2.0, height: titleHeight))
let textFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((contentFrame.width - textSize.width) / 2.0), y: titleFrame.maxY), size: textSize)
transition.updateFrame(node: self.textNode, frame: textFrame)
let cancelSize = CGSize(width: 44.0, height: 44.0)
let cancelFrame = CGRect(origin: CGPoint(x: contentFrame.width - cancelSize.width - 3.0, y: 6.0), size: cancelSize)
transition.updateFrame(node: self.cancelButton, frame: cancelFrame)
let fieldItemHeight: CGFloat = 44.0
let fieldFrame = CGRect(x: inset, y: textFrame.maxY + 24.0, width: contentFrame.width - inset * 2.0, height: fieldItemHeight * 3.0)
transition.updateFrame(node: self.fieldBackgroundNode, frame: fieldFrame)
let maxFieldTitleWidth = (width - inset * 4.0) * 0.333
let maxFieldValueWidth = (width - inset * 4.0) * 0.666
let deviceTitleTextSize = self.deviceTitleNode.updateLayout(CGSize(width: maxFieldTitleWidth, height: fieldItemHeight))
let deviceTitleTextFrame = CGRect(origin: CGPoint(x: fieldFrame.minX + inset, y: fieldFrame.minY + floorToScreenPixels((fieldItemHeight - deviceTitleTextSize.height) / 2.0)), size: deviceTitleTextSize)
transition.updateFrame(node: self.deviceTitleNode, frame: deviceTitleTextFrame)
let deviceValueTextSize = self.deviceValueNode.updateLayout(CGSize(width: maxFieldValueWidth, height: fieldItemHeight))
let deviceValueTextFrame = CGRect(origin: CGPoint(x: fieldFrame.maxX - deviceValueTextSize.width - inset, y: fieldFrame.minY + floorToScreenPixels((fieldItemHeight - deviceValueTextSize.height) / 2.0)), size: deviceValueTextSize)
transition.updateFrame(node: self.deviceValueNode, frame: deviceValueTextFrame)
transition.updateFrame(node: self.firstSeparatorNode, frame: CGRect(x: fieldFrame.minX + inset, y: fieldFrame.minY + fieldItemHeight, width: fieldFrame.width - inset, height: UIScreenPixel))
let locationTitleTextSize = self.locationTitleNode.updateLayout(CGSize(width: maxFieldTitleWidth, height: fieldItemHeight))
let locationTitleTextFrame = CGRect(origin: CGPoint(x: fieldFrame.minX + inset, y: fieldFrame.minY + fieldItemHeight + floorToScreenPixels((fieldItemHeight - locationTitleTextSize.height) / 2.0)), size: locationTitleTextSize)
transition.updateFrame(node: self.locationTitleNode, frame: locationTitleTextFrame)
let locationValueTextSize = self.locationValueNode.updateLayout(CGSize(width: maxFieldValueWidth, height: fieldItemHeight))
let locationValueTextFrame = CGRect(origin: CGPoint(x: fieldFrame.maxX - locationValueTextSize.width - inset, y: fieldFrame.minY + fieldItemHeight + floorToScreenPixels((fieldItemHeight - locationValueTextSize.height) / 2.0)), size: locationValueTextSize)
transition.updateFrame(node: self.locationValueNode, frame: locationValueTextFrame)
transition.updateFrame(node: self.secondSeparatorNode, frame: CGRect(x: fieldFrame.minX + inset, y: fieldFrame.minY + fieldItemHeight + fieldItemHeight, width: fieldFrame.width - inset, height: UIScreenPixel))
let ipTitleTextSize = self.ipTitleNode.updateLayout(CGSize(width: maxFieldTitleWidth, height: fieldItemHeight))
let ipTitleTextFrame = CGRect(origin: CGPoint(x: fieldFrame.minX + inset, y: fieldFrame.minY + fieldItemHeight + fieldItemHeight + floorToScreenPixels((fieldItemHeight - ipTitleTextSize.height) / 2.0)), size: ipTitleTextSize)
transition.updateFrame(node: self.ipTitleNode, frame: ipTitleTextFrame)
let ipValueTextSize = self.ipValueNode.updateLayout(CGSize(width: maxFieldValueWidth, height: fieldItemHeight))
let ipValueTextFrame = CGRect(origin: CGPoint(x: fieldFrame.maxX - ipValueTextSize.width - inset, y: fieldFrame.minY + fieldItemHeight + fieldItemHeight + floorToScreenPixels((fieldItemHeight - ipValueTextSize.height) / 2.0)), size: ipValueTextSize)
transition.updateFrame(node: self.ipValueNode, frame: ipValueTextFrame)
let doneButtonHeight = self.terminateButton.updateLayout(width: contentFrame.width - inset * 2.0, transition: transition)
transition.updateFrame(node: self.terminateButton, frame: CGRect(x: inset, y: contentHeight - doneButtonHeight - insets.bottom - 6.0, width: contentFrame.width, height: doneButtonHeight))
let doneButtonHeight = self.terminateButton.updateLayout(width: width - inset * 2.0, transition: transition)
transition.updateFrame(node: self.terminateButton, frame: CGRect(x: inset, y: contentHeight - doneButtonHeight - insets.bottom - 6.0, width: width, height: doneButtonHeight))
transition.updateFrame(node: self.contentContainerNode, frame: contentContainerFrame)
transition.updateFrame(node: self.topContentContainerNode, frame: contentContainerFrame)
var listInsets = UIEdgeInsets()
listInsets.top += layout.safeInsets.left + 12.0
listInsets.bottom += layout.safeInsets.right + 12.0
}
}

View File

@ -331,7 +331,7 @@ public final class SparseMessageList {
}
}
guard let loadRange = loadRange else {
guard let range = loadRange else {
completion()
return
}
@ -343,7 +343,7 @@ public final class SparseMessageList {
}
self.loadingHole = loadingHole
let mappedDirection: MessageHistoryViewRelativeHoleDirection = .range(start: MessageId(peerId: anchor.peerId, namespace: anchor.namespace, id: loadRange.lowerBound - 1), end: MessageId(peerId: anchor.peerId, namespace: anchor.namespace, id: loadRange.upperBound + 1))
let mappedDirection: MessageHistoryViewRelativeHoleDirection = .range(start: MessageId(peerId: anchor.peerId, namespace: anchor.namespace, id: range.lowerBound - 1), end: MessageId(peerId: anchor.peerId, namespace: anchor.namespace, id: range.upperBound + 1))
let account = self.account
self.loadHoleDisposable.set((fetchMessageHistoryHole(
@ -375,20 +375,20 @@ public final class SparseMessageList {
for i in 0 ..< strongSelf.sparseItems!.items.count {
switch strongSelf.sparseItems!.items[i] {
case let .anchor(id, _, _):
if id.id == loadRange.lowerBound {
if id.id == range.lowerBound {
lowerIndex = i
}
if id.id == loadRange.upperBound {
if id.id == range.upperBound {
upperIndex = i
}
default:
break
}
}
if loadRange.lowerBound <= 1 {
if range.lowerBound <= 1 {
lowerIndex = strongSelf.sparseItems!.items.count - 1
}
if loadRange.upperBound >= Int32.max - 1 {
if range.upperBound >= Int32.max - 1 {
upperIndex = 0
}

View File

@ -519,23 +519,35 @@ func managedThemesUpdates(accountManager: AccountManager<TelegramAccountManagerT
}.start()
let _ = postbox.transaction { transaction in
let entries = transaction.getOrderedListItems(collectionId: Namespaces.OrderedItemList.CloudThemes)
let items = entries.map { entry -> TelegramTheme in
let theme = entry.contents.get(TelegramThemeNativeCodable.self)!.value
if theme.id == updatedTheme.id {
return updatedTheme
var success = true
var mappedItems: [TelegramTheme] = []
for entry in entries {
if let theme = entry.contents.get(TelegramThemeNativeCodable.self)?.value {
if theme.id == updatedTheme.id {
mappedItems.append(updatedTheme)
} else {
mappedItems.append(theme)
}
} else {
return theme
success = false
break
}
}
var updatedEntries: [OrderedItemListEntry] = []
for item in items {
var intValue = Int32(updatedEntries.count)
let id = MemoryBuffer(data: Data(bytes: &intValue, count: 4))
if let entry = CodableEntry(TelegramThemeNativeCodable(item)) {
updatedEntries.append(OrderedItemListEntry(id: id, contents: entry))
if success {
var updatedEntries: [OrderedItemListEntry] = []
for item in mappedItems {
var intValue = Int32(updatedEntries.count)
let id = MemoryBuffer(data: Data(bytes: &intValue, count: 4))
if let entry = CodableEntry(TelegramThemeNativeCodable(item)) {
updatedEntries.append(OrderedItemListEntry(id: id, contents: entry))
}
}
transaction.replaceOrderedItemListItems(collectionId: Namespaces.OrderedItemList.CloudThemes, items: updatedEntries)
} else {
let _ = (telegramThemes(postbox: postbox, network: network, accountManager: accountManager, forceUpdate: true)
|> take(1)).start()
}
transaction.replaceOrderedItemListItems(collectionId: Namespaces.OrderedItemList.CloudThemes, items: updatedEntries)
}.start()
}
subscriber.putCompletion()

View File

@ -6,7 +6,7 @@ import TelegramApi
public func telegramWallpapers(postbox: Postbox, network: Network, forceUpdate: Bool = false) -> Signal<[TelegramWallpaper], NoError> {
let fetch: ([TelegramWallpaper]?, Int64?) -> Signal<[TelegramWallpaper], NoError> = { current, hash in
network.request(Api.functions.account.getWallPapers(hash: 0))
network.request(Api.functions.account.getWallPapers(hash: hash ?? 0))
|> retryRequest
|> mapToSignal { result -> Signal<([TelegramWallpaper], Int64), NoError> in
switch result {
@ -65,7 +65,21 @@ public func telegramWallpapers(postbox: Postbox, network: Network, forceUpdate:
if items.count == 0 {
return ([.builtin(WallpaperSettings())], 0)
} else {
return (items.map { $0.contents.get(TelegramWallpaperNativeCodable.self)!.value }, configuration?.hash)
var success = true
var mappedItems: [TelegramWallpaper] = []
for item in items {
if let value = item.contents.get(TelegramWallpaperNativeCodable.self)?.value {
mappedItems.append(value)
} else {
success = false
break
}
}
if success {
return (mappedItems, configuration?.hash)
} else {
return ([.builtin(WallpaperSettings())], nil)
}
}
}
|> mapToSignal { current, hash -> Signal<[TelegramWallpaper], NoError> in

View File

@ -1543,7 +1543,10 @@ final class PeerInfoHeaderEditingContentNode: ASDisplayNode {
func update(width: CGFloat, safeInset: CGFloat, statusBarHeight: CGFloat, navigationHeight: CGFloat, isModalOverlay: Bool, peer: Peer?, 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 + 10.0), size: CGSize(width: avatarSize, height: avatarSize))
var avatarFrame = CGRect(origin: CGPoint(x: floor((width - avatarSize) / 2.0), y: statusBarHeight + 10.0), size: CGSize(width: avatarSize, height: avatarSize))
if isSettings {
avatarFrame = avatarFrame.offsetBy(dx: 0.0, dy: 3.0)
}
transition.updateFrameAdditiveToCenter(node: self.avatarNode, frame: CGRect(origin: avatarFrame.center, size: CGSize()))
var contentHeight: CGFloat = statusBarHeight + 10.0 + avatarSize + 20.0
@ -2166,7 +2169,10 @@ final class PeerInfoHeaderNode: ASDisplayNode {
], mainState: TitleNodeStateRegular)
self.usernameNode.accessibilityLabel = usernameString.string
let avatarFrame = CGRect(origin: CGPoint(x: floor((width - avatarSize) / 2.0), y: statusBarHeight + 10.0), size: CGSize(width: avatarSize, height: avatarSize))
var avatarFrame = CGRect(origin: CGPoint(x: floor((width - avatarSize) / 2.0), y: statusBarHeight + 10.0), size: CGSize(width: avatarSize, height: avatarSize))
if isSettings {
avatarFrame = avatarFrame.offsetBy(dx: 0.0, dy: 3.0)
}
let avatarCenter = CGPoint(x: (1.0 - transitionFraction) * avatarFrame.midX + transitionFraction * transitionSourceAvatarFrame.midX, y: (1.0 - transitionFraction) * avatarFrame.midY + transitionFraction * transitionSourceAvatarFrame.midY)
let titleSize = titleNodeLayout[TitleNodeStateRegular]!.size
@ -2206,7 +2212,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
}
usernameFrame = CGRect(origin: CGPoint(x: width - usernameSize.width - 16.0, y: minTitleFrame.midY - usernameSize.height / 2.0), size: usernameSize)
} else {
titleFrame = CGRect(origin: CGPoint(x: floor((width - titleSize.width) / 2.0), y: avatarFrame.maxY + 10.0 + (subtitleSize.height.isZero ? 11.0 : 0.0)), size: titleSize)
titleFrame = CGRect(origin: CGPoint(x: floor((width - titleSize.width) / 2.0), y: avatarFrame.maxY + 7.0 + (subtitleSize.height.isZero ? 11.0 : 0.0)), size: titleSize)
if self.isSettings {
titleFrame = titleFrame.offsetBy(dx: 0.0, dy: 13.0)
}

View File

@ -6411,7 +6411,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
if wasAdded && transition.isAnimated && self.isSettings && !self.state.isEditing {
sectionNode.alpha = 0.0
transition.updateAlpha(node: sectionNode, alpha: 1.0)
transition.updateAlpha(node: sectionNode, alpha: 1.0, delay: 0.1)
}
let sectionHeight = sectionNode.update(width: layout.size.width, safeInsets: insets, presentationData: self.presentationData, items: sectionItems, transition: transition)
@ -6422,7 +6422,10 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
transition.updateFrame(node: sectionNode, frame: sectionFrame)
}
transition.updateAlpha(node: sectionNode, alpha: self.state.isEditing ? 0.0 : 1.0)
if wasAdded && transition.isAnimated && self.isSettings && !self.state.isEditing {
} else {
transition.updateAlpha(node: sectionNode, alpha: self.state.isEditing ? 0.0 : 1.0)
}
if !sectionHeight.isZero && !self.state.isEditing {
contentHeight += sectionHeight
contentHeight += sectionSpacing
@ -6436,6 +6439,14 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
}
for sectionId in removeRegularSections {
if let sectionNode = self.regularSections.removeValue(forKey: sectionId) {
var alphaTransition = transition
if let sectionId = sectionId as? SettingsSection, case .edit = sectionId {
sectionNode.layer.animatePosition(from: CGPoint(), to: CGPoint(x: 0.0, y: -layout.size.width * 0.7), duration: 0.4, delay: 0.0, timingFunction: kCAMediaTimingFunctionSpring, mediaTimingFunction: nil, removeOnCompletion: false, additive: true, completion: nil)
if alphaTransition.isAnimated {
alphaTransition = .animated(duration: 0.12, curve: .easeInOut)
}
}
transition.updateAlpha(node: sectionNode, alpha: 0.0, completion: { [weak sectionNode] _ in
sectionNode?.removeFromSupernode()
})
@ -6596,8 +6607,8 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
}
let relativeHeaderFrame = self.headerNode.view.convert(self.headerNode.bounds, to: self.view)
self.leftOverlayNode.frame = CGRect(x: 0.0, y: relativeHeaderFrame.maxY + UIScreenPixel - self.scrollNode.view.contentOffset.y, width: currentInsets.left, height: layout.size.height * 10.0)
self.rightOverlayNode.frame = CGRect(x: layout.size.width - currentInsets.right, y: relativeHeaderFrame.maxY + UIScreenPixel - self.scrollNode.view.contentOffset.y, width: currentInsets.right, height: layout.size.height * 10.0)
transition.updateFrame(node: self.leftOverlayNode, frame: CGRect(x: 0.0, y: relativeHeaderFrame.maxY + UIScreenPixel - self.scrollNode.view.contentOffset.y, width: currentInsets.left, height: layout.size.height * 10.0))
transition.updateFrame(node: self.rightOverlayNode, frame: CGRect(x: layout.size.width - currentInsets.right, y: relativeHeaderFrame.maxY + UIScreenPixel - self.scrollNode.view.contentOffset.y, width: currentInsets.right, height: layout.size.height * 10.0))
if additive {
transition.updateFrameAdditive(node: self.paneContainerNode, frame: paneContainerFrame)
@ -6751,6 +6762,10 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
}
let headerFrame = self.headerNode.view.convert(self.headerNode.bounds, to: self.view)
if !self.headerNode.isAvatarExpanded {
self.leftOverlayNode.layer.removeAllAnimations()
self.rightOverlayNode.layer.removeAllAnimations()
}
self.leftOverlayNode.frame = CGRect(x: 0.0, y: headerFrame.maxY + UIScreenPixel - scrollView.contentOffset.y, width: self.leftOverlayNode.frame.width, height: self.leftOverlayNode.frame.height)
self.rightOverlayNode.frame = CGRect(x: self.rightOverlayNode.frame.minX, y: headerFrame.maxY + UIScreenPixel - scrollView.contentOffset.y, width: self.rightOverlayNode.frame.width, height: self.rightOverlayNode.frame.height)