Skip to content

Commit 68a75ff

Browse files
committed
Merge commit '7621e2f8dec938cf48181c8b10afc9b01f444e68' into beta
2 parents a3b1dd5 + 7621e2f commit 68a75ff

File tree

6 files changed

+91
-50
lines changed

6 files changed

+91
-50
lines changed

submodules/Components/SheetComponent/Sources/SheetComponent.swift

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,11 @@ public final class SheetComponent<ChildEnvironmentType: Sendable & Equatable>: C
305305

306306
let transition = ContainedViewLayoutTransition.animated(duration: 0.4, curve: .spring)
307307
let targetPosition = self.scrollView.center
308-
self.scrollView.center = targetPosition.offsetBy(dx: 0.0, dy: self.scrollView.contentSize.height)
308+
var offset: CGFloat = self.scrollView.contentSize.height
309+
if self.isCentered {
310+
offset = self.frame.height + self.scrollView.frame.height * 0.5
311+
}
312+
self.scrollView.center = targetPosition.offsetBy(dx: 0.0, dy: offset)
309313
transition.animateView(allowUserInteraction: true, {
310314
self.scrollView.center = targetPosition
311315
})
@@ -338,18 +342,27 @@ public final class SheetComponent<ChildEnvironmentType: Sendable & Equatable>: C
338342
let contentOffset = (self.scrollView.contentOffset.y + self.scrollView.contentInset.top - self.scrollView.contentSize.height) * -1.0
339343
let dismissalOffset = self.scrollView.contentSize.height + abs(contentView.frame.minY)
340344
let delta = dismissalOffset - contentOffset
345+
var targetPosition = self.scrollView.center.y + delta
346+
if self.isCentered {
347+
targetPosition = self.frame.height + self.scrollView.frame.height * 0.5
348+
}
341349

