Skip to content

Commit 2cb0c7f

Browse files
committed
Various improvements
1 parent 4660f67 commit 2cb0c7f

File tree

12 files changed

+464
-192
lines changed

12 files changed

+464
-192
lines changed

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

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15517,6 +15517,9 @@ Error: %8$@";
1551715517
"Attachment.FilesSearchPlaceholder" = "Search shared audio";
1551815518
"Chat.GiftPurchaseOffer.Reject" = "Reject";
1551915519
"Chat.GiftPurchaseOffer.Accept" = "Accept";
15520+
"Chat.GiftPurchaseOffer.RejectConfirmation.Title" = "Reject Offer";
15521+
"Chat.GiftPurchaseOffer.RejectConfirmation.Text" = "Are you sure you want to reject the offer from **%@**?";
15522+
"Chat.GiftPurchaseOffer.RejectConfirmation.Reject" = "Reject";
1552015523

1552115524
"Passkeys.DeleteAlert.Title" = "Delete Passkey?";
1552215525
"Passkeys.DeleteAlert.Text" = "Once deleted, this passkey can't be used to log in.\n\nDon't forget to remove it from your password manager too.";
@@ -15559,13 +15562,13 @@ Error: %8$@";
1555915562
"Gift.Variants.Backdrops" = "Backdrops";
1556015563
"Gift.Variants.Symbols" = "Symbols";
1556115564

15562-
"Gift.Variants.CollectionInfo" = "This collection features";
15563-
"Gift.Variants.CollectionInfo.Model_1" = "%@ unique model";
15564-
"Gift.Variants.CollectionInfo.Model_any" = "%@ unique models";
15565-
"Gift.Variants.CollectionInfo.Backdrop_1" = "%@ unique backdrop";
15566-
"Gift.Variants.CollectionInfo.Backdrop_any" = "%@ unique backdrops";
15567-
"Gift.Variants.CollectionInfo.Symbol_1" = "%@ unique symbol";
15568-
"Gift.Variants.CollectionInfo.Symbol_any" = "%@ unique symbols";
15565+
"Gift.Variants.CollectionInfo" = "This collection features %@";
15566+
"Gift.Variants.CollectionInfo.Model_1" = "**%@** unique model";
15567+
"Gift.Variants.CollectionInfo.Model_any" = "**%@** unique models";
15568+
"Gift.Variants.CollectionInfo.Backdrop_1" = "**%@** unique backdrop";
15569+
"Gift.Variants.CollectionInfo.Backdrop_any" = "**%@** unique backdrops";
15570+
"Gift.Variants.CollectionInfo.Symbol_1" = "**%@** unique symbol";
15571+
"Gift.Variants.CollectionInfo.Symbol_any" = "**%@** unique symbols";
1556915572

1557015573
"Gift.Auction.GiftAuction" = "Upcoming Auction";
1557115574
"Gift.Auction.UpcomingAuction" = "Upcoming Auction";
@@ -15589,6 +15592,34 @@ Error: %8$@";
1558915592
"Gift.Offer.Duration.Hours_1" = "%@ Hour";
1559015593
"Gift.Offer.Duration.Hours_any" = "%@ Hours";
1559115594
"Gift.Offer.Offer" = "Offer";
15595+
"Gift.Offer.GiftMinAmountToast.Text" = "You cannot offer less than %@ for this gift";
1559215596

15597+
"Gift.WearPreview.Limited" = "limited";
15598+
"Gift.WearPreview.Upgraded" = "upgraded";
15599+
"Gift.WearPreview.FreeUpgrade" = "Free\nUpgrade";
15600+
"Gift.WearPreview.LearnMore" = "Learn more about wearing Telegram Gifts >";
1559315601

1559415602
"Notification.StarGift.Sold" = "sold";
15603+
"Notification.StarGiftOffer.Offer" = "**%1$@** offered you **%2$@** for your gift **%3$@**.";
15604+
"Notification.StarGiftOffer.OfferYou" = "You offered **%1$@** **%2$@** for their gift **%3$@**.";
15605+
"Notification.StarGiftOffer.Offer.Stars_1" = "%@ Star";
15606+
"Notification.StarGiftOffer.Offer.Stars_any" = "%@ Stars";
15607+
15608+
"Notification.StarGiftOffer.Status.Accepted" = "This offer was accepted.";
15609+
"Notification.StarGiftOffer.Status.Expired" = "This offer has expired.";
15610+
"Notification.StarGiftOffer.Status.Expires" = "This offer expires in %@";
15611+
"Notification.StarGiftOffer.Status.Rejected" = "This offer was rejected.";
15612+
15613+
"Notification.StarGiftOffer.Expiration.Hours_1" = "%@ h";
15614+
"Notification.StarGiftOffer.Expiration.Hours_any" = "%@ h";
15615+
"Notification.StarGiftOffer.Expiration.Minutes_1" = "%@ m";
15616+
"Notification.StarGiftOffer.Expiration.Minutes_any" = "%@ m";
15617+
"Notification.StarGiftOffer.Expiration.Delimiter" = "";
15618+
15619+
"Chat.GiftPurchaseOffer.AcceptConfirmation.Title" = "Confirm Sale";
15620+
"Chat.GiftPurchaseOffer.AcceptConfirmation.Text" = "Do you want to sell **%1$@** to %2$@ for **%3$@**? You'll receive **%4$@** after fees.";
15621+
"Chat.GiftPurchaseOffer.AcceptConfirmation.Text.Stars_1" = "%@ Star";
15622+
"Chat.GiftPurchaseOffer.AcceptConfirmation.Text.Stars_any" = "%@ Stars";
15623+
"Chat.GiftPurchaseOffer.AcceptConfirmation.BadValue" = "The value of this gift is **%@** higher than the offer.";
15624+
"Chat.GiftPurchaseOffer.AcceptConfirmation.Confirm" = "Confirm Sale";
15625+

