diff --git a/submodules/AuthorizationUI/Sources/AuthorizationSequenceController.swift b/submodules/AuthorizationUI/Sources/AuthorizationSequenceController.swift index cb4520a32f..293e7475b9 100644 --- a/submodules/AuthorizationUI/Sources/AuthorizationSequenceController.swift +++ b/submodules/AuthorizationUI/Sources/AuthorizationSequenceController.swift @@ -351,7 +351,7 @@ public final class AuthorizationSequenceController: NavigationController, ASAuth |> deliverOnMainQueue).startStrict(error: { [weak self] error in if let self, case .alreadyInProgress = error { let formattedNumber = formatPhoneNumber(number) - let title = NSAttributedString(string: self.presentationData.strings.Login_Email_PremiumRequiredTitle, font: Font.semibold(self.presentationData.listsFontSize.baseDisplaySize), textColor: self.presentationData.theme.actionSheet.primaryTextColor) + let title = NSAttributedString(string: self.presentationData.strings.Login_Email_PremiumRequiredTitle, font: Font.semibold(self.presentationData.listsFontSize.baseDisplaySize), textColor: self.presentationData.theme.actionSheet.primaryTextColor, paragraphAlignment: .center) let text = parseMarkdownIntoAttributedString(self.presentationData.strings.Login_Email_PremiumRequiredText(formattedNumber).string, attributes: MarkdownAttributes(body: body, bold: bold, link: body, linkAttribute: { _ in nil }), textAlignment: .center).mutableCopy() as! NSMutableAttributedString let alertController = textWithEntitiesAlertController(theme: AlertControllerTheme(presentationData: self.presentationData), title: title, text: text, actions: [TextAlertAction(type: .genericAction, title: self.presentationData.strings.Common_OK, action: { })]) diff --git a/submodules/BrowserUI/Sources/BrowserWebContent.swift b/submodules/BrowserUI/Sources/BrowserWebContent.swift index 4866b8d284..3ffa7a7d6a 100644 --- a/submodules/BrowserUI/Sources/BrowserWebContent.swift +++ b/submodules/BrowserUI/Sources/BrowserWebContent.swift @@ -1722,10 +1722,10 @@ function tgBrowserHandleMutations(mutations) { if (mutation.addedNodes && mutation.addedNodes.length > 0) { mutation.addedNodes.forEach((newNode) => { if (newNode.tagName === 'VIDEO') { - disableWebkitEnterFullscreen(newNode); + tgBrowserDisableWebkitEnterFullscreen(newNode); } if (newNode.querySelectorAll) { - newNode.querySelectorAll('video').forEach(disableWebkitEnterFullscreen); + newNode.querySelectorAll('video').forEach(tgBrowserDisableWebkitEnterFullscreen); } }); } diff --git a/submodules/PeerInfoUI/Sources/ChannelPermissionsController.swift b/submodules/PeerInfoUI/Sources/ChannelPermissionsController.swift index 86c02ce352..e278d77c7a 100644 --- a/submodules/PeerInfoUI/Sources/ChannelPermissionsController.swift +++ b/submodules/PeerInfoUI/Sources/ChannelPermissionsController.swift @@ -37,10 +37,10 @@ private final class ChannelPermissionsControllerArguments { let openChannelExample: () -> Void let updateSlowmode: (Int32) -> Void let updateUnrestrictBoosters: (Int32) -> Void - let updateStarsAmount: (StarsAmount?) -> Void + let updateStarsAmount: (StarsAmount?, Bool) -> Void let toggleIsOptionExpanded: (TelegramChatBannedRightsFlags) -> Void - init(context: AccountContext, updatePermission: @escaping (TelegramChatBannedRightsFlags, Bool) -> Void, setPeerIdWithRevealedOptions: @escaping (EnginePeer.Id?, EnginePeer.Id?) -> Void, addPeer: @escaping () -> Void, removePeer: @escaping (EnginePeer.Id) -> Void, openPeer: @escaping (ChannelParticipant) -> Void, openPeerInfo: @escaping (EnginePeer) -> Void, openKicked: @escaping () -> Void, presentRestrictedPermissionAlert: @escaping (TelegramChatBannedRightsFlags) -> Void, presentConversionToBroadcastGroup: @escaping () -> Void, openChannelExample: @escaping () -> Void, updateSlowmode: @escaping (Int32) -> Void, updateUnrestrictBoosters: @escaping (Int32) -> Void, updateStarsAmount: @escaping (StarsAmount?) -> Void, toggleIsOptionExpanded: @escaping (TelegramChatBannedRightsFlags) -> Void) { + init(context: AccountContext, updatePermission: @escaping (TelegramChatBannedRightsFlags, Bool) -> Void, setPeerIdWithRevealedOptions: @escaping (EnginePeer.Id?, EnginePeer.Id?) -> Void, addPeer: @escaping () -> Void, removePeer: @escaping (EnginePeer.Id) -> Void, openPeer: @escaping (ChannelParticipant) -> Void, openPeerInfo: @escaping (EnginePeer) -> Void, openKicked: @escaping () -> Void, presentRestrictedPermissionAlert: @escaping (TelegramChatBannedRightsFlags) -> Void, presentConversionToBroadcastGroup: @escaping () -> Void, openChannelExample: @escaping () -> Void, updateSlowmode: @escaping (Int32) -> Void, updateUnrestrictBoosters: @escaping (Int32) -> Void, updateStarsAmount: @escaping (StarsAmount?, Bool) -> Void, toggleIsOptionExpanded: @escaping (TelegramChatBannedRightsFlags) -> Void) { self.context = context self.updatePermission = updatePermission self.addPeer = addPeer @@ -418,15 +418,15 @@ private enum ChannelPermissionsEntry: ItemListNodeEntry { } case let .chargeForMessages(_, title, value): return ItemListSwitchItem(presentationData: presentationData, title: title, value: value, sectionId: self.section, style: .blocks, updated: { value in - arguments.updateStarsAmount(value ? StarsAmount(value: 400, nanos: 0) : nil) + arguments.updateStarsAmount(value ? StarsAmount(value: 400, nanos: 0) : nil, true) }) case let .chargeForMessagesInfo(_, value): return ItemListTextItem(presentationData: presentationData, text: .plain(value), sectionId: self.section) case let .messagePriceHeader(_, value): return ItemListSectionHeaderItem(presentationData: presentationData, text: value, sectionId: self.section) case let .messagePrice(_, value, maxValue, price): - return MessagePriceItem(theme: presentationData.theme, strings: presentationData.strings, isEnabled: true, minValue: 1, maxValue: maxValue, value: value, price: price, sectionId: self.section, updated: { value in - arguments.updateStarsAmount(StarsAmount(value: value, nanos: 0)) + return MessagePriceItem(theme: presentationData.theme, strings: presentationData.strings, isEnabled: true, minValue: 1, maxValue: maxValue, value: value, price: price, sectionId: self.section, updated: { value, apply in + arguments.updateStarsAmount(StarsAmount(value: value, nanos: 0), apply) }) case let .messagePriceInfo(_, value): return ItemListTextItem(presentationData: presentationData, text: .plain(value), sectionId: self.section) @@ -1248,23 +1248,25 @@ public func channelPermissionsController(context: AccountContext, updatedPresent updateUnrestrictBoostersDisposable.set((context.engine.peers.updateChannelBoostsToUnlockRestrictions(peerId: view.peerId, boosts: value) |> deliverOnMainQueue).start()) }) - }, updateStarsAmount: { value in + }, updateStarsAmount: { value, apply in updateState { state in var state = state state.modifiedStarsAmount = value return state } - let _ = (peerView.get() - |> take(1) - |> deliverOnMainQueue).start(next: { view in - var effectiveValue = value - if value?.value == 0 { - effectiveValue = nil - } - updateSendPaidMessageStarsDisposable.set((context.engine.peers.updateChannelPaidMessagesStars(peerId: view.peerId, stars: effectiveValue) - |> deliverOnMainQueue).start()) - }) + if apply { + let _ = (peerView.get() + |> take(1) + |> deliverOnMainQueue).start(next: { view in + var effectiveValue = value + if value?.value == 0 { + effectiveValue = nil + } + updateSendPaidMessageStarsDisposable.set((context.engine.peers.updateChannelPaidMessagesStars(peerId: view.peerId, stars: effectiveValue) + |> deliverOnMainQueue).start()) + }) + } }, toggleIsOptionExpanded: { flags in updateState { state in var state = state diff --git a/submodules/SettingsUI/Sources/Privacy and Security/IncomingMessagePrivacyScreen.swift b/submodules/SettingsUI/Sources/Privacy and Security/IncomingMessagePrivacyScreen.swift index 3ab7c7b914..090e6672ed 100644 --- a/submodules/SettingsUI/Sources/Privacy and Security/IncomingMessagePrivacyScreen.swift +++ b/submodules/SettingsUI/Sources/Privacy and Security/IncomingMessagePrivacyScreen.swift @@ -149,7 +149,7 @@ private enum GlobalAutoremoveEntry: ItemListNodeEntry { case .priceHeader: return ItemListSectionHeaderItem(presentationData: presentationData, text: presentationData.strings.Privacy_Messages_MessagePrice, sectionId: self.section) case let .price(value, maxValue, price, isEnabled): - return MessagePriceItem(theme: presentationData.theme, strings: presentationData.strings, isEnabled: isEnabled, minValue: 1, maxValue: maxValue, value: value, price: price, sectionId: self.section, updated: { value in + return MessagePriceItem(theme: presentationData.theme, strings: presentationData.strings, isEnabled: isEnabled, minValue: 1, maxValue: maxValue, value: value, price: price, sectionId: self.section, updated: { value, _ in arguments.updateValue(.paidMessages(StarsAmount(value: value, nanos: 0))) }, openPremiumInfo: { arguments.openPremiumInfo() diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift b/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift index 203b53e543..72c1af1dc3 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift @@ -1016,7 +1016,10 @@ private final class ProfileGiftsContextImpl { let sorting = self.sorting let isFiltered = self.filter != .All || self.sorting != .date - + if !isFiltered { + self.filteredGifts = [] + self.filteredCount = nil + } let dataState = isFiltered ? self.filteredDataState : self.dataState if case let .ready(true, initialNextOffset) = dataState { @@ -1202,7 +1205,6 @@ private final class ProfileGiftsContextImpl { } } let existingGifts = Set(pinnedGifts.compactMap { $0.reference }) - var updatedGifts: [ProfileGiftsContext.State.StarGift] = [] for gift in self.gifts { if let reference = gift.reference, existingGifts.contains(reference) { @@ -1216,18 +1218,44 @@ private final class ProfileGiftsContextImpl { updatedGifts.insert(contentsOf: pinnedGifts, at: 0) self.gifts = updatedGifts - if let index = self.filteredGifts.firstIndex(where: { $0.reference == reference }) { - self.filteredGifts[index] = self.filteredGifts[index].withPinnedToTop(pinnedToTop) + var effectiveReferences = pinnedGifts.compactMap { $0.reference } + if !self.filteredGifts.isEmpty { + var filteredPinnedGifts = self.filteredGifts.filter { $0.pinnedToTop } + if var gift = self.filteredGifts.first(where: { $0.reference == reference }) { + gift = gift.withPinnedToTop(pinnedToTop) + if pinnedToTop { + if !gift.savedToProfile { + gift = gift.withSavedToProfile(true) + } + filteredPinnedGifts.append(gift) + } else { + filteredPinnedGifts.removeAll(where: { $0.reference == reference }) + } + } + let existingFilteredGifts = Set(filteredPinnedGifts.compactMap { $0.reference }) + var updatedFilteredGifts: [ProfileGiftsContext.State.StarGift] = [] + for gift in self.filteredGifts { + if let reference = gift.reference, existingFilteredGifts.contains(reference) { + continue + } + updatedFilteredGifts.append(gift) + } + updatedFilteredGifts.sort { lhs, rhs in + lhs.date > rhs.date + } + updatedFilteredGifts.insert(contentsOf: filteredPinnedGifts, at: 0) + self.filteredGifts = updatedFilteredGifts + + effectiveReferences = filteredPinnedGifts.compactMap { $0.reference } } + self.pushState() - var signal = _internal_updateStarGiftsPinnedToTop(account: self.account, peerId: self.peerId, references: pinnedGifts.compactMap { $0.reference }) - + var signal = _internal_updateStarGiftsPinnedToTop(account: self.account, peerId: self.peerId, references: effectiveReferences) if saveToProfile { signal = _internal_updateStarGiftAddedToProfile(account: self.account, reference: reference, added: true) |> then(signal) } - self.actionDisposable.set( (signal |> deliverOn(self.queue)).startStrict(completed: { [weak self] in self?.reload() @@ -1279,7 +1307,6 @@ private final class ProfileGiftsContextImpl { |> ignoreValues |> then(signal) } - self.actionDisposable.set( (signal |> deliverOn(self.queue)).startStrict(completed: { [weak self] in self?.reload() @@ -1349,6 +1376,9 @@ private final class ProfileGiftsContextImpl { } func updateFilter(_ filter: ProfileGiftsContext.Filters) { + guard self.filter != filter else { + return + } self.filter = filter self.filteredDataState = .ready(canLoadMore: true, nextOffset: nil) self.pushState() @@ -1357,6 +1387,9 @@ private final class ProfileGiftsContextImpl { } func updateSorting(_ sorting: ProfileGiftsContext.Sorting) { + guard self.sorting != sorting else { + return + } self.sorting = sorting self.filteredDataState = .ready(canLoadMore: true, nextOffset: nil) self.pushState() diff --git a/submodules/TelegramStringFormatting/Sources/ServiceMessageStrings.swift b/submodules/TelegramStringFormatting/Sources/ServiceMessageStrings.swift index fdf187168a..89a13d50e5 100644 --- a/submodules/TelegramStringFormatting/Sources/ServiceMessageStrings.swift +++ b/submodules/TelegramStringFormatting/Sources/ServiceMessageStrings.swift @@ -1148,7 +1148,7 @@ public func universalServiceMessageString(presentationData: (PresentationTheme, case let .starGiftUnique(gift, isUpgrade, _, _, _, _, _, peerId, senderId, _): if case let .unique(gift) = gift { if !forAdditionalServiceMessage && !"".isEmpty { - attributedString = NSAttributedString(string: "\(gift.title) #\(gift.number)", font: titleFont, textColor: primaryTextColor) + attributedString = NSAttributedString(string: "\(gift.title) #\(presentationStringsFormattedNumber(gift.number, dateTimeFormat.groupingSeparator))", font: titleFont, textColor: primaryTextColor) } else if let messagePeer = message.peers[message.id.peerId] { var peerName = EnginePeer(messagePeer).compactDisplayTitle var peerIds: [(Int, EnginePeer.Id?)] = [(0, messagePeer.id)] diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageBubbleItemNode/Sources/ChatMessageBubbleItemNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageBubbleItemNode/Sources/ChatMessageBubbleItemNode.swift index df4b6cc9fa..ffa7a26e05 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageBubbleItemNode/Sources/ChatMessageBubbleItemNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageBubbleItemNode/Sources/ChatMessageBubbleItemNode.swift @@ -2968,7 +2968,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI } else { let contentProperties = contentPropertiesAndLayouts[i].3 - if i == 0 && !headerSize.height.isZero { + if (i == 0 || (i == 1 && detachedContentNodesHeight > 0)) && !headerSize.height.isZero { if contentGroupId == nil { contentNodesHeight += properties.headerSpacing } @@ -2981,7 +2981,15 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI if !contentContainerNodeFrames.isEmpty { overlapOffset = currentContainerGroupOverlap } - let containerFrame = CGRect(x: 0.0, y: headerSize.height + totalContentNodesHeight - contentNodesHeight - overlapOffset, width: maxContentWidth, height: contentNodesHeight) + var containerContentNodesOrigin = contentNodesHeight + var containerContentNodesHeight = contentNodesHeight + if detachedContentNodesHeight > 0 { + if contentContainerNodeFrames.isEmpty { + containerContentNodesHeight -= detachedContentNodesHeight - 4.0 + containerContentNodesOrigin -= detachedContentNodesHeight - 4.0 + } + } + let containerFrame = CGRect(x: 0.0, y: headerSize.height + totalContentNodesHeight - containerContentNodesOrigin - overlapOffset, width: maxContentWidth, height: containerContentNodesHeight) contentContainerNodeFrames.append((containerGroupId, containerFrame, currentItemSelection, currentContainerGroupOverlap)) if !overlapOffset.isZero { @@ -2997,7 +3005,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI } var contentNodeOriginY = contentNodesHeight - if detachedContentNodesHeight > 0 { + if detachedContentNodesHeight > 0, contentContainerNodeFrames.isEmpty { contentNodeOriginY -= detachedContentNodesHeight - 4.0 } @@ -3025,7 +3033,15 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI if !contentContainerNodeFrames.isEmpty { overlapOffset = currentContainerGroupOverlap } - contentContainerNodeFrames.append((containerGroupId, CGRect(x: 0.0, y: headerSize.height + totalContentNodesHeight - contentNodesHeight - overlapOffset, width: maxContentWidth, height: contentNodesHeight), currentItemSelection, currentContainerGroupOverlap)) + var containerContentNodesOrigin = contentNodesHeight + var containerContentNodesHeight = contentNodesHeight + if detachedContentNodesHeight > 0 { + if contentContainerNodeFrames.isEmpty { + containerContentNodesHeight -= detachedContentNodesHeight - 4.0 + containerContentNodesOrigin -= detachedContentNodesHeight - 4.0 + } + } + contentContainerNodeFrames.append((containerGroupId, CGRect(x: 0.0, y: headerSize.height + totalContentNodesHeight - containerContentNodesOrigin - overlapOffset, width: maxContentWidth, height: containerContentNodesHeight), currentItemSelection, currentContainerGroupOverlap)) if !overlapOffset.isZero { totalContentNodesHeight -= currentContainerGroupOverlap } diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageCommentFooterContentNode/Sources/ChatMessageCommentFooterContentNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageCommentFooterContentNode/Sources/ChatMessageCommentFooterContentNode.swift index 5bd1a66e68..99d4e8c196 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageCommentFooterContentNode/Sources/ChatMessageCommentFooterContentNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageCommentFooterContentNode/Sources/ChatMessageCommentFooterContentNode.swift @@ -213,7 +213,7 @@ public final class ChatMessageCommentFooterContentNode: ChatMessageBubbleContent } else { textLeftInset = 15.0 + imageSize * min(1.0, CGFloat(replyPeers.count)) + (imageSpacing) * max(0.0, min(2.0, CGFloat(replyPeers.count - 1))) } - let textRightInset: CGFloat = 36.0 + let textRightInset: CGFloat = 24.0 let textConstrainedSize = CGSize(width: min(maxTextWidth, constrainedSize.width - horizontalInset - textLeftInset - textRightInset), height: constrainedSize.height) diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageGiftBubbleContentNode/Sources/ChatMessageGiftBubbleContentNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageGiftBubbleContentNode/Sources/ChatMessageGiftBubbleContentNode.swift index 5a38e4a5e2..bf9eb2c51a 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageGiftBubbleContentNode/Sources/ChatMessageGiftBubbleContentNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageGiftBubbleContentNode/Sources/ChatMessageGiftBubbleContentNode.swift @@ -354,8 +354,8 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode { let attributedString = attributedServiceMessageString(theme: item.presentationData.theme, strings: item.presentationData.strings, nameDisplayOrder: item.presentationData.nameDisplayOrder, dateTimeFormat: item.presentationData.dateTimeFormat, message: EngineMessage(item.message), accountPeerId: item.context.account.peerId) - let primaryTextColor = serviceMessageColorComponents(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper).primaryText - + var primaryTextColor = serviceMessageColorComponents(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper).primaryText + var months: Int32 = 3 var animationName: String = "" var animationFile: TelegramMediaFile? @@ -582,7 +582,7 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode { } else { title = isStoryEntity ? uniqueGift.title : item.presentationData.strings.Notification_StarGift_Title(authorName).string } - text = isStoryEntity ? "**\(item.presentationData.strings.Notification_StarGift_Collectible) #\(uniqueGift.number)**" : "**\(uniqueGift.title) #\(uniqueGift.number)**" + text = isStoryEntity ? "**\(item.presentationData.strings.Notification_StarGift_Collectible) #\(presentationStringsFormattedNumber(uniqueGift.number, item.presentationData.dateTimeFormat.groupingSeparator))**" : "**\(uniqueGift.title) #\(presentationStringsFormattedNumber(uniqueGift.number, item.presentationData.dateTimeFormat.groupingSeparator))**" ribbonTitle = isStoryEntity ? "" : item.presentationData.strings.Notification_StarGift_Gift buttonTitle = isStoryEntity ? "" : item.presentationData.strings.Notification_StarGift_View modelTitle = item.presentationData.strings.Notification_StarGift_Model @@ -599,6 +599,7 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode { uniqueSecondBackgroundColor = UIColor(rgb: UInt32(bitPattern: innerColor)) uniquePatternColor = UIColor(rgb: UInt32(bitPattern: patternColor)) backdropValue = name + primaryTextColor = UIColor(rgb: 0xffffff) subtitleColor = UIColor(rgb: UInt32(bitPattern: innerColor)).withMultiplied(hue: 1.0, saturation: 1.02, brightness: 1.25).mixedWith(UIColor.white, alpha: 0.3) case let .pattern(name, file, _): symbolValue = name diff --git a/submodules/TelegramUI/Components/Chat/ChatSendStarsScreen/Sources/ChatSendStarsScreen.swift b/submodules/TelegramUI/Components/Chat/ChatSendStarsScreen/Sources/ChatSendStarsScreen.swift index 3f3e47ca50..f3793bdce4 100644 --- a/submodules/TelegramUI/Components/Chat/ChatSendStarsScreen/Sources/ChatSendStarsScreen.swift +++ b/submodules/TelegramUI/Components/Chat/ChatSendStarsScreen/Sources/ChatSendStarsScreen.swift @@ -1441,14 +1441,31 @@ private final class ChatSendStarsScreenComponent: Component { } let sideInset: CGFloat = floor((availableSize.width - fillingSize) * 0.5) + 16.0 + let context = component.context let balanceSize = self.balanceOverlay.update( transition: .immediate, component: AnyComponent( StarsBalanceOverlayComponent( context: component.context, theme: environment.theme, - action: { + action: { [weak self] in + guard let self, let starsContext = context.starsContext, let navigationController = self.environment?.controller()?.navigationController as? NavigationController else { + return + } + self.environment?.controller()?.dismiss() + let _ = (context.engine.payments.starsTopUpOptions() + |> take(1) + |> deliverOnMainQueue).startStandalone(next: { options in + let controller = context.sharedContext.makeStarsPurchaseScreen( + context: context, + starsContext: starsContext, + options: options, + purpose: .generic, + completion: { _ in } + ) + navigationController.pushViewController(controller) + }) } ) ), diff --git a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftTransferAlertController.swift b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftTransferAlertController.swift index a9ff187f51..ffa0d3ffb8 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftTransferAlertController.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftTransferAlertController.swift @@ -259,10 +259,10 @@ public func giftTransferAlertController(context: AccountContext, gift: StarGift. let text: String let buttonText: String if transferStars > 0 { - text = strings.Gift_Transfer_Confirmation_Text("\(gift.title) #\(gift.number)", peer.displayTitle(strings: strings, displayOrder: presentationData.nameDisplayOrder), strings.Gift_Transfer_Confirmation_Text_Stars(Int32(transferStars))).string + text = strings.Gift_Transfer_Confirmation_Text("\(gift.title) #\(presentationStringsFormattedNumber(gift.number, presentationData.dateTimeFormat.groupingSeparator))", peer.displayTitle(strings: strings, displayOrder: presentationData.nameDisplayOrder), strings.Gift_Transfer_Confirmation_Text_Stars(Int32(transferStars))).string buttonText = "\(strings.Gift_Transfer_Confirmation_Transfer) $ \(transferStars)" } else { - text = strings.Gift_Transfer_Confirmation_TextFree("\(gift.title) #\(gift.number)", peer.displayTitle(strings: strings, displayOrder: presentationData.nameDisplayOrder)).string + text = strings.Gift_Transfer_Confirmation_TextFree("\(gift.title) #\(presentationStringsFormattedNumber(gift.number, presentationData.dateTimeFormat.groupingSeparator))", peer.displayTitle(strings: strings, displayOrder: presentationData.nameDisplayOrder)).string buttonText = strings.Gift_Transfer_Confirmation_TransferFree } diff --git a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift index 0beadb7f97..9d2c630241 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift @@ -635,7 +635,8 @@ private final class GiftViewSheetContent: CombinedComponent { if case .wearPreview = component.subject { giftTitle = uniqueGift.title } else { - giftTitle = "\(uniqueGift.title) #\(uniqueGift.number)" + + giftTitle = "\(uniqueGift.title) #\(presentationStringsFormattedNumber(uniqueGift.number, environment.dateTimeFormat.groupingSeparator))" } let wearTitle = wearTitle.update( @@ -1018,7 +1019,7 @@ private final class GiftViewSheetContent: CombinedComponent { var descriptionText: String if let uniqueGift { titleString = uniqueGift.title - descriptionText = "\(strings.Gift_Unique_Collectible) #\(uniqueGift.number)" + descriptionText = "\(strings.Gift_Unique_Collectible) #\(presentationStringsFormattedNumber(uniqueGift.number, environment.dateTimeFormat.groupingSeparator))" } else if soldOut { descriptionText = strings.Gift_View_UnavailableDescription } else if upgraded { @@ -1480,7 +1481,7 @@ private final class GiftViewSheetContent: CombinedComponent { if isWearing { state.commitTakeOff() - component.showAttributeInfo(statusTag, strings.Gift_View_TookOff("\(uniqueGift.title) #\(uniqueGift.number)").string) + component.showAttributeInfo(statusTag, strings.Gift_View_TookOff("\(uniqueGift.title) #\(presentationStringsFormattedNumber(uniqueGift.number, environment.dateTimeFormat.groupingSeparator))").string) } else { if let controller = controller() as? GiftViewScreen { controller.dismissAllTooltips() @@ -1507,7 +1508,7 @@ private final class GiftViewSheetContent: CombinedComponent { state.requestWearPreview() } else { state.commitWear(uniqueGift) - component.showAttributeInfo(statusTag, strings.Gift_View_PutOn("\(uniqueGift.title) #\(uniqueGift.number)").string) + component.showAttributeInfo(statusTag, strings.Gift_View_PutOn("\(uniqueGift.title) #\(presentationStringsFormattedNumber(uniqueGift.number, environment.dateTimeFormat.groupingSeparator))").string) } }) } @@ -2090,7 +2091,7 @@ private final class GiftViewSheetContent: CombinedComponent { component.cancel(true) } else { Queue.mainQueue().after(0.2) { - component.showAttributeInfo(statusTag, strings.Gift_View_PutOn("\(uniqueGift.title) #\(uniqueGift.number)").string) + component.showAttributeInfo(statusTag, strings.Gift_View_PutOn("\(uniqueGift.title) #\(presentationStringsFormattedNumber(uniqueGift.number, environment.dateTimeFormat.groupingSeparator))").string) } } } @@ -3091,15 +3092,32 @@ public class GiftViewScreen: ViewControllerComponentContainer { super.containerLayoutUpdated(layout, transition: transition) if self.showBalance { + let context = self.context let insets = layout.insets(options: .statusBar) let balanceSize = self.balanceOverlay.update( transition: .immediate, component: AnyComponent( StarsBalanceOverlayComponent( - context: self.context, - theme: self.context.sharedContext.currentPresentationData.with { $0 }.theme, - action: { + context: context, + theme: context.sharedContext.currentPresentationData.with { $0 }.theme, + action: { [weak self] in + guard let self, let starsContext = context.starsContext, let navigationController = self.navigationController as? NavigationController else { + return + } + self.dismissAnimated() + let _ = (context.engine.payments.starsTopUpOptions() + |> take(1) + |> deliverOnMainQueue).startStandalone(next: { options in + let controller = context.sharedContext.makeStarsPurchaseScreen( + context: context, + starsContext: starsContext, + options: options, + purpose: .generic, + completion: { _ in } + ) + navigationController.pushViewController(controller) + }) } ) ), diff --git a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftWithdrawAlertController.swift b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftWithdrawAlertController.swift index 6048815011..6fb6a9d67f 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftWithdrawAlertController.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftWithdrawAlertController.swift @@ -274,7 +274,7 @@ public func giftWithdrawAlertController(context: AccountContext, gift: StarGift. let strings = presentationData.strings let title = strings.Gift_Withdraw_Title - let text = strings.Gift_Withdraw_Text("\(gift.title) #\(gift.number)").string + let text = strings.Gift_Withdraw_Text("\(gift.title) #\(presentationStringsFormattedNumber(gift.number, presentationData.dateTimeFormat.groupingSeparator))").string let buttonText = strings.Gift_Withdraw_Proceed var dismissImpl: ((Bool) -> Void)? diff --git a/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift b/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift index 290e126b5e..01a4e252f0 100644 --- a/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift +++ b/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift @@ -681,7 +681,7 @@ public final class MessageInputPanelComponent: Component { if self.contextQueryPeer == nil, let peerId = component.chatLocation?.peerId { let _ = (context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: peerId)) |> deliverOnMainQueue).start(next: { [weak self] peer in - guard let self, peer?.addressName != nil else { + guard let self, let peer, case .channel = peer, peer.addressName != nil else { return } self.contextQueryPeer = peer diff --git a/submodules/TelegramUI/Components/PeerInfo/MessagePriceItem/Sources/MessagePriceItem.swift b/submodules/TelegramUI/Components/PeerInfo/MessagePriceItem/Sources/MessagePriceItem.swift index 598a80f7e0..eafde47eeb 100644 --- a/submodules/TelegramUI/Components/PeerInfo/MessagePriceItem/Sources/MessagePriceItem.swift +++ b/submodules/TelegramUI/Components/PeerInfo/MessagePriceItem/Sources/MessagePriceItem.swift @@ -25,10 +25,10 @@ public final class MessagePriceItem: ListViewItem, ItemListItem { let value: Int64 let price: String public let sectionId: ItemListSectionId - let updated: (Int64) -> Void + let updated: (Int64, Bool) -> Void let openPremiumInfo: (() -> Void)? - public init(theme: PresentationTheme, strings: PresentationStrings, isEnabled: Bool, minValue: Int64, maxValue: Int64, value: Int64, price: String, sectionId: ItemListSectionId, updated: @escaping (Int64) -> Void, openPremiumInfo: (() -> Void)? = nil) { + public init(theme: PresentationTheme, strings: PresentationStrings, isEnabled: Bool, minValue: Int64, maxValue: Int64, value: Int64, price: String, sectionId: ItemListSectionId, updated: @escaping (Int64, Bool) -> Void, openPremiumInfo: (() -> Void)? = nil) { self.theme = theme self.strings = strings self.isEnabled = isEnabled @@ -259,7 +259,7 @@ private class MessagePriceItemNode: ListViewItemNode { if let strongSelf = self { strongSelf.item = item strongSelf.layoutParams = params - + strongSelf.backgroundNode.backgroundColor = item.theme.list.itemBlocksBackgroundColor strongSelf.topStripeNode.backgroundColor = item.theme.list.itemBlocksSeparatorColor strongSelf.bottomStripeNode.backgroundColor = item.theme.list.itemBlocksSeparatorColor @@ -342,6 +342,13 @@ private class MessagePriceItemNode: ListViewItemNode { } sliderView.frame = CGRect(origin: CGPoint(x: params.leftInset + 18.0, y: 36.0), size: CGSize(width: params.width - params.leftInset - params.rightInset - 18.0 * 2.0, height: 44.0)) + + sliderView.interactionEnded = { [weak self] in + guard let self else { + return + } + self.item?.updated(Int64(self.amount.realValue), true) + } } strongSelf.lockIconNode.isHidden = item.isEnabled @@ -436,7 +443,7 @@ private class MessagePriceItemNode: ListViewItemNode { } self.amount = updatedAmount - self.item?.updated(Int64(self.amount.realValue)) + self.item?.updated(Int64(self.amount.realValue), false) } } diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoCoverComponent/Sources/PeerInfoGiftsCoverComponent.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoCoverComponent/Sources/PeerInfoGiftsCoverComponent.swift index 7bd70ad117..6c81f40c57 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoCoverComponent/Sources/PeerInfoGiftsCoverComponent.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoCoverComponent/Sources/PeerInfoGiftsCoverComponent.swift @@ -579,7 +579,7 @@ private class GiftIconLayer: SimpleLayer { } override func layoutSublayers() { - self.shadowLayer.frame = CGRect(origin: .zero, size: self.bounds.size).insetBy(dx: -4.0, dy: -4.0) + self.shadowLayer.frame = CGRect(origin: .zero, size: self.bounds.size).insetBy(dx: -8.0, dy: -8.0) self.animationLayer.frame = CGRect(origin: .zero, size: self.bounds.size) } diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoHeaderNode.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoHeaderNode.swift index d019cf9ef8..1c0c8c45df 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoHeaderNode.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoHeaderNode.swift @@ -255,6 +255,7 @@ final class PeerInfoHeaderNode: ASDisplayNode { self.buttonsContainerNode.clipsToBounds = true self.buttonsBackgroundNode = NavigationBackgroundNode(color: .clear, enableBlur: true, enableSaturation: false) + self.buttonsBackgroundNode.isUserInteractionEnabled = false self.buttonsContainerNode.addSubnode(self.buttonsBackgroundNode) self.buttonsMaskView = UIView() self.buttonsBackgroundNode.view.mask = self.buttonsMaskView diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift index 4cd1b7c9e5..c70cee98c0 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift @@ -3728,7 +3728,11 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro }, openAgeRestrictedMessageMedia: { _, _ in }, playMessageEffect: { _ in }, editMessageFactCheck: { _ in - }, sendGift: { _ in + }, sendGift: { [weak self] _ in + guard let self else { + return + } + self.openPremiumGift() }, openUniqueGift: { _ in }, openMessageFeeException: { }, requestMessageUpdate: { _, _ in diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/GiftContextPreviewController.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/GiftContextPreviewController.swift index f662997902..7c1e42f704 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/GiftContextPreviewController.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/GiftContextPreviewController.swift @@ -120,7 +120,7 @@ private final class GiftContextPreviewComponent: Component { let subtitleSize = self.subtitle.update( transition: .immediate, component: AnyComponent(MultilineTextComponent(text: .plain( - NSAttributedString(string: "\(environment.strings.Gift_Unique_Collectible) #\(uniqueGift.number)", font: Font.regular(13.0), textColor: vibrantColor) + NSAttributedString(string: "\(environment.strings.Gift_Unique_Collectible) #\(presentationStringsFormattedNumber(uniqueGift.number, environment.dateTimeFormat.groupingSeparator))", font: Font.regular(13.0), textColor: vibrantColor) ))), environment: {}, containerSize: availableSize diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoGiftsPaneNode.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoGiftsPaneNode.swift index 12ecd981dc..e924b19dd6 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoGiftsPaneNode.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoGiftsPaneNode.swift @@ -240,6 +240,9 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr } public func beginReordering() { + self.profileGifts.updateFilter(.All) + self.profileGifts.updateSorting(.date) + if let parentController = self.parentController as? PeerInfoScreen { parentController.togglePaneIsReordering(isReordering: true) } else { @@ -469,7 +472,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr return } if self.isReordering { - if !product.pinnedToTop, let reference = product.reference, let items = self.starsProducts { + if case .unique = product.gift, !product.pinnedToTop, let reference = product.reference, let items = self.starsProducts { if self.pinnedReferences.count >= self.maxPinnedCount { self.parentController?.present(UndoOverlayController(presentationData: presentationData, content: .info(title: nil, text: presentationData.strings.PeerInfo_Gifts_ToastPinLimit_Text(Int32(self.maxPinnedCount)), timeout: nil, customUndoText: nil), elevatedLayout: true, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root)) return @@ -564,7 +567,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr itemFrame = itemFrame.size.centered(around: reorderingItem.position) isReordering = true } - if itemView.layer.animation(forKey: "position") != nil && !isReordering { + if self.isReordering, itemView.layer.animation(forKey: "position") != nil && !isReordering { } else { itemTransition.setFrame(view: itemView, frame: itemFrame) } @@ -612,8 +615,6 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr var bottomScrollInset: CGFloat = 0.0 var contentHeight = ceil(CGFloat(starsProducts.count) / 3.0) * (starsOptionSize.height + optionSpacing) - optionSpacing + topInset + 16.0 - let transition = ComponentTransition.immediate - let size = params.size let sideInset = params.sideInset let bottomInset = params.bottomInset @@ -681,8 +682,9 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr scrollOffset -= bottomPanelHeight } - transition.setFrame(view: panelButton.view, frame: CGRect(origin: CGPoint(x: buttonSideInset, y: size.height - bottomInset - buttonSize.height - scrollOffset), size: buttonSize)) - transition.setAlpha(view: panelButton.view, alpha: panelAlpha) + let panelTransition = ComponentTransition.immediate + panelTransition.setFrame(view: panelButton.view, frame: CGRect(origin: CGPoint(x: buttonSideInset, y: size.height - bottomInset - buttonSize.height - scrollOffset), size: buttonSize)) + panelTransition.setAlpha(view: panelButton.view, alpha: panelAlpha) let _ = panelButton.updateLayout(width: buttonSize.width, transition: .immediate) if self.canManage { @@ -753,16 +755,16 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr self.view.addSubview(panelCheckView) } panelCheckView.frame = CGRect(origin: CGPoint(x: floor((size.width - panelCheckSize.width) / 2.0), y: size.height - bottomInset - panelCheckSize.height - 11.0 - scrollOffset), size: panelCheckSize) - transition.setAlpha(view: panelCheckView, alpha: panelAlpha) + panelTransition.setAlpha(view: panelCheckView, alpha: panelAlpha) } panelButton.isHidden = true } - transition.setFrame(view: panelBackground.view, frame: CGRect(x: 0.0, y: size.height - bottomPanelHeight - scrollOffset, width: size.width, height: bottomPanelHeight)) - transition.setAlpha(view: panelBackground.view, alpha: panelAlpha) + panelTransition.setFrame(view: panelBackground.view, frame: CGRect(x: 0.0, y: size.height - bottomPanelHeight - scrollOffset, width: size.width, height: bottomPanelHeight)) + panelTransition.setAlpha(view: panelBackground.view, alpha: panelAlpha) panelBackground.update(size: CGSize(width: size.width, height: bottomPanelHeight), transition: transition.containedViewLayoutTransition) - transition.setFrame(view: panelSeparator.view, frame: CGRect(x: 0.0, y: size.height - bottomPanelHeight - scrollOffset, width: size.width, height: UIScreenPixel)) - transition.setAlpha(view: panelSeparator.view, alpha: panelAlpha) + panelTransition.setFrame(view: panelSeparator.view, frame: CGRect(x: 0.0, y: size.height - bottomPanelHeight - scrollOffset, width: size.width, height: UIScreenPixel)) + panelTransition.setAlpha(view: panelSeparator.view, alpha: panelAlpha) let fadeTransition = ComponentTransition.easeInOut(duration: 0.25) if self.resultsAreEmpty { @@ -776,8 +778,8 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr self.emptyResultsClippingView.isHidden = false - transition.setFrame(view: self.emptyResultsClippingView, frame: CGRect(origin: CGPoint(x: 0.0, y: 48.0), size: self.scrollNode.frame.size)) - transition.setBounds(view: self.emptyResultsClippingView, bounds: CGRect(origin: CGPoint(x: 0.0, y: 48.0), size: self.scrollNode.frame.size)) + panelTransition.setFrame(view: self.emptyResultsClippingView, frame: CGRect(origin: CGPoint(x: 0.0, y: 48.0), size: self.scrollNode.frame.size)) + panelTransition.setBounds(view: self.emptyResultsClippingView, bounds: CGRect(origin: CGPoint(x: 0.0, y: 48.0), size: self.scrollNode.frame.size)) let emptyResultsTitleSize = self.emptyResultsTitle.update( transition: .immediate, @@ -840,7 +842,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr view.playOnce() } view.bounds = CGRect(origin: .zero, size: emptyResultsAnimationFrame.size) - transition.setPosition(view: view, position: emptyResultsAnimationFrame.center) + panelTransition.setPosition(view: view, position: emptyResultsAnimationFrame.center) } if let view = self.emptyResultsTitle.view { if view.superview == nil { @@ -849,7 +851,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr self.emptyResultsClippingView.addSubview(view) } view.bounds = CGRect(origin: .zero, size: emptyResultsTitleFrame.size) - transition.setPosition(view: view, position: emptyResultsTitleFrame.center) + panelTransition.setPosition(view: view, position: emptyResultsTitleFrame.center) } if let view = self.emptyResultsAction.view { if view.superview == nil { @@ -858,7 +860,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr self.emptyResultsClippingView.addSubview(view) } view.bounds = CGRect(origin: .zero, size: emptyResultsActionFrame.size) - transition.setPosition(view: view, position: emptyResultsActionFrame.center) + panelTransition.setPosition(view: view, position: emptyResultsActionFrame.center) } } else { if let view = self.emptyResultsAnimation.view { @@ -879,7 +881,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr } } - if self.peerId == self.context.account.peerId { + if self.peerId == self.context.account.peerId, !self.resultsAreEmpty { let footerText: ComponentView if let current = self.footerText { footerText = current @@ -941,21 +943,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr self.chatControllerInteraction.navigationController()?.pushViewController(controller) }) } else { - let _ = (self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Birthday(id: self.peerId)) - |> deliverOnMainQueue).start(next: { birthday in - var hasBirthday = false - if let birthday { - hasBirthday = hasBirthdayToday(birthday: birthday) - } - let controller = self.context.sharedContext.makeGiftOptionsController( - context: self.context, - peerId: self.peerId, - premiumOptions: [], - hasBirthday: hasBirthday, - completion: nil - ) - self.chatControllerInteraction.navigationController()?.pushViewController(controller) - }) + self.chatControllerInteraction.sendGift(self.peerId) } } diff --git a/submodules/TelegramUI/Components/Stars/StarsTransactionScreen/Sources/StarsTransactionScreen.swift b/submodules/TelegramUI/Components/Stars/StarsTransactionScreen/Sources/StarsTransactionScreen.swift index 39de43b8ec..b4066cab07 100644 --- a/submodules/TelegramUI/Components/Stars/StarsTransactionScreen/Sources/StarsTransactionScreen.swift +++ b/submodules/TelegramUI/Components/Stars/StarsTransactionScreen/Sources/StarsTransactionScreen.swift @@ -424,7 +424,7 @@ private final class StarsTransactionSheetContent: CombinedComponent { isPaidMessage = true titleText = strings.Stars_Transaction_PaidMessage(transaction.paidMessageCount ?? 1) countOnTop = true - descriptionText = strings.Stars_Transaction_PaidMessage_Text(formatPermille(starrefCommissionPermille)).string + descriptionText = strings.Stars_Transaction_PaidMessage_Text(formatPermille(1000 - starrefCommissionPermille)).string } else if transaction.starrefPeerId == nil { titleText = strings.StarsTransaction_TitleCommission(formatPermille(starrefCommissionPermille)).string countOnTop = false diff --git a/submodules/TelegramUI/Components/Stars/StarsTransactionsScreen/Sources/StarsTransactionsListPanelComponent.swift b/submodules/TelegramUI/Components/Stars/StarsTransactionsScreen/Sources/StarsTransactionsListPanelComponent.swift index b5f9e00149..f9aacdbe72 100644 --- a/submodules/TelegramUI/Components/Stars/StarsTransactionsScreen/Sources/StarsTransactionsListPanelComponent.swift +++ b/submodules/TelegramUI/Components/Stars/StarsTransactionsScreen/Sources/StarsTransactionsListPanelComponent.swift @@ -312,7 +312,7 @@ final class StarsTransactionsListPanelComponent: Component { itemSubtitle = environment.strings.Stars_Intro_Transaction_PaidMessage(item.paidMessageCount ?? 1) } else if let starGift = item.starGift { if item.flags.contains(.isStarGiftUpgrade), case let .unique(gift) = starGift { - itemTitle = "\(gift.title) #\(gift.number)" + itemTitle = "\(gift.title) #\(presentationStringsFormattedNumber(gift.number, environment.dateTimeFormat.groupingSeparator))" itemSubtitle = environment.strings.Stars_Intro_Transaction_GiftUpgrade uniqueGift = gift } else { diff --git a/submodules/TelegramUI/Sources/SharedAccountContext.swift b/submodules/TelegramUI/Sources/SharedAccountContext.swift index 95e775a17a..753e8f3c60 100644 --- a/submodules/TelegramUI/Sources/SharedAccountContext.swift +++ b/submodules/TelegramUI/Sources/SharedAccountContext.swift @@ -2905,7 +2905,7 @@ public final class SharedAccountContextImpl: SharedAccountContext { Queue.mainQueue().after(0.3) { let tooltipController = UndoOverlayController( presentationData: presentationData, - content: .forward(savedMessages: false, text: presentationData.strings.Gift_Transfer_Success("\(gift.title) #\(gift.number)", peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string), + content: .forward(savedMessages: false, text: presentationData.strings.Gift_Transfer_Success("\(gift.title) #\(presentationStringsFormattedNumber(gift.number, presentationData.dateTimeFormat.groupingSeparator))", peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string), elevatedLayout: false, action: { _ in return true } ) diff --git a/submodules/WebUI/Sources/WebAppWebView.swift b/submodules/WebUI/Sources/WebAppWebView.swift index f1be891cc9..ad3ab346ab 100644 --- a/submodules/WebUI/Sources/WebAppWebView.swift +++ b/submodules/WebUI/Sources/WebAppWebView.swift @@ -65,10 +65,10 @@ function tgBrowserHandleMutations(mutations) { if (mutation.addedNodes && mutation.addedNodes.length > 0) { mutation.addedNodes.forEach((newNode) => { if (newNode.tagName === 'VIDEO') { - disableWebkitEnterFullscreen(newNode); + tgBrowserDisableWebkitEnterFullscreen(newNode); } if (newNode.querySelectorAll) { - newNode.querySelectorAll('video').forEach(disableWebkitEnterFullscreen); + newNode.querySelectorAll('video').forEach(tgBrowserDisableWebkitEnterFullscreen); } }); }