342-
transition.updatePosition(layer: self.scrollView.layer, position: CGPoint(x: self.scrollView.center.x, y: self.scrollView.center.y + delta), completion: { _ in
350+
transition.updatePosition(layer: self.scrollView.layer, position: CGPoint(x: self.scrollView.center.x, y: targetPosition), completion: { _ in
343351
completion()
344352
})
345353
} else {
346-
self.scrollView.layer.animatePosition(from: CGPoint(), to: CGPoint(x: 0.0, y: self.scrollView.contentSize.height + abs(contentView.frame.minY)), duration: 0.25, timingFunction: CAMediaTimingFunctionName.easeInEaseOut.rawValue, removeOnCompletion: false, additive: true, completion: { _ in
354+
var targetOffset: CGFloat = self.scrollView.contentSize.height + abs(contentView.frame.minY)
355+
if self.isCentered {
356+
targetOffset = self.frame.height + self.scrollView.frame.height * 0.5
357+
}
358+
self.scrollView.layer.animatePosition(from: CGPoint(), to: CGPoint(x: 0.0, y: targetOffset), duration: 0.25, timingFunction: CAMediaTimingFunctionName.easeInEaseOut.rawValue, removeOnCompletion: false, additive: true, completion: { _ in
347359
completion()
348360
})
349361
}
350362
}
351363

352364
private var currentHasInputHeight = false
365+
private var isCentered = false
353366
private var currentAvailableSize: CGSize?
354367
func update(component: SheetComponent<ChildEnvironmentType>, availableSize: CGSize, state: EmptyComponentState, environment: Environment<EnvironmentType>, transition: ComponentTransition) -> CGSize {
355368
let previousHasInputHeight = self.currentHasInputHeight
@@ -364,6 +377,7 @@ public final class SheetComponent<ChildEnvironmentType: Sendable & Equatable>: C
364377
}
365378

366379
self.component = component
380+
self.isCentered = sheetEnvironment.isCentered
367381
self.currentHasInputHeight = sheetEnvironment.hasInputHeight
368382

369383
if self.isAnimatingOut {

submodules/TelegramUI/Components/Gifts/GiftItemComponent/Sources/GiftItemComponent.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,8 @@ public final class GiftItemComponent: Component {
11411141
} else {
11421142
if [.buttonIcon, .tableIcon].contains(component.mode) {
11431143

1144+
} else if case .upgradePreview = component.mode {
1145+
self.backgroundLayer.backgroundColor = component.theme.list.itemModalBlocksBackgroundColor.cgColor
11441146
} else {
11451147
self.backgroundLayer.backgroundColor = component.theme.list.itemBlocksBackgroundColor.cgColor
11461148
}

submodules/TelegramUI/Components/Gifts/GiftSetupScreen/Sources/GiftSetupScreen.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import AnimatedTextComponent
3939
import GlassBarButtonComponent
4040
import MessageInputPanelComponent
4141
import GiftRemainingCountComponent
42+
import GlassBackgroundComponent
4243

4344
private final class GiftSetupScreenComponent: Component {
4445
typealias EnvironmentType = ViewControllerComponentContainer.Environment
@@ -113,6 +114,7 @@ private final class GiftSetupScreenComponent: Component {
113114
private let upgradeSection = ComponentView<Empty>()
114115
private let hideSection = ComponentView<Empty>()
115116

117+
private let glassContainerView = GlassBackgroundContainerView()
116118
private let inputPanel = ComponentView<Empty>()
117119
private let inputPanelExternalState = MessageInputPanelComponent.ExternalState()
118120

@@ -1366,11 +1368,16 @@ private final class GiftSetupScreenComponent: Component {
13661368
transition.setFrame(view: introContentView, frame: CGRect(origin: CGPoint(x: rawSideInset, y: 0.0), size: introContentSize))
13671369
}
13681370

1369-
let inputPanelFrame = CGRect(origin: CGPoint(x: rawSideInset + inputPanelInset, y: contentHeight + introContentSize.height - inputPanelInset - inputPanelSize.height + 6.0), size: inputPanelSize)
1371+
let glassContainerFrame = CGRect(origin: CGPoint(x: rawSideInset + inputPanelInset, y: contentHeight + introContentSize.height - inputPanelInset - inputPanelSize.height + 6.0 - 20.0), size: CGSize(width: inputPanelSize.width, height: inputPanelSize.height + 40.0))
1372+
self.glassContainerView.update(size: glassContainerFrame.size, isDark: theme.overallDarkAppearance, transition: transition)
1373+
1374+
let inputPanelFrame = CGRect(origin: CGPoint(x: 0.0, y: 20.0), size: inputPanelSize)
13701375
if let inputPanelView = self.inputPanel.view {
13711376
if inputPanelView.superview == nil {
1372-
self.scrollContentView.addSubview(inputPanelView)
1377+
self.scrollContentView.addSubview(self.glassContainerView)
1378+
self.glassContainerView.contentView.addSubview(inputPanelView)
13731379
}
1380+
transition.setFrame(view: self.glassContainerView, frame: glassContainerFrame)
13741381
transition.setFrame(view: inputPanelView, frame: inputPanelFrame)
13751382
}
13761383
}

submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftAuctionViewScreen.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -738,12 +738,9 @@ private final class GiftAuctionViewSheetContent: CombinedComponent {
738738
} else {
739739
return false
740740
}
741-
}), case let .backdrop(_, _, innerColor, outerColor, _, _, _) = backdropAttribute {
742-
let topColor = UIColor(rgb: UInt32(bitPattern: innerColor)).withMultiplied(hue: 1.01, saturation: 1.22, brightness: 1.04)
743-
let bottomColor = UIColor(rgb: UInt32(bitPattern: outerColor)).withMultiplied(hue: 0.97, saturation: 1.45, brightness: 0.89)
744-
buttonColor = topColor.mixedWith(bottomColor, alpha: 0.8).withMultipliedBrightnessBy(1.25)
745-
746-
secondaryTextColor = topColor.withMultiplied(hue: 1.0, saturation: 1.02, brightness: 1.25).mixedWith(UIColor.white, alpha: 0.5)
741+
}), case let .backdrop(_, _, innerColor, _, _, _, _) = backdropAttribute {
742+
buttonColor = UIColor(rgb: UInt32(bitPattern: innerColor)).withMultipliedBrightnessBy(1.05)
743+
secondaryTextColor = UIColor(rgb: UInt32(bitPattern: innerColor)).withMultiplied(hue: 1.0, saturation: 1.02, brightness: 1.25).mixedWith(UIColor.white, alpha: 0.3)
747744
}
748745

749746
let headerHeight: CGFloat = 264.0

submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftAuctionWearPreviewScreen.swift

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -293,19 +293,16 @@ private final class GiftAuctionWearPreviewSheetContent: CombinedComponent {
293293
} else {
294294
return false
295295
}
296-
}), case let .backdrop(_, _, innerColor, outerColor, _, _, _) = backdropAttribute {
297-
let topColor = UIColor(rgb: UInt32(bitPattern: innerColor)).withMultiplied(hue: 1.01, saturation: 1.22, brightness: 1.04)
298-
let bottomColor = UIColor(rgb: UInt32(bitPattern: outerColor)).withMultiplied(hue: 0.97, saturation: 1.45, brightness: 0.89)
299-
buttonColor = topColor.mixedWith(bottomColor, alpha: 0.8)
300-
301-
secondaryTextColor = topColor.withMultiplied(hue: 1.0, saturation: 1.02, brightness: 1.25).mixedWith(UIColor.white, alpha: 0.5)
296+
}), case let .backdrop(_, _, innerColor, _, _, _, _) = backdropAttribute {
297+
buttonColor = UIColor(rgb: UInt32(bitPattern: innerColor)).withMultipliedBrightnessBy(1.05)
298+
secondaryTextColor = UIColor(rgb: UInt32(bitPattern: innerColor)).withMultiplied(hue: 1.0, saturation: 1.02, brightness: 1.25).mixedWith(UIColor.white, alpha: 0.3)
302299
}
303300

304301
let closeButton = closeButton.update(
305302
component: GlassBarButtonComponent(
306303
size: CGSize(width: 40.0, height: 40.0),
307-
backgroundColor: buttonColor.withMultipliedBrightnessBy(1.2),
308-
isDark: theme.overallDarkAppearance,
304+
backgroundColor: buttonColor,
305+
isDark: false,
309306
state: .tintedGlass,
310307
component: AnyComponentWithIdentity(id: "close", component: AnyComponent(
311308
BundleIconComponent(

0 commit comments

Comments
 (0)