submodules/TelegramUI/Components/Chat/ChatMessageGiftOfferBubbleContentNode/Sources/ChatMessageGiftOfferBubbleContentNode.swift

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public class ChatMessageGiftOfferBubbleContentNode: ChatMessageBubbleContentNode
129129
let priceString: String
130130
switch amount.currency {
131131
case .stars:
132-
priceString = "\(amount.amount) Stars"
132+
priceString = item.presentationData.strings.Notification_StarGiftOffer_Offer_Stars(Int32(clamping: amount.amount.value))
133133
case .ton:
134134
priceString = "\(amount.amount) TON"
135135
}
@@ -143,41 +143,35 @@ public class ChatMessageGiftOfferBubbleContentNode: ChatMessageBubbleContentNode
143143
giftTitle = ""
144144
}
145145

146-
//TODO:localize
147146
if incoming {
148-
text = "**\(peerName)** offered you **\(priceString)** for your gift **\(giftTitle)**."
147+
text = item.presentationData.strings.Notification_StarGiftOffer_Offer(peerName, priceString, giftTitle).string
149148
} else {
150-
text = "You offered **\(peerName)** **\(priceString)** for their gift **\(giftTitle)**."
149+
text = item.presentationData.strings.Notification_StarGiftOffer_OfferYou(peerName, priceString, giftTitle).string
151150
}
152151

