Skip to content

Commit 231b2d3

Browse files
committed
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
2 parents ac2ba99 + b308f42 commit 231b2d3

File tree

107 files changed

+6674
-1462
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+6674
-1462
lines changed

Telegram/Telegram-iOS/en.lproj/Localizable.strings

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15434,3 +15434,72 @@ Error: %8$@";
1543415434
"LiveStream.ErrorMaxAllowedEmoji.Text_any" = "You can send up to %d emoji.";
1543515435

1543615436
"Stars.Purchase.StarGiftOfferInfo" = "Buy Stars to make a gift buy offer.";
15437+
15438+
"Notification.StarsGiftOffer.Offer" = "%1$@ offered you %2$@ for your gift %3$@";
15439+
"Notification.StarsGiftOffer.Offer.Stars_1" = "%@ Star";
15440+
"Notification.StarsGiftOffer.Offer.Stars_any" = "%@ Stars";
15441+
"Notification.StarsGiftOffer.OfferYou" = "You offered %1$@ %2$@ for their gift %3$@";
15442+
"Notification.StarsGiftOffer.OfferYou.Stars_1" = "%@ Star";
15443+
"Notification.StarsGiftOffer.OfferYou.Stars_any" = "%@ Stars";
15444+
15445+
"Notification.StarsGiftOffer.Accepted" = "%1$@ accepted your offer and sold you %2$@ for %3$@";
15446+
"Notification.StarsGiftOffer.Accepted.Stars_1" = "%@ Star";
15447+
"Notification.StarsGiftOffer.Accepted.Stars_any" = "%@ Stars";
15448+
"Notification.StarsGiftOffer.AcceptedYou" = "You sold %1$@ to %2$@ for %3$@";
15449+
"Notification.StarsGiftOffer.AcceptedYou.Stars_1" = "%@ Star";
15450+
"Notification.StarsGiftOffer.AcceptedYou.Stars_any" = "%@ Stars";
15451+
15452+
"Notification.StarsGiftOffer.Rejected" = "%1$@ rejected your offer for %2$@ – your %3$@ have been refunded";
15453+
"Notification.StarsGiftOffer.Rejected.Stars_1" = "%@ Star";
15454+
"Notification.StarsGiftOffer.Rejected.Stars_any" = "%@ Stars";
15455+
"Notification.StarsGiftOffer.RejectedYou" = "You rejected %1$@'s offer";
15456+
"Notification.StarsGiftOffer.RejectedYou.Stars_1" = "%@ Star";
15457+
"Notification.StarsGiftOffer.RejectedYou.Stars_any" = "%@ Stars";
15458+
15459+
"Notification.StarsGiftOffer.Expired" = "%1$@ didn't respond to your offer for %2$@ within %3$@ – your %4$@ have been refunded";
15460+
"Notification.StarsGiftOffer.Expired.Stars_1" = "%@ Star";
15461+
"Notification.StarsGiftOffer.Expired.Stars_any" = "%@ Stars";
15462+
"Notification.StarsGiftOffer.ExpiredYou" = "The offer from %1$@ to buy your %2$@ for %3$@ has expired";
15463+
"Notification.StarsGiftOffer.ExpiredYou.Stars_1" = "%@ Star";
15464+
"Notification.StarsGiftOffer.ExpiredYou.Stars_any" = "%@ Stars";
15465+
15466+
"CreateExternalStream.RevokeStreamKey" = "Revoke Stream Key";
15467+
"CreateExternalStream.Revoke.Text" = "Do you want to revoke the stream key?";
15468+
"CreateExternalStream.Revoke.Revoke" = "Revoke";
15469+
15470+
"Gift.AuctionBid.UntilEnd" = "until the end";
15471+
"Gift.AuctionBid.BeforeStart" = "before start";
15472+
"Gift.AuctionBid.RoundSubtitle" = "Round %@ of %@";
15473+
"Gift.AuctionBid.TopWinnersTotal" = "Top 3 of %@ Winners";
15474+
15475+
"Gift.Acquired.GiftRound" = "%1$@ in round %2$@";
15476+
15477+
"Gift.Options.Gift.Soon" = "soon";
15478+
15479+
"Chat.Auction.StartsIn" = "starts in ";
15480+
"Chat.Auction.View" = "VIEW";
15481+
"Chat.Auction.Upcoming" = "Upcoming Auction";
15482+
15483+
"Gift.Auction.Start" = "Start";
15484+
"Gift.Auction.End" = "End";
15485+
"Gift.Auction.Quantity" = "Quantity";
15486+
"Gift.Auction.TotalRounds" = "Rounds";
15487+
"Gift.Auction.TimeRound" = "Round %@";
15488+
"Gift.Auction.TimeRounds" = "Rounds %@";
15489+
"Gift.Auction.StartsInHours" = "auction starts in {h}:{m}:{s}";
15490+
"Gift.Auction.StartsInMinutes" = "auction starts in {m}:{s}";
15491+
"Gift.Auction.EarlyBid" = "Place an Early Bid";
15492+
15493+
"Gift.Auction.Hours_1" = "%@ hour";
15494+
"Gift.Auction.Hours_any" = "%@ hours";
15495+
"Gift.Auction.Minutes_1" = "%@ minute";
15496+
"Gift.Auction.Minutes_any" = "%@ minutes";
15497+
"Gift.Auction.Seconds_1" = "%@ second";
15498+
"Gift.Auction.Seconds_any" = "%@ seconds";
15499+
"Gift.Auction.HoursEach_1" = "%@ hour each";
15500+
"Gift.Auction.HoursEach_any" = "%@ hours each";
15501+
"Gift.Auction.MinutesEach_1" = "%@ minute each";
15502+
"Gift.Auction.MinutesEach_any" = "%@ minutes each";
15503+
"Gift.Auction.Extension" = "+ %1$@ for late bids in top %2$@";
15504+
15505+
"ChatList.Auctions.UpcomingAuction" = "Upcoming Auction";

