Skip to content

Commit c67ed1a

Browse files
author
Isaac
committed
Merge commit '183bc34f79dd0a782f5807fd8f0b6f70b870ed9f'
2 parents 95ecb88 + 183bc34 commit c67ed1a

File tree

7 files changed

+94
-71
lines changed

7 files changed

+94
-71
lines changed

submodules/AccountContext/Sources/Premium.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,3 +347,7 @@ public struct AccountFreezeConfiguration {
347347
public protocol GiftOptionsScreenProtocol {
348348

349349
}
350+
351+
public protocol GiftSetupScreenProtocol {
352+
353+
}

submodules/PremiumUI/Sources/PremiumIntroScreen.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,7 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
20472047
subtitle = environment.strings.Premium_PricePerYear(subtitle).string
20482048
accessibilitySubtitle = environment.strings.Premium_PricePerYear(accessibilitySubtitle).string
20492049
}
2050+
subtitle = "\(environment.strings.Gift_Options_Premium_Months(product.months))\(product.price)"
20502051
} else {
20512052
subtitle = product.price
20522053
}

submodules/SettingsUI/Sources/Privacy and Security/LoginEmailSetupController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ public func loginEmailSetupController(context: AccountContext, blocking: Bool, e
212212
}
213213

214214
dismissEmailControllerImpl = { [weak emailController] in
215+
dismiss()
215216
emailController?.dismiss()
216217
}
217218
return emailController

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,6 @@ private final class GiftSetupScreenComponent: Component {
584584
}
585585
navigationController.setViewControllers(controllers, animated: true)
586586