153152
if isAccepted {
154-
additionalText = "This offer was accepted."
153+
additionalText = item.presentationData.strings.Notification_StarGiftOffer_Status_Accepted
155154
} else if isDeclined {
156-
additionalText = "This offer was rejected."
155+
additionalText = item.presentationData.strings.Notification_StarGiftOffer_Status_Rejected
157156
} else if expireDate > currentTimestamp {
158157
func textForTimeout(_ value: Int32) -> String {
159158
if value < 3600 {
160159
let minutes = value / 60
161-
//let seconds = value % 60
162-
//let secondsPadding = seconds < 10 ? "0" : ""
163-
return "\(minutes)m" //\(secondsPadding)\(seconds)"
160+
return item.presentationData.strings.Notification_StarGiftOffer_Expiration_Minutes(minutes)
164161
} else {
165162
let hours = value / 3600
166163
let minutes = (value % 3600) / 60
167-
let minutesPadding = minutes < 10 ? "0" : ""
168-
//let seconds = value % 60
169-
//let secondsPadding = seconds < 10 ? "0" : ""
170-
return "\(hours)h \(minutesPadding)\(minutes)m" //:\(secondsPadding)\(seconds)"
164+
return item.presentationData.strings.Notification_StarGiftOffer_Expiration_Hours(hours) + item.presentationData.strings.Notification_StarGiftOffer_Expiration_Delimiter + item.presentationData.strings.Notification_StarGiftOffer_Expiration_Minutes(minutes)
171165
}
172166
}
173167
let delta = expireDate - currentTimestamp
174-
additionalText = "This offer expires in \(textForTimeout(delta))."
175-
168+
additionalText = item.presentationData.strings.Notification_StarGiftOffer_Status_Expires(textForTimeout(delta)).string
169+
176170
if incoming {
177171
hasActionButtons = true
178172
}
179173
} else {
180-
additionalText = "This offer has expired."
174+
additionalText = item.presentationData.strings.Notification_StarGiftOffer_Status_Expired
181175
}
182176
} else {
183177
text = ""
@@ -277,8 +271,6 @@ public class ChatMessageGiftOfferBubbleContentNode: ChatMessageBubbleContentNode
277271
)
278272
if let giftIconView = strongSelf.giftIcon.view {
279273
if giftIconView.superview == nil {
280-
// backgroundView.layer.cornerRadius = 20.0
281-
//backgroundView.clipsToBounds = true
282274
strongSelf.view.addSubview(giftIconView)
283275
}
284276
giftIconView.frame = CGRect(origin: CGPoint(x: mediaBackgroundFrame.minX + floorToScreenPixels((mediaBackgroundFrame.width - iconSize.width) / 2.0), y: mediaBackgroundFrame.minY + 17.0), size: iconSize)

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,9 @@ public final class GiftItemComponent: Component {
601601
}
602602
case let .preview(attributes, _):
603603
animationOffset = 16.0
604-
explicitAnimationOffset = -4.0
604+
if component.mode != .tableIcon {
605+
explicitAnimationOffset = -4.0
606+
}
605607
for attribute in attributes {
606608
switch attribute {
607609
case let .model(_, file, _):

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

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,7 +1727,7 @@ private final class GiftSetupScreenComponent: Component {
17271727
inactiveValue: "",
17281728
inactiveTitleColor: theme.list.itemSecondaryTextColor,
17291729
activeTitle: "",
1730-
activeValue: environment.strings.Gift_Send_Sold(sold),
1730+
activeValue: sold > 0 ? environment.strings.Gift_Send_Sold(sold) : "",
17311731
activeTitleColor: .white,
17321732
badgeText: "",
17331733
badgePosition: position,
@@ -1830,22 +1830,30 @@ private final class GiftSetupScreenComponent: Component {
18301830

18311831
var buttonTitleItems: [AnyComponentWithIdentity<Empty>] = []
18321832
if let _ = self.giftAuction {
1833-
let buttonAttributedString = NSMutableAttributedString(string: environment.strings.Gift_Setup_PlaceBid, font: Font.semibold(17.0), textColor: theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center)
1834-
buttonTitleItems.append(AnyComponentWithIdentity(id: "bid", component: AnyComponent(
1835-
MultilineTextComponent(text: .plain(buttonAttributedString))
1836-
)))
1833+
var isUpcoming = false
18371834
if let giftAuctionState = self.giftAuctionState {
18381835
switch giftAuctionState.auctionState {
1839-
case let .ongoing(_, _, endTime, _, _, _, _, _, _, _, _, _):
1836+
case let .ongoing(_, startTime, endTime, _, _, _, _, _, _, _, _, _):
18401837
let currentTime = Int32(CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970)
1841-
1842-
let endTimeout = max(0, endTime - currentTime)
1838+
let endTimeout: Int32
1839+
if currentTime < startTime {
1840+
endTimeout = max(0, startTime - currentTime)
1841+
isUpcoming = true
1842+
} else {
1843+
endTimeout = max(0, endTime - currentTime)
1844+
}
18431845

18441846
let hours = Int(endTimeout / 3600)
18451847
let minutes = Int((endTimeout % 3600) / 60)
18461848
let seconds = Int(endTimeout % 60)
18471849

1848-
let rawString = hours > 0 ? environment.strings.Gift_Auction_TimeLeftHours : environment.strings.Gift_Auction_TimeLeftMinutes
1850+
let rawString: String
1851+
if isUpcoming {
1852+
rawString = hours > 0 ? environment.strings.Gift_Auction_StartsInHours : environment.strings.Gift_Auction_StartsInMinutes
1853+
} else {
1854+
rawString = hours > 0 ? environment.strings.Gift_Auction_TimeLeftHours : environment.strings.Gift_Auction_TimeLeftMinutes
1855+
}
1856+
18491857
var buttonAnimatedTitleItems: [AnimatedTextComponent.Item] = []
18501858
var startIndex = rawString.startIndex
18511859
while true {
@@ -1885,6 +1893,10 @@ private final class GiftSetupScreenComponent: Component {
18851893
buttonIsEnabled = false
18861894
}
18871895
}
1896+
let buttonAttributedString = NSMutableAttributedString(string: isUpcoming ? environment.strings.Gift_Auction_EarlyBid : environment.strings.Gift_Setup_PlaceBid, font: Font.semibold(17.0), textColor: theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center)
1897+
buttonTitleItems.insert(AnyComponentWithIdentity(id: "bid", component: AnyComponent(
1898+
MultilineTextComponent(text: .plain(buttonAttributedString))
1899+
)), at: 0)
18881900
} else {
18891901
let buttonAttributedString = NSMutableAttributedString(string: buttonString, font: Font.semibold(17.0), textColor: theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center)
18901902
if let range = buttonAttributedString.string.range(of: "#"), let starImage = self.cachedStarImage?.0 {

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2493,7 +2493,19 @@ private final class GiftAuctionBidScreenComponent: Component {
24932493
untilNextRoundAnimatedItems.append(AnimatedTextComponent.Item(id: "s", content: .number(seconds, minDigits: 2)))
24942494
}
24952495

2496-
dropsLeftAnimatedItems = [AnimatedTextComponent.Item(id: "drops", content: .number(Int(dropsLeft), minDigits: 1))]
2496+
if dropsLeft >= 10000 {
2497+
var compactString = compactNumericCountString(Int(dropsLeft), decimalSeparator: ".", showDecimalPart: false)
2498+
let suffix = String(compactString.suffix(1))
2499+
compactString.removeLast()
2500+
if let value = Int(compactString) {
2501+
dropsLeftAnimatedItems = [
2502+
AnimatedTextComponent.Item(id: "drops", content: .number(value, minDigits: 1)),
2503+
AnimatedTextComponent.Item(id: "suffix", content: .text(suffix))
2504+
]
2505+
}
2506+
} else {
2507+
dropsLeftAnimatedItems = [AnimatedTextComponent.Item(id: "drops", content: .number(Int(dropsLeft), minDigits: 1))]
2508+
}
24972509
}
24982510

24992511
auctionStats.append((

0 commit comments

Comments
 (0)