Skip to content

Commit 3bbb677

Browse files
committed
Various fixes
1 parent 7efcdb4 commit 3bbb677

File tree

8 files changed

+14
-44
lines changed

8 files changed

+14
-44
lines changed

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13539,11 +13539,6 @@ Sorry for the inconvenience.";
1353913539
"Gift.View.UpgradeForFree" = "Upgrade for Free";
1354013540
"Gift.View.KeepUpgradeOrConvertDescription" = "You can keep this gift, upgrade it, or sell it for %@. [More About Stars >]()";
1354113541

13542-
"PeerInfo.VerificationInfo.Bot" = "This bot is verified as official by the representatives of Telegram.";
13543-
"PeerInfo.VerificationInfo.Channel" = "This channel is verified as official by the representatives of Telegram.";
13544-
"PeerInfo.VerificationInfo.Group" = "This group is verified as official by the representatives of Telegram.";
13545-
"PeerInfo.VerificationInfo.URL" = "https://telegram.org/verify";
13546-
1354713542
"ChatList.ToastFolderMutedV2" = "All chats in {folder} are now muted";
1354813543
"ChatList.ToastFolderUnmutedV2" = "All chats in {folder} are now unmuted";
1354913544
"ChatList.AddedToFolderTooltipV2" = "{chat} has been added to folder {folder}";