587-
588587
if case let .starGift(starGift, _) = component.subject, let perUserLimit = starGift.perUserLimit {
589588
Queue.mainQueue().after(0.5) {
590589
let remains = max(0, perUserLimit.remains - 1)
@@ -2019,7 +2018,7 @@ private final class GiftSetupScreenComponent: Component {
20192018
}
20202019
}
20212020

2022-
public class GiftSetupScreen: ViewControllerComponentContainer {
2021+
public class GiftSetupScreen: ViewControllerComponentContainer, GiftSetupScreenProtocol {
20232022
public enum Subject: Equatable {
20242023
case premium(PremiumGiftProduct)
20252024
case starGift(StarGift.Gift, Bool?)

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

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,9 @@ private final class GiftAuctionBidScreenComponent: Component {
16351635
customUndoText: nil
16361636
),
16371637
position: .bottom,
1638-
action: { _ in return true }
1638+
action: { _ in
1639+
return true
1640+
}
16391641
),
16401642
in: .current
16411643
)
@@ -2018,8 +2020,30 @@ private final class GiftAuctionBidScreenComponent: Component {
20182020
self.loadAcquiredGifts()
20192021
}
20202022
if !isFirstTime {
2021-
self.resetSliderValue()
2022-
self.addSubview(ConfettiView(frame: self.bounds))
2023+
if let bidPeerId = previousState?.myState.bidPeerId, let controller = self.environment?.controller() {
2024+
if let navigationController = controller.navigationController as? NavigationController {
2025+
var controllers = navigationController.viewControllers
2026+
controllers = controllers.filter { !($0 is GiftAuctionBidScreen) && !($0 is GiftSetupScreenProtocol) && !($0 is GiftOptionsScreenProtocol) && !($0 is PeerInfoScreen) && !($0 is ContactSelectionController) }
2027+
2028+
var foundController = false
2029+
for controller in controllers.reversed() {
2030+
if let chatController = controller as? ChatController, case .peer(id: bidPeerId) = chatController.chatLocation {
2031+
chatController.hintPlayNextOutgoingGift()
2032+
foundController = true
2033+
break
2034+
}
2035+
}
2036+
if !foundController {
2037+
let chatController = component.context.sharedContext.makeChatController(context: component.context, chatLocation: .peer(id: bidPeerId), subject: nil, botStart: nil, mode: .standard(.default), params: nil)
2038+
chatController.hintPlayNextOutgoingGift()
2039+
controllers.append(chatController)
2040+
}
2041+
navigationController.setViewControllers(controllers, animated: true)
2042+
}
2043+
} else {
2044+
self.resetSliderValue()
2045+
self.addSubview(ConfettiView(frame: self.bounds))
2046+
}
20232047
}
20242048
}
20252049

submodules/TelegramUI/Components/MediaEditorScreen/Sources/CreateLinkScreen.swift

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import ListSectionComponent
2121
import TelegramStringFormatting
2222
import MediaEditor
2323
import UrlEscaping
24+
import GlassBarButtonComponent
2425

2526
private let linkTag = GenericComponentViewTag()
2627
private let nameTag = GenericComponentViewTag()
@@ -69,8 +70,8 @@ private final class SheetContent: CombinedComponent {
6970

7071
static var body: Body {
7172
let background = Child(RoundedRectangle.self)
72-
let cancelButton = Child(Button.self)
73-
let doneButton = Child(Button.self)
73+
let cancelButton = Child(GlassBarButtonComponent.self)
74+
let doneButton = Child(GlassBarButtonComponent.self)
7475
let title = Child(Text.self)
7576
let urlSection = Child(ListSectionComponent.self)
7677
let nameSection = Child(ListSectionComponent.self)
@@ -85,7 +86,7 @@ private final class SheetContent: CombinedComponent {
8586
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
8687

8788
let sideInset: CGFloat = 16.0
88-
var contentSize = CGSize(width: context.availableSize.width, height: 18.0)
89+
var contentSize = CGSize(width: context.availableSize.width, height: 36.0)
8990

9091
let background = background.update(
9192
component: RoundedRectangle(color: theme.list.blocksBackgroundColor, cornerRadius: 8.0),
@@ -98,24 +99,28 @@ private final class SheetContent: CombinedComponent {
9899

99100
let constrainedTitleWidth = context.availableSize.width - 16.0 * 2.0
100101

102+
let barButtonSize = CGSize(width: 40.0, height: 40.0)
101103
let cancelButton = cancelButton.update(
102-
component: Button(
103-
content: AnyComponent(
104-
Text(
105-
text: strings.Common_Cancel,
106-
font: Font.regular(17.0),
107-
color: theme.actionSheet.controlAccentColor
104+
component: GlassBarButtonComponent(
105+
size: barButtonSize,
106+
backgroundColor: theme.rootController.navigationBar.glassBarButtonBackgroundColor,
107+
isDark: theme.overallDarkAppearance,
108+
state: .generic,
109+
component: AnyComponentWithIdentity(id: "close", component: AnyComponent(
110+
BundleIconComponent(
111+
name: "Navigation/Close",
112+
tintColor: theme.rootController.navigationBar.glassBarButtonForegroundColor
108113
)
109-
),
110-
action: {
114+
)),
115+
action: { _ in
111116
component.dismiss()
112117
}
113118
),
114119
availableSize: context.availableSize,
115120
transition: .immediate
116121
)
117122
context.add(cancelButton
118-
.position(CGPoint(x: sideInset + cancelButton.size.width / 2.0, y: contentSize.height + cancelButton.size.height / 2.0))
123+
.position(CGPoint(x: sideInset + cancelButton.size.width / 2.0, y: 16.0 + cancelButton.size.height / 2.0))
119124
)
120125

121126
let explicitLink = explicitUrl(context.component.link)
@@ -126,16 +131,19 @@ private final class SheetContent: CombinedComponent {
126131

127132
let controller = environment.controller
128133
let doneButton = doneButton.update(
129-
component: Button(
130-
content: AnyComponent(
131-
Text(
132-
text: strings.Common_Done,
133-
font: Font.bold(17.0),
134-
color: isValidLink ? theme.actionSheet.controlAccentColor : theme.actionSheet.secondaryTextColor
135-
)
136-
),
134+
component: GlassBarButtonComponent(
135+
size: barButtonSize,
136+
backgroundColor: isValidLink ? environment.theme.list.itemCheckColors.fillColor : environment.theme.list.itemCheckColors.fillColor.desaturated().withMultipliedAlpha(0.5),
137+
isDark: environment.theme.overallDarkAppearance,
138+
state: .tintedGlass,
137139
isEnabled: isValidLink,
138-
action: { [weak state] in
140+
component: AnyComponentWithIdentity(id: "done", component: AnyComponent(
141+
BundleIconComponent(
142+
name: "Navigation/Done",
143+
tintColor: environment.theme.list.itemCheckColors.foregroundColor
144+
)
145+
)),
146+
action: { [weak state] _ in
139147
if let controller = controller() as? CreateLinkScreen, let state {
140148
if state.complete(controller: controller) {
141149
component.dismiss()
@@ -147,17 +155,16 @@ private final class SheetContent: CombinedComponent {
147155
transition: .immediate
148156
)
149157
context.add(doneButton
150-
.position(CGPoint(x: context.availableSize.width - sideInset - doneButton.size.width / 2.0, y: contentSize.height + doneButton.size.height / 2.0))
158+
.position(CGPoint(x: context.availableSize.width - sideInset - doneButton.size.width / 2.0, y: 16.0 + doneButton.size.height / 2.0))
151159
)
152160

153-
154161
let title = title.update(
155162
component: Text(text: component.isEdit ? strings.MediaEditor_Link_EditTitle : strings.MediaEditor_Link_CreateTitle, font: Font.bold(17.0), color: theme.list.itemPrimaryTextColor),
156163
availableSize: CGSize(width: constrainedTitleWidth, height: context.availableSize.height),
157164
transition: .immediate
158165
)
159166
context.add(title
160-
.position(CGPoint(x: context.availableSize.width / 2.0, y: contentSize.height + title.size.height / 2.0))
167+
.position(CGPoint(x: context.availableSize.width / 2.0, y: contentSize.height))
161168
)
162169
contentSize.height += title.size.height
163170
contentSize.height += 40.0
@@ -222,6 +229,7 @@ private final class SheetContent: CombinedComponent {
222229
let urlSection = urlSection.update(
223230
component: ListSectionComponent(
224231
theme: theme,
232+
style: .glass,
225233
header: AnyComponent(MultilineTextComponent(
226234
text: .plain(NSAttributedString(
227235
string: strings.MediaEditor_Link_LinkTo_Title.uppercased(),
@@ -249,6 +257,7 @@ private final class SheetContent: CombinedComponent {
249257
let nameSection = nameSection.update(
250258
component: ListSectionComponent(
251259
theme: theme,
260+
style: .glass,
252261
header: AnyComponent(MultilineTextComponent(
253262
text: .plain(NSAttributedString(
254263
string: strings.MediaEditor_Link_LinkName_Title.uppercased(),
@@ -542,6 +551,7 @@ private final class CreateLinkSheetComponent: CombinedComponent {
542551
})
543552
}
544553
)),
554+
style: .glass,
545555
backgroundColor: .blur(.dark),
546556
followContentSizeChanges: true,
547557
clipsContent: true,
@@ -816,7 +826,7 @@ private final class LinkFieldComponent: Component {
816826
containerSize: availableSize
817827
)
818828

819-
let size = CGSize(width: availableSize.width, height: 44.0)
829+
let size = CGSize(width: availableSize.width, height: 52.0)
820830
if let placeholderComponentView = self.placeholderView.view {
821831
if placeholderComponentView.superview == nil {
822832
self.insertSubview(placeholderComponentView, at: 0)
@@ -827,7 +837,7 @@ private final class LinkFieldComponent: Component {
827837
placeholderComponentView.isHidden = !component.text.isEmpty
828838
}
829839

830-
self.textField.frame = CGRect(x: 15.0, y: 0.0, width: size.width - 30.0, height: 44.0)
840+
self.textField.frame = CGRect(x: 15.0, y: 4.0, width: size.width - 30.0, height: 44.0)
831841

832842
return size
833843
}

submodules/TelegramUI/Components/Stars/StarsWithdrawalScreen/Sources/StarsWithdrawalScreen.swift

Lines changed: 24 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ private final class SheetContent: CombinedComponent {
5656

5757
static var body: (CombinedComponentContext<SheetContent>) -> CGSize {
5858
let closeButton = Child(GlassBarButtonComponent.self)
59-
let cancelButton = Child(Button.self)
6059
let balance = Child(BalanceComponent.self)
6160
let title = Child(Text.self)
6261
let currencyToggle = Child(TabSelectorComponent.self)
@@ -115,46 +114,31 @@ private final class SheetContent: CombinedComponent {
115114
.position(CGPoint(x: balanceFrame.maxX, y: balanceFrame.minY))
116115
)
117116
}
118-
119-
let cancelButton = cancelButton.update(
120-
component: Button(
121-
content: AnyComponent(Text(text: environment.strings.Common_Cancel, font: Font.regular(17.0), color: environment.theme.list.itemAccentColor)),
122-
action: {
123-
component.dismiss()
124-
}
125-
).minSize(CGSize(width: 8.0, height: 44.0)),
126-
availableSize: CGSize(width: 200.0, height: 100.0),
127-
transition: .immediate
128-
)
129-
let closeFrame = CGRect(origin: CGPoint(x: 16.0, y: floor((56.0 - cancelButton.size.height) * 0.5)), size: cancelButton.size)
130-
context.add(cancelButton
131-
.position(closeFrame.center)
132-
)
133-
} else {
134-
let closeButton = closeButton.update(
135-
component: GlassBarButtonComponent(
136-
size: CGSize(width: 40.0, height: 40.0),
137-
backgroundColor: theme.rootController.navigationBar.glassBarButtonBackgroundColor,
138-
isDark: theme.overallDarkAppearance,
139-
state: .generic,
140-
component: AnyComponentWithIdentity(id: "close", component: AnyComponent(
141-
BundleIconComponent(
142-
name: "Navigation/Close",
143-
tintColor: theme.rootController.navigationBar.glassBarButtonForegroundColor
144-
)
145-
)),
146-
action: { _ in
147-
component.dismiss()
148-
}
149-
),
150-
availableSize: CGSize(width: 40.0, height: 40.0),
151-
transition: .immediate
152-
)
153-
context.add(closeButton
154-
.position(CGPoint(x: 16.0 + closeButton.size.width / 2.0, y: 16.0 + closeButton.size.height / 2.0))
155-
)
156117
}
157118

119+
let closeButton = closeButton.update(
120+
component: GlassBarButtonComponent(
121+
size: CGSize(width: 40.0, height: 40.0),
122+
backgroundColor: theme.rootController.navigationBar.glassBarButtonBackgroundColor,
123+
isDark: theme.overallDarkAppearance,
124+
state: .generic,
125+
component: AnyComponentWithIdentity(id: "close", component: AnyComponent(
126+
BundleIconComponent(
127+
name: "Navigation/Close",
128+
tintColor: theme.rootController.navigationBar.glassBarButtonForegroundColor
129+
)
130+
)),
131+
action: { _ in
132+
component.dismiss()
133+
}
134+
),
135+
availableSize: CGSize(width: 40.0, height: 40.0),
136+
transition: .immediate
137+
)
138+
context.add(closeButton
139+
.position(CGPoint(x: 16.0 + closeButton.size.width / 2.0, y: 16.0 + closeButton.size.height / 2.0))
140+
)
141+
158142
let titleString: String
159143
let amountTitle: String
160144
let amountPlaceholder: String
@@ -264,7 +248,7 @@ private final class SheetContent: CombinedComponent {
264248
.position(CGPoint(x: context.availableSize.width / 2.0, y: 36.0))
265249
)
266250
contentSize.height += title.size.height
267-
contentSize.height += 40.0
251+
contentSize.height += 56.0
268252

269253
let balance: StarsAmount?
270254
if case .accountWithdraw = component.mode {

0 commit comments

Comments
 (0)