submodules/AccountContext/Sources/AccountContext.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,11 +1422,13 @@ public protocol SharedAccountContext: AnyObject {
14221422
func makeStarsIntroScreen(context: AccountContext) -> ViewController
14231423
func makeGiftViewScreen(context: AccountContext, message: EngineMessage, shareStory: ((StarGift.UniqueGift) -> Void)?) -> ViewController
14241424
func makeGiftViewScreen(context: AccountContext, gift: StarGift.UniqueGift, shareStory: ((StarGift.UniqueGift) -> Void)?, openChatTheme: (() -> Void)?, dismissed: (() -> Void)?) -> ViewController
1425-
func makeGiftWearPreviewScreen(context: AccountContext, gift: StarGift.UniqueGift) -> ViewController
1425+
func makeGiftWearPreviewScreen(context: AccountContext, gift: StarGift, attributes: [StarGift.UniqueGift.Attribute]?) -> ViewController
1426+
func makeGiftUpgradePreviewScreen(context: AccountContext, attributes: [StarGift.UniqueGift.Attribute], peerName: String) -> ViewController
14261427
func makeGiftAuctionInfoScreen(context: AccountContext, auctionContext: GiftAuctionContext, completion: (() -> Void)?) -> ViewController
14271428
func makeGiftAuctionBidScreen(context: AccountContext, toPeerId: EnginePeer.Id, text: String?, entities: [MessageTextEntity]?, hideName: Bool, auctionContext: GiftAuctionContext, acquiredGifts: Signal<[GiftAuctionAcquiredGift], NoError>?) -> ViewController
14281429
func makeGiftAuctionViewScreen(context: AccountContext, auctionContext: GiftAuctionContext, completion: @escaping (Signal<[GiftAuctionAcquiredGift], NoError>) -> Void) -> ViewController
14291430
func makeGiftAuctionActiveBidsScreen(context: AccountContext) -> ViewController
1431+
func makeGiftOfferScreen(context: AccountContext, gift: StarGift.UniqueGift, peer: EnginePeer, amount: CurrencyAmount, commit: @escaping () -> Void) -> ViewController
14301432

14311433
func makeStorySharingScreen(context: AccountContext, subject: StorySharingSubject, parentController: ViewController) -> ViewController
14321434

submodules/BotPaymentsUI/Sources/BotCheckoutActionButton.swift

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ enum BotCheckoutActionButtonState: Equatable {
1313

1414
private let titleFont = Font.semibold(17.0)
1515

16-
final class BotCheckoutActionButton: HighlightableButtonNode {
16+
final class BotCheckoutActionButton: HighlightTrackingButtonNode {
1717
static var height: CGFloat = 52.0
1818

1919
private var activeFillColor: UIColor
2020
private var inactiveFillColor: UIColor
2121
private var foregroundColor: UIColor
2222

23-
private let activeBackgroundNode: ASImageNode
23+
private let activeBackgroundNode: ASDisplayNode
2424
private var applePayButton: UIButton?
2525
private let labelNode: TextNode
2626

@@ -29,23 +29,17 @@ final class BotCheckoutActionButton: HighlightableButtonNode {
2929

3030
private var placeholderNode: ShimmerEffectNode?
3131

32-
private var activeImage: UIImage?
33-
private var inactiveImage: UIImage?
34-
3532
init(activeFillColor: UIColor, inactiveFillColor: UIColor, foregroundColor: UIColor) {
3633
self.activeFillColor = activeFillColor
3734
self.inactiveFillColor = inactiveFillColor
3835
self.foregroundColor = foregroundColor
3936

40-
let diameter: CGFloat = 20.0
41-
self.activeImage = generateStretchableFilledCircleImage(diameter: diameter, color: activeFillColor)
42-
self.inactiveImage = generateStretchableFilledCircleImage(diameter: diameter, color: inactiveFillColor)
37+
let diameter: CGFloat = 52.0
4338

44-
self.activeBackgroundNode = ASImageNode()
45-
self.activeBackgroundNode.displaysAsynchronously = false
46-
self.activeBackgroundNode.displayWithoutProcessing = true
39+
self.activeBackgroundNode = ASDisplayNode()
4740
self.activeBackgroundNode.isLayerBacked = true
48-
self.activeBackgroundNode.image = self.activeImage
41+
self.activeBackgroundNode.backgroundColor = activeFillColor
42+
self.activeBackgroundNode.cornerRadius = diameter / 2.0
4943

5044
self.labelNode = TextNode()
5145
self.labelNode.displaysAsynchronously = false
@@ -55,6 +49,21 @@ final class BotCheckoutActionButton: HighlightableButtonNode {
5549

5650
self.addSubnode(self.activeBackgroundNode)
5751
self.addSubnode(self.labelNode)
52+
53+
self.highligthedChanged = { [weak self] highlighted in
54+
guard let self else {
55+
return
56+
}
57+
let transition = ContainedViewLayoutTransition.animated(duration: highlighted ? 0.25 : 0.35, curve: .spring)
58+
if highlighted {
59+
let highlightedColor = self.activeFillColor.withMultiplied(hue: 1.0, saturation: 0.77, brightness: 1.01)
60+
transition.updateBackgroundColor(node: self.activeBackgroundNode, color: highlightedColor)
61+
transition.updateTransformScale(node: self, scale: 1.05)
62+
} else {
63+
transition.updateBackgroundColor(node: self.activeBackgroundNode, color: self.activeFillColor)
64+
transition.updateTransformScale(node: self, scale: 1.0)
65+
}
66+
}
5867
}
5968

6069
func setState(_ state: BotCheckoutActionButtonState) {
@@ -93,14 +102,8 @@ final class BotCheckoutActionButton: HighlightableButtonNode {
93102
placeholderNode.removeFromSupernode()
94103
}
95104

96-
let image = isEnabled ? self.activeImage : self.inactiveImage
97-
if let image = image, let currentImage = self.activeBackgroundNode.image, currentImage !== image {
98-
self.activeBackgroundNode.image = image
99-
self.activeBackgroundNode.layer.animate(from: currentImage.cgImage! as AnyObject, to: image.cgImage! as AnyObject, keyPath: "contents", timingFunction: CAMediaTimingFunctionName.linear.rawValue, duration: 0.2)
100-
} else {
101-
self.activeBackgroundNode.image = image
102-
}
103-
105+
self.activeBackgroundNode.backgroundColor = isEnabled ? self.activeFillColor : self.inactiveFillColor
106+
104107
let makeLayout = TextNode.asyncLayout(self.labelNode)
105108
let (labelLayout, labelApply) = makeLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: title, font: titleFont, textColor: self.foregroundColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: size, alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
106109
let _ = labelApply()

submodules/BotPaymentsUI/Sources/BotCheckoutControllerNode.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,31 +259,31 @@ enum BotCheckoutEntry: ItemListNodeEntry {
259259
}
260260
})
261261
case let .paymentMethod(_, text, value):
262-
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
262+
return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, title: text, label: value, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
263263
arguments.openPaymentMethod()
264264
})
265265
case let .shippingInfo(_, text, value):
266-
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
266+
return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, title: text, label: value, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
267267
arguments.openInfo(.address(.street1))
268268
})
269269
case let .shippingMethod(_, text, value):
270-
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
270+
return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, title: text, label: value, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
271271
arguments.openShippingMethod()
272272
})
273273
case let .nameInfo(_, text, value):
274-
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
274+
return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, title: text, label: value, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
275275
arguments.openInfo(.name)
276276
})
277277
case let .emailInfo(_, text, value):
278-
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
278+
return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, title: text, label: value, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
279279
arguments.openInfo(.email)
280280
})
281281
case let .phoneInfo(_, text, value):
282-
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
282+
return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, title: text, label: value, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
283283
arguments.openInfo(.phone)
284284
})
285285
case let .actionPlaceholder(_, shimmeringIndex):
286-
return ItemListDisclosureItem(presentationData: presentationData, title: " ", label: " ", sectionId: self.section, style: .blocks, disclosureStyle: .none, action: {
286+
return ItemListDisclosureItem(presentationData: presentationData, systemStyle: .glass, title: " ", label: " ", sectionId: self.section, style: .blocks, disclosureStyle: .none, action: {
287287
}, shimmeringIndex: shimmeringIndex)
288288
}
289289
}
@@ -1245,7 +1245,7 @@ final class BotCheckoutControllerNode: ItemListControllerNode, PKPaymentAuthoriz
12451245
override func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition, additionalInsets: UIEdgeInsets) {
12461246
var updatedInsets = layout.intrinsicInsets
12471247

1248-
let bottomPanelHorizontalInset: CGFloat = 16.0
1248+
let bottomPanelHorizontalInset: CGFloat = 30.0
12491249

12501250
var botName: String?
12511251
if let botPeer = self.botPeerValue {

submodules/BotPaymentsUI/Sources/BotCheckoutHeaderItem.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ class BotCheckoutHeaderItemNode: ListViewItemNode {
270270
strongSelf.bottomStripeNode.isHidden = hasCorners
271271
}
272272

273-
strongSelf.maskNode.image = hasCorners ? PresentationResourcesItemList.cornersImage(item.theme, top: hasTopCorners, bottom: hasBottomCorners) : nil
273+
strongSelf.maskNode.image = hasCorners ? PresentationResourcesItemList.cornersImage(item.theme, top: hasTopCorners, bottom: hasBottomCorners, glass: true) : nil
274274

275275
strongSelf.bottomStripeNode.frame = CGRect(origin: CGPoint(x: 0.0, y: contentSize.height - separatorHeight), size: CGSize(width: params.width, height: separatorHeight))
276276

submodules/BotPaymentsUI/Sources/BotCheckoutPriceItem.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,13 @@ class BotCheckoutPriceItemNode: ListViewItemNode {
141141
let naturalContentHeight: CGFloat
142142
var verticalOffset: CGFloat = 0.0
143143
if item.isFinal {
144-
naturalContentHeight = 44.0
144+
naturalContentHeight = 52.0
145145
} else {
146146
switch neighbors.bottom {
147147
case .otherSection, .none:
148-
naturalContentHeight = 44.0
148+
naturalContentHeight = 52.0
149149
default:
150-
naturalContentHeight = 34.0
150+
naturalContentHeight = 42.0
151151
}
152152
}
153153
if let _ = previousItem as? BotCheckoutHeaderItem {
@@ -209,7 +209,7 @@ class BotCheckoutPriceItemNode: ListViewItemNode {
209209
strongSelf.separatorNode.backgroundColor = item.theme.list.itemBlocksSeparatorColor
210210
strongSelf.separatorNode.frame = CGRect(origin: CGPoint(x: leftInset, y: 0.0), size: CGSize(width: params.width - leftInset, height: UIScreenPixel))
211211

212-
strongSelf.maskNode.image = hasCorners ? PresentationResourcesItemList.cornersImage(item.theme, top: hasTopCorners, bottom: hasBottomCorners) : nil
212+
strongSelf.maskNode.image = hasCorners ? PresentationResourcesItemList.cornersImage(item.theme, top: hasTopCorners, bottom: hasBottomCorners, glass: true) : nil
213213

214214
strongSelf.bottomSeparatorNode.backgroundColor = item.theme.list.itemBlocksSeparatorColor
215215
strongSelf.bottomSeparatorNode.frame = CGRect(origin: CGPoint(x: 0.0, y: contentSize.height), size: CGSize(width: params.width, height: UIScreenPixel))

submodules/BotPaymentsUI/Sources/BotPaymentActionItemNode.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,17 @@ final class BotPaymentActionItemNode: BotPaymentItemNode {
7070
self.titleNode.attributedText = NSAttributedString(string: self.title, font: titleFont, textColor: theme.list.itemAccentColor)
7171
}
7272

73-
self.buttonNode.frame = CGRect(origin: CGPoint(x: sideInset, y: 0.0), size: CGSize(width: width - sideInset * 2.0, height: 44.0))
74-
transition.updateFrame(node: self.highlightedBackgroundNode, frame: CGRect(origin: CGPoint(), size: CGSize(width: width, height: 44.0 + UIScreenPixel)))
73+
let height: CGFloat = 52.0
74+
75+
self.buttonNode.frame = CGRect(origin: CGPoint(x: sideInset, y: 0.0), size: CGSize(width: width - sideInset * 2.0, height: height))
76+
transition.updateFrame(node: self.highlightedBackgroundNode, frame: CGRect(origin: CGPoint(), size: CGSize(width: width, height: height + UIScreenPixel)))
7577

7678
let leftInset: CGFloat = 16.0
7779

7880
let titleSize = self.titleNode.measure(CGSize(width: width - leftInset - 32.0 - sideInset * 2.0, height: CGFloat.greatestFiniteMagnitude))
79-
transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: leftInset + sideInset, y: 11.0), size: titleSize))
81+
transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: leftInset + sideInset, y: 16.0), size: titleSize))
8082

81-
return 44.0
83+
return height
8284
}
8385

8486
@objc func buttonPressed() {

submodules/BotPaymentsUI/Sources/BotPaymentCardInputItemNode.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ final class BotPaymentCardInputItemNode: BotPaymentItemNode, STPPaymentCardTextF
4545
self.cardField.keyboardAppearance = theme.rootController.keyboardColor.keyboardAppearance
4646
}
4747

48-
self.cardField.frame = CGRect(origin: CGPoint(x: 5.0 + sideInset, y: 0.0), size: CGSize(width: width - 10.0 - sideInset * 2.0, height: 44.0))
48+
self.cardField.frame = CGRect(origin: CGPoint(x: 5.0 + sideInset, y: 4.0), size: CGSize(width: width - 10.0 - sideInset * 2.0, height: 44.0))
4949

50-
return 44.0
50+
return 52.0
5151
}
5252

5353
func paymentCardTextFieldDidChange(_ textField: STPPaymentCardTextField) {

0 commit comments

Comments
 (0)