submodules/TelegramStringFormatting/Sources/ServiceMessageStrings.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
10961096
attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_Sent(authorName, starsPrice)._tuple, body: bodyAttributes, argumentAttributes: attributes)
10971097
}
10981098
}
1099-
case let .starGiftUnique(gift, isUpgrade, isTransferred, _, _, _, _):
1099+
case let .starGiftUnique(gift, isUpgrade, _, _, _, _, _):
11001100
if case let .unique(gift) = gift {
11011101
if !forAdditionalServiceMessage {
11021102
attributedString = NSAttributedString(string: "\(gift.title) #\(gift.number)", font: titleFont, textColor: primaryTextColor)
@@ -1113,7 +1113,7 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
11131113
let attributes = peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: peerIds)
11141114
attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_Upgrade(peerName)._tuple, body: bodyAttributes, argumentAttributes: attributes)
11151115
}
1116-
} else if isTransferred {
1116+
} else {
11171117
if message.author?.id == accountPeerId {
11181118
attributedString = NSAttributedString(string: strings.Notification_StarsGift_TransferYou, font: titleFont, textColor: primaryTextColor)
11191119
} else {

submodules/TelegramUI/Components/ButtonComponent/Sources/ButtonComponent.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ public final class ButtonComponent: Component {
557557
} else {
558558
shimmeringTransition = .immediate
559559
shimmeringView = ButtonShimmeringView(frame: .zero)
560+
self.shimmeringView = shimmeringView
560561
self.insertSubview(shimmeringView, at: 0)
561562
}
562563
shimmeringView.update(size: availableSize, background: component.background, cornerRadius: component.background.cornerRadius, transition: shimmeringTransition)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
462462
buttonTitle = item.presentationData.strings.Notification_PremiumPrize_View
463463
hasServiceMessage = false
464464
}
465-
case let .starGift(gift, convertStars, giftText, giftEntities, _, savedToProfile, converted, upgraded, _, upgradeStars, isRefunded, _):
465+
case let .starGift(gift, convertStars, giftText, giftEntities, _, savedToProfile, converted, upgraded, canUpgrade, upgradeStars, isRefunded, _):
466466
if case let .generic(gift) = gift {
467467
isStarGift = true
468468
let authorName = item.message.author.flatMap { EnginePeer($0) }?.compactDisplayTitle ?? ""
@@ -486,7 +486,7 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
486486
text = item.presentationData.strings.Notification_StarGift_Subtitle_Converted(item.presentationData.strings.Notification_StarGift_Subtitle_Converted_Stars(Int32(convertStars ?? 0))).string
487487
} else if upgradeStars != nil {
488488
text = item.presentationData.strings.Notification_StarGift_Subtitle_Upgrade
489-
} else if isSelfGift {
489+
} else if isSelfGift && canUpgrade {
490490
text = item.presentationData.strings.Notification_StarsGift_Subtitle_Self
491491
} else if savedToProfile {
492492
if let convertStars {

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ final class GiftOptionsScreenComponent: Component {
476476
let bottomContentInset: CGFloat = 24.0
477477
let sideInset: CGFloat = 16.0 + environment.safeInsets.left
478478
let sectionSpacing: CGFloat = 24.0
479+
let headerSideInset: CGFloat = 24.0 + environment.safeInsets.left
479480

480481
let _ = bottomContentInset
481482
let _ = sectionSpacing
@@ -620,7 +621,7 @@ final class GiftOptionsScreenComponent: Component {
620621
horizontalAlignment: .center
621622
)),
622623
environment: {},
623-
containerSize: CGSize(width: availableSize.width, height: 100.0)
624+
containerSize: CGSize(width: availableSize.width - headerSideInset * 2.0, height: 100.0)
624625
)
625626
if let premiumTitleView = self.premiumTitle.view {
626627
if premiumTitleView.superview == nil {
@@ -676,7 +677,7 @@ final class GiftOptionsScreenComponent: Component {
676677
}
677678
)),
678679
environment: {},
679-
containerSize: CGSize(width: availableSize.width, height: 1000.0)
680+
containerSize: CGSize(width: availableSize.width - headerSideInset * 2.0, height: 1000.0)
680681
)
681682
let premiumDescriptionFrame = CGRect(origin: CGPoint(x: floor((availableSize.width - premiumDescriptionSize.width) / 2.0), y: contentHeight), size: premiumDescriptionSize)
682683
if let premiumDescriptionView = self.premiumDescription.view {
@@ -818,7 +819,7 @@ final class GiftOptionsScreenComponent: Component {
818819
horizontalAlignment: .center
819820
)),
820821
environment: {},
821-
containerSize: CGSize(width: availableSize.width, height: 100.0)
822+
containerSize: CGSize(width: availableSize.width - headerSideInset * 2.0, height: 100.0)
822823
)
823824
if let starsTitleView = self.starsTitle.view {
824825
if starsTitleView.superview == nil {
@@ -864,7 +865,7 @@ final class GiftOptionsScreenComponent: Component {
864865
}
865866
)),
866867
environment: {},
867-
containerSize: CGSize(width: availableSize.width, height: 1000.0)
868+
containerSize: CGSize(width: availableSize.width - headerSideInset * 2.0, height: 1000.0)
868869
)
869870
let starsDescriptionFrame = CGRect(origin: CGPoint(x: floor((availableSize.width - starsDescriptionSize.width) / 2.0), y: contentHeight), size: starsDescriptionSize)
870871
if let starsDescriptionView = self.starsDescription.view {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,7 +1790,7 @@ public class GiftViewScreen: ViewControllerComponentContainer {
17901790
context: AccountContext,
17911791
subject: GiftViewScreen.Subject,
17921792
forceDark: Bool = false,
1793-
updateSavedToProfile: ((Bool) -> Void)? = nil,
1793+
updateSavedToProfile: ((EngineMessage.Id, Bool) -> Void)? = nil,
17941794
convertToStars: (() -> Void)? = nil,
17951795
transferGift: ((Bool, EnginePeer.Id) -> Void)? = nil,
17961796
upgradeGift: ((Int64?, Bool) -> Signal<ProfileGiftsContext.State.StarGift, UpgradeStarGiftError>)? = nil
@@ -1890,7 +1890,7 @@ public class GiftViewScreen: ViewControllerComponentContainer {
18901890
}
18911891

18921892
if let updateSavedToProfile {
1893-
updateSavedToProfile(added)
1893+
updateSavedToProfile(messageId, added)
18941894
} else {
18951895
let _ = (context.engine.payments.updateStarGiftAddedToProfile(messageId: messageId, added: added)
18961896
|> deliverOnMainQueue).startStandalone()

submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,17 +1641,6 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
16411641
context.sharedContext.openExternalUrl(context: context, urlContext: .generic, url: url, forceExternal: false, presentationData: presentationData, navigationController: navigationController, dismissInput: {})
16421642
}
16431643
}))
1644-
} else if user.isVerified {
1645-
let description = presentationData.strings.PeerInfo_VerificationInfo_Bot
1646-
1647-
let attributedPrefix = NSMutableAttributedString(string: " ")
1648-
attributedPrefix.addAttribute(ChatTextInputAttributes.customEmoji, value: ChatTextInputTextCustomEmojiAttribute(interactivelySelectedFromPackId: nil, fileId: 0, file: nil, custom: .verification), range: NSMakeRange(0, 1))
1649-
1650-
items[currentPeerInfoSection]!.append(PeerInfoScreenCommentItem(id: 800, text: description, attributedPrefix: attributedPrefix, useAccentLinkColor: false, linkAction: { action in
1651-
if case .tap = action, let navigationController = interaction.getController()?.navigationController as? NavigationController {
1652-
context.sharedContext.openExternalUrl(context: context, urlContext: .generic, url: presentationData.strings.PeerInfo_VerificationInfo_URL, forceExternal: false, presentationData: presentationData, navigationController: navigationController, dismissInput: {})
1653-
}
1654-
}))
16551644
} else if let botInfo = user.botInfo, botInfo.flags.contains(.worksWithGroups) {
16561645
items[currentPeerInfoSection]!.append(PeerInfoScreenActionItem(id: 7, text: presentationData.strings.Bot_AddToChat, color: .accent, action: {
16571646
interaction.openAddBotToGroup()
@@ -1821,22 +1810,6 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
18211810
context.sharedContext.openExternalUrl(context: context, urlContext: .generic, url: url, forceExternal: false, presentationData: presentationData, navigationController: navigationController, dismissInput: {})
18221811
}
18231812
}))
1824-
} else if channel.isVerified {
1825-
let description: String
1826-
if case .group = channel.info {
1827-
description = presentationData.strings.PeerInfo_VerificationInfo_Group
1828-
} else {
1829-
description = presentationData.strings.PeerInfo_VerificationInfo_Channel
1830-
}
1831-
1832-
let attributedPrefix = NSMutableAttributedString(string: " ")
1833-
attributedPrefix.addAttribute(ChatTextInputAttributes.customEmoji, value: ChatTextInputTextCustomEmojiAttribute(interactivelySelectedFromPackId: nil, fileId: 0, file: nil, custom: .verification), range: NSMakeRange(0, 1))
1834-
1835-
items[currentPeerInfoSection]!.append(PeerInfoScreenCommentItem(id: 800, text: description, attributedPrefix: attributedPrefix, useAccentLinkColor: false, linkAction: { action in
1836-
if case .tap = action, let navigationController = interaction.getController()?.navigationController as? NavigationController {
1837-
context.sharedContext.openExternalUrl(context: context, urlContext: .generic, url: presentationData.strings.PeerInfo_VerificationInfo_URL, forceExternal: false, presentationData: presentationData, navigationController: navigationController, dismissInput: {})
1838-
}
1839-
}))
18401813
}
18411814

18421815
if case .broadcast = channel.info {

submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoGiftsPaneNode.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
224224
let controller = GiftViewScreen(
225225
context: self.context,
226226
subject: .profileGift(self.peerId, product),
227-
updateSavedToProfile: { [weak self] added in
228-
guard let self, let messageId = product.messageId else {
227+
updateSavedToProfile: { [weak self] messageId, added in
228+
guard let self else {
229229
return
230230
}
231231
self.profileGifts.updateStarGiftAddedToProfile(messageId: messageId, added: added)

0 commit comments

Comments
 (0)