From 6d59a6394af688f08efa8e5d22c5f411fa9515b2 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Sun, 28 Sep 2025 03:01:43 +0400 Subject: [PATCH] Various fixes --- .../Telegram-iOS/en.lproj/Localizable.strings | 3 +- .../Sources/PresentationCallManager.swift | 3 + .../Sources/TGCameraMainPhoneView.m | 2 +- .../Sources/PresentationGroupCall.swift | 4 +- .../Sources/VideoChatScreen.swift | 3 +- .../Sources/VideoChatScreenMoreMenu.swift | 46 +++++----- .../TelegramEngine/Calls/GroupCalls.swift | 6 +- .../TelegramEngine/Messages/Message.swift | 3 + .../TelegramEngine/Payments/StarGifts.swift | 40 +++++++++ .../Sources/ServiceMessageStrings.swift | 12 +-- .../Sources/ChatMessageReplyInfoNode.swift | 2 + .../GiftRemoveInfoAlertController.swift | 14 +-- .../Sources/GiftViewScreen.swift | 86 +++++++++++++++++-- .../PeerInfoScreenLabeledValueItem.swift | 73 ++++++++++++++-- .../Sources/PeerInfoScreen.swift | 5 +- .../Sources/PeerInfoGiftsPaneNode.swift | 2 +- .../BirthdayPickerContentComponent.swift | 13 ++- .../Sources/GiftListItemComponent.swift | 12 ++- .../Sources/UserApperanceScreen.swift | 33 ++++++- .../Sources/TextNodeWithEntities.swift | 3 + 20 files changed, 295 insertions(+), 70 deletions(-) diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 31dcde8fef..419435f9d3 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -15109,7 +15109,6 @@ Error: %8$@"; "Gift.UnavailableAction.Title" = "Action Locked"; "Gift.UnavailableAction.Text" = "Transfer this gift to your Telegram account on Fragment to unlock this action."; "Gift.UnavailableAction.OpenFragment" = "Open Fragment"; -"Gift.UnavailableAction.OpenFragment_URL" = "https://fragment.com"; "Gift.Unique.Telegram" = "Telegram"; @@ -15131,3 +15130,5 @@ Error: %8$@"; "ProfileLevelInfo.NegativeRating" = "Negative rating"; "Notification.StarsGift.Assigned" = "You started displaying %@ on your Telegram profile page."; + +"Gift.View.SenderInfo" = "**%@** sent you this gift on **%@**."; diff --git a/submodules/AccountContext/Sources/PresentationCallManager.swift b/submodules/AccountContext/Sources/PresentationCallManager.swift index 5af4fe01a9..52e22072dd 100644 --- a/submodules/AccountContext/Sources/PresentationCallManager.swift +++ b/submodules/AccountContext/Sources/PresentationCallManager.swift @@ -223,6 +223,7 @@ public struct PresentationGroupCallState: Equatable { public var muteState: GroupCallParticipantsContext.Participant.MuteState? public var defaultParticipantMuteState: DefaultParticipantMuteState? public var messagesAreEnabled: Bool + public var canEnableMessages: Bool public var recordingStartTimestamp: Int32? public var title: String? public var raisedHand: Bool @@ -240,6 +241,7 @@ public struct PresentationGroupCallState: Equatable { muteState: GroupCallParticipantsContext.Participant.MuteState?, defaultParticipantMuteState: DefaultParticipantMuteState?, messagesAreEnabled: Bool, + canEnableMessages: Bool, recordingStartTimestamp: Int32?, title: String?, raisedHand: Bool, @@ -256,6 +258,7 @@ public struct PresentationGroupCallState: Equatable { self.muteState = muteState self.defaultParticipantMuteState = defaultParticipantMuteState self.messagesAreEnabled = messagesAreEnabled + self.canEnableMessages = canEnableMessages self.recordingStartTimestamp = recordingStartTimestamp self.title = title self.raisedHand = raisedHand diff --git a/submodules/LegacyComponents/Sources/TGCameraMainPhoneView.m b/submodules/LegacyComponents/Sources/TGCameraMainPhoneView.m index e20ede364c..abc9292b39 100644 --- a/submodules/LegacyComponents/Sources/TGCameraMainPhoneView.m +++ b/submodules/LegacyComponents/Sources/TGCameraMainPhoneView.m @@ -657,7 +657,7 @@ [UIView animateWithDuration:0.2 delay:0.0 options:7 << 16 animations:^{ CGFloat offset = hidden ? 19 : 18 + 43; - _zoomModeView.frame = CGRectMake(floor((self.bounds.size.width - 129.0) / 2.0), self.bounds.size.height - _bottomPanelHeight - _bottomPanelOffset - offset, 129, 43); + _zoomModeView.frame = CGRectMake(floor((self.bounds.size.width - 172.0) / 2.0), self.bounds.size.height - _bottomPanelHeight - _bottomPanelOffset - offset, 172, 43); } completion:nil]; [UIView animateWithDuration:0.25 animations:^ diff --git a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift index cb2bb907e9..374f1eb246 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift @@ -29,6 +29,7 @@ private extension PresentationGroupCallState { muteState: GroupCallParticipantsContext.Participant.MuteState(canUnmute: true, mutedByYou: false), defaultParticipantMuteState: nil, messagesAreEnabled: true, + canEnableMessages: false, recordingStartTimestamp: nil, title: title, raisedHand: false, @@ -1538,7 +1539,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { adminIds: Set(), isCreator: false, defaultParticipantsAreMuted: callInfo.defaultParticipantsAreMuted ?? GroupCallParticipantsContext.State.DefaultParticipantsAreMuted(isMuted: self.stateValue.defaultParticipantMuteState == .muted, canChange: true), - messagesAreEnabled: callInfo.messagesAreEnabled ?? GroupCallParticipantsContext.State.MessagesAreEnabled(isEnabled: self.stateValue.messagesAreEnabled, canChange: true), + messagesAreEnabled: callInfo.messagesAreEnabled ?? GroupCallParticipantsContext.State.MessagesAreEnabled(isEnabled: self.stateValue.messagesAreEnabled, canChange: self.stateValue.canEnableMessages), sortAscending: true, recordingStartTimestamp: nil, title: self.stateValue.title, @@ -2616,6 +2617,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { self.stateValue.defaultParticipantMuteState = state.defaultParticipantsAreMuted.isMuted ? .muted : .unmuted } self.stateValue.messagesAreEnabled = state.messagesAreEnabled.isEnabled + self.stateValue.canEnableMessages = state.messagesAreEnabled.canChange self.stateValue.recordingStartTimestamp = state.recordingStartTimestamp self.stateValue.title = state.title self.stateValue.scheduleTimestamp = state.scheduleTimestamp diff --git a/submodules/TelegramCallsUI/Sources/VideoChatScreen.swift b/submodules/TelegramCallsUI/Sources/VideoChatScreen.swift index ce0bed3673..1b74810d85 100644 --- a/submodules/TelegramCallsUI/Sources/VideoChatScreen.swift +++ b/submodules/TelegramCallsUI/Sources/VideoChatScreen.swift @@ -1199,6 +1199,7 @@ final class VideoChatScreenComponent: Component { muteState: isMuted ? GroupCallParticipantsContext.Participant.MuteState(canUnmute: true, mutedByYou: true) : nil, defaultParticipantMuteState: nil, messagesAreEnabled: true, + canEnableMessages: false, recordingStartTimestamp: nil, title: nil, raisedHand: false, @@ -1842,7 +1843,6 @@ final class VideoChatScreenComponent: Component { text = environment.strings.VoiceChat_DisplayAsSuccess(peer.displayTitle(strings: environment.strings, displayOrder: groupCall.accountContext.sharedContext.currentPresentationData.with({ $0 }).nameDisplayOrder)).string } self.displayNotification(icon: .peer(peer), text: text, duration: 3) - //self.presentUndoOverlay(content: .invitedToVoiceChat(context: groupCall.accountContext, peer: peer, title: nil, text: text, action: nil, duration: 3), action: { _ in return false }) }) self.memberEventsDisposable?.dispose() @@ -1870,7 +1870,6 @@ final class VideoChatScreenComponent: Component { let text = environment.strings.VoiceChat_PeerJoinedText("**\(event.peer.displayTitle(strings: environment.strings, displayOrder: groupCall.accountContext.sharedContext.currentPresentationData.with({ $0 }).nameDisplayOrder))**").string self.displayNotification(icon: .peer(event.peer), text: text, duration: 3) - //self.presentUndoOverlay(content: .invitedToVoiceChat(context: groupCall.accountContext, peer: event.peer, title: nil, text: text, action: nil, duration: 3), action: { _ in return false }) } } } else { diff --git a/submodules/TelegramCallsUI/Sources/VideoChatScreenMoreMenu.swift b/submodules/TelegramCallsUI/Sources/VideoChatScreenMoreMenu.swift index 0d95cca58d..f1fd0514fa 100644 --- a/submodules/TelegramCallsUI/Sources/VideoChatScreenMoreMenu.swift +++ b/submodules/TelegramCallsUI/Sources/VideoChatScreenMoreMenu.swift @@ -228,28 +228,30 @@ extension VideoChatScreenComponent.View { self.openTitleEditing() }))) - items.append(.action(ContextMenuActionItem(text: callState.messagesAreEnabled ? environment.strings.VoiceChat_ContextDisableMessages : environment.strings.VoiceChat_ContextEnableMessages, icon: { theme -> UIImage? in - return generateTintedImage(image: UIImage(bundleImageName: callState.messagesAreEnabled ? "Call/MessagesDisable" : "Call/MessagesEnable"), color: theme.actionSheet.primaryTextColor) - }, action: { [weak self] _, f in - f(.default) - - guard let self, let currentCall = self.currentCall else { - return - } - let isEnabled = !callState.messagesAreEnabled - currentCall.setMessagesEnabled(isEnabled: isEnabled) - - let iconName: String - let text: String - if isEnabled { - iconName = "Call/ToastMessagesEnabled" - text = environment.strings.VoiceChat_ToastMessagesEnabled - } else { - iconName = "Call/ToastMessagesDisabled" - text = environment.strings.VoiceChat_ToastMessagesDisabled - } - self.displayNotification(icon: .icon(iconName), text: text, duration: 3) - }))) + if callState.canEnableMessages { + items.append(.action(ContextMenuActionItem(text: callState.messagesAreEnabled ? environment.strings.VoiceChat_ContextDisableMessages : environment.strings.VoiceChat_ContextEnableMessages, icon: { theme -> UIImage? in + return generateTintedImage(image: UIImage(bundleImageName: callState.messagesAreEnabled ? "Call/MessagesDisable" : "Call/MessagesEnable"), color: theme.actionSheet.primaryTextColor) + }, action: { [weak self] _, f in + f(.default) + + guard let self, let currentCall = self.currentCall else { + return + } + let isEnabled = !callState.messagesAreEnabled + currentCall.setMessagesEnabled(isEnabled: isEnabled) + + let iconName: String + let text: String + if isEnabled { + iconName = "Call/ToastMessagesEnabled" + text = environment.strings.VoiceChat_ToastMessagesEnabled + } else { + iconName = "Call/ToastMessagesDisabled" + text = environment.strings.VoiceChat_ToastMessagesDisabled + } + self.displayNotification(icon: .icon(iconName), text: text, duration: 3) + }))) + } var hasPermissions = true if let peer = self.peer, case let .channel(chatPeer) = peer { diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Calls/GroupCalls.swift b/submodules/TelegramCore/Sources/TelegramEngine/Calls/GroupCalls.swift index 7cdbfc3d2e..560ca53c15 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Calls/GroupCalls.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Calls/GroupCalls.swift @@ -2588,9 +2588,9 @@ public final class GroupCallParticipantsContext { } public func updateMessagesEnabled(isEnabled: Bool) { -// if isEnabled == self.stateValue.state.messagesAreEnabled.isEnabled { -// return -// } + if isEnabled == self.stateValue.state.messagesAreEnabled.isEnabled { + return + } self.stateValue.state.messagesAreEnabled.isEnabled = isEnabled self.updateMessagesEnabledDisposable.set((self.account.network.request(Api.functions.phone.toggleGroupCallSettings(flags: 1 << 2, call: self.reference.apiInputGroupCall, joinMuted: nil, messagesEnabled: isEnabled ? .boolTrue : .boolFalse)) diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Messages/Message.swift b/submodules/TelegramCore/Sources/TelegramEngine/Messages/Message.swift index 7990a10d82..30b173ed59 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Messages/Message.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Messages/Message.swift @@ -60,6 +60,9 @@ public final class EngineMessage: Equatable { public var localTags: LocalTags { return self.impl.localTags } + public var customTags: [CustomTag] { + return self.impl.customTags + } public var forwardInfo: ForwardInfo? { return self.impl.forwardInfo } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift b/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift index eb1f3534f5..be25f1fa74 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Payments/StarGifts.swift @@ -1226,6 +1226,46 @@ func _internal_dropStarGiftOriginalDetails(account: Account, reference: StarGift |> mapError { _ -> DropStarGiftOriginalDetailsError in return .generic } + |> mapToSignal { result in + if case .done = result, case let .message(messageId) = reference { + return account.postbox.transaction { transaction in + transaction.updateMessage(messageId, update: { currentMessage in + var storeForwardInfo: StoreMessageForwardInfo? + if let forwardInfo = currentMessage.forwardInfo { + storeForwardInfo = StoreMessageForwardInfo(authorId: forwardInfo.author?.id, sourceId: forwardInfo.source?.id, sourceMessageId: forwardInfo.sourceMessageId, date: forwardInfo.date, authorSignature: forwardInfo.authorSignature, psaType: forwardInfo.psaType, flags: forwardInfo.flags) + } + var media = currentMessage.media + if let action = media.first(where: { $0 is TelegramMediaAction }) as? TelegramMediaAction, case let .starGiftUnique(gift, isUpgrade, isTransferred, savedToProfile, canExportDate, transferStars, isRefunded, isPrepaidUpgrade, peerId, senderId, savedId, resaleAmount, canTransferDate, canResaleDate, _, assigned) = action.action, case let .unique(uniqueGift) = gift { + let updatedAttributes = uniqueGift.attributes.filter { $0.attributeType != .originalInfo } + media = [ + TelegramMediaAction( + action: .starGiftUnique( + gift: .unique(uniqueGift.withAttributes(updatedAttributes)), + isUpgrade: isUpgrade, + isTransferred: isTransferred, + savedToProfile: savedToProfile, + canExportDate: canExportDate, + transferStars: transferStars, + isRefunded: isRefunded, + isPrepaidUpgrade: isPrepaidUpgrade, + peerId: peerId, + senderId: senderId, + savedId: savedId, + resaleAmount: resaleAmount, + canTransferDate: canTransferDate, + canResaleDate: canResaleDate, + dropOriginalDetailsStars: nil, + assigned: assigned) + ) + ] + } + return .update(StoreMessage(id: currentMessage.id, customStableId: nil, globallyUniqueId: currentMessage.globallyUniqueId, groupingKey: currentMessage.groupingKey, threadId: currentMessage.threadId, timestamp: currentMessage.timestamp, flags: StoreMessageFlags(currentMessage.flags), tags: currentMessage.tags, globalTags: currentMessage.globalTags, localTags: currentMessage.localTags, forwardInfo: storeForwardInfo, authorId: currentMessage.author?.id, text: currentMessage.text, attributes: currentMessage.attributes, media: media)) + }) + } + |> castError(DropStarGiftOriginalDetailsError.self) + } + return .complete() + } |> ignoreValues } } diff --git a/submodules/TelegramStringFormatting/Sources/ServiceMessageStrings.swift b/submodules/TelegramStringFormatting/Sources/ServiceMessageStrings.swift index 75b72606ed..f936684cf8 100644 --- a/submodules/TelegramStringFormatting/Sources/ServiceMessageStrings.swift +++ b/submodules/TelegramStringFormatting/Sources/ServiceMessageStrings.swift @@ -1262,11 +1262,7 @@ public func universalServiceMessageString(presentationData: (PresentationTheme, } case let .starGiftUnique(gift, isUpgrade, _, _, _, _, _, isPrepaidUpgrade, peerId, senderId, _, resaleStars, _, _, _, assigned): if case let .unique(gift) = gift { - if assigned { - let attributes: [Int: MarkdownAttributeSet] = [0: boldAttributes] - let giftTitle = "\(gift.title) #\(presentationStringsFormattedNumber(gift.number, dateTimeFormat.groupingSeparator))" - attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_Assigned(giftTitle)._tuple, body: bodyAttributes, argumentAttributes: attributes) - } else if !forAdditionalServiceMessage && !"".isEmpty { + if !forAdditionalServiceMessage && !"".isEmpty { 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 @@ -1292,7 +1288,11 @@ public func universalServiceMessageString(presentationData: (PresentationTheme, } } } else { - if message.id.peerId.isTelegramNotifications && senderId == nil { + if message.id.peerId == accountPeerId && assigned { + let attributes: [Int: MarkdownAttributeSet] = [0: boldAttributes] + let giftTitle = "\(gift.title) #\(presentationStringsFormattedNumber(gift.number, dateTimeFormat.groupingSeparator))" + attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_Assigned(giftTitle)._tuple, body: bodyAttributes, argumentAttributes: attributes) + } else if message.id.peerId.isTelegramNotifications && senderId == nil { attributedString = NSAttributedString(string: strings.Notification_StarsGift_SentSomeone, font: titleFont, textColor: primaryTextColor) } else if message.author?.id == accountPeerId { if let resaleStars { diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageReplyInfoNode/Sources/ChatMessageReplyInfoNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageReplyInfoNode/Sources/ChatMessageReplyInfoNode.swift index 11e5e71808..ae7d338e7d 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageReplyInfoNode/Sources/ChatMessageReplyInfoNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageReplyInfoNode/Sources/ChatMessageReplyInfoNode.swift @@ -602,6 +602,8 @@ public class ChatMessageReplyInfoNode: ASDisplayNode { textCutout = TextNodeCutout(topLeft: CGSize(width: imageTextInset + 6.0, height: 10.0)) textCutoutWidth = imageTextInset + 6.0 } + } else if let _ = giftEmojiFileId { + additionalTitleWidth += 16.0 } adjustedConstrainedTextSize.width -= textLeftInset diff --git a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftRemoveInfoAlertController.swift b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftRemoveInfoAlertController.swift index a266d6daaf..a2e99d514c 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftRemoveInfoAlertController.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftRemoveInfoAlertController.swift @@ -76,7 +76,7 @@ private final class GiftRemoveInfoAlertContentNode: AlertContentNode { self.textNode.maximumNumberOfLines = 0 self.infoBackgroundNode = ASDisplayNode() - self.infoBackgroundNode.backgroundColor = ptheme.overallDarkAppearance ? ptheme.list.itemModalBlocksBackgroundColor : ptheme.list.itemInputField.backgroundColor + self.infoBackgroundNode.backgroundColor = ptheme.overallDarkAppearance ? ptheme.list.itemModalBlocksBackgroundColor : ptheme.list.itemPrimaryTextColor.withAlphaComponent(0.04) self.infoBackgroundNode.cornerRadius = 10.0 self.infoBackgroundNode.displaysAsynchronously = false @@ -200,27 +200,21 @@ private final class GiftRemoveInfoAlertContentNode: AlertContentNode { let format = senderName != nil ? presentationData.strings.Gift_Unique_OriginalInfoSenderWithText(senderName!, recipientName, dateString, "") : presentationData.strings.Gift_Unique_OriginalInfoWithText(recipientName, dateString, "") let string = NSMutableAttributedString(string: format.string, font: tableFont, textColor: tableTextColor) string.replaceCharacters(in: format.ranges[format.ranges.count - 1].range, with: attributedText) - if let senderPeerId { + if let _ = senderPeerId { string.addAttribute(.foregroundColor, value: tableLinkColor, range: format.ranges[0].range) - string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.PeerMention), value: TelegramPeerMention(peerId: senderPeerId, mention: ""), range: format.ranges[0].range) string.addAttribute(.foregroundColor, value: tableLinkColor, range: format.ranges[1].range) - string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.PeerMention), value: TelegramPeerMention(peerId: recipientPeerId, mention: ""), range: format.ranges[1].range) } else { string.addAttribute(.foregroundColor, value: tableLinkColor, range: format.ranges[0].range) - string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.PeerMention), value: TelegramPeerMention(peerId: recipientPeerId, mention: ""), range: format.ranges[0].range) } value = string } else { let format = senderName != nil ? presentationData.strings.Gift_Unique_OriginalInfoSender(senderName!, recipientName, dateString) : presentationData.strings.Gift_Unique_OriginalInfo(recipientName, dateString) let string = NSMutableAttributedString(string: format.string, font: tableFont, textColor: tableTextColor) - if let senderPeerId { + if let _ = senderPeerId { string.addAttribute(.foregroundColor, value: tableLinkColor, range: format.ranges[0].range) - string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.PeerMention), value: TelegramPeerMention(peerId: senderPeerId, mention: ""), range: format.ranges[0].range) string.addAttribute(.foregroundColor, value: tableLinkColor, range: format.ranges[1].range) - string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.PeerMention), value: TelegramPeerMention(peerId: recipientPeerId, mention: ""), range: format.ranges[1].range) } else { string.addAttribute(.foregroundColor, value: tableLinkColor, range: format.ranges[0].range) - string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.PeerMention), value: TelegramPeerMention(peerId: recipientPeerId, mention: ""), range: format.ranges[0].range) } value = string @@ -273,7 +267,7 @@ private final class GiftRemoveInfoAlertContentNode: AlertContentNode { let currentActionWidth: CGFloat do { - currentActionWidth = resultSize.width + currentActionWidth = resultSize.width } let actionNodeFrame: CGRect diff --git a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift index ac9e123834..a559e922c6 100644 --- a/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift +++ b/submodules/TelegramUI/Components/Gifts/GiftViewScreen/Sources/GiftViewScreen.swift @@ -738,6 +738,69 @@ private final class GiftViewSheetContent: CombinedComponent { case let .profileGift(peerId, gift): let updatedAttributes = uniqueGift.attributes.filter { $0.attributeType != .originalInfo } self.subject = .profileGift(peerId, gift.withGift(.unique(uniqueGift.withAttributes(updatedAttributes)))) + case let .message(message): + if let action = message.media.first(where: { $0 is TelegramMediaAction }) as? TelegramMediaAction, case let .starGiftUnique(gift, isUpgrade, isTransferred, savedToProfile, canExportDate, transferStars, isRefunded, isPrepaidUpgrade, peerId, senderId, savedId, resaleAmount, canTransferDate, canResaleDate, _, assigned) = action.action, case let .unique(uniqueGift) = gift { + let updatedAttributes = uniqueGift.attributes.filter { $0.attributeType != .originalInfo } + let updatedMedia: [Media] = [ + TelegramMediaAction( + action: .starGiftUnique( + gift: .unique(uniqueGift.withAttributes(updatedAttributes)), + isUpgrade: isUpgrade, + isTransferred: isTransferred, + savedToProfile: savedToProfile, + canExportDate: canExportDate, + transferStars: transferStars, + isRefunded: isRefunded, + isPrepaidUpgrade: isPrepaidUpgrade, + peerId: peerId, + senderId: senderId, + savedId: savedId, + resaleAmount: resaleAmount, + canTransferDate: canTransferDate, + canResaleDate: canResaleDate, + dropOriginalDetailsStars: nil, + assigned: assigned) + ) + ] + + var mappedPeers: [PeerId: EnginePeer] = [:] + for (id, peer) in message.peers { + mappedPeers[id] = EnginePeer(peer) + } + + var mappedAssociatedMessages: [MessageId: EngineMessage] = [:] + for (id, message) in message.associatedMessages { + mappedAssociatedMessages[id] = EngineMessage(message) + } + + let updatedMessage = EngineMessage( + stableId: message.stableId, + stableVersion: message.stableVersion, + id: message.id, + globallyUniqueId: message.globallyUniqueId, + groupingKey: message.groupingKey, + groupInfo: message.groupInfo, + threadId: message.threadId, + timestamp: message.timestamp, + flags: message.flags, + tags: message.tags, + globalTags: message.globalTags, + localTags: message.localTags, + customTags: message.customTags, + forwardInfo: message.forwardInfo, + author: message.author, + text: message.text, + attributes: message.attributes, + media: updatedMedia.map { EngineMedia($0) }, + peers: mappedPeers, + associatedMessages: mappedAssociatedMessages, + associatedMessageIds: message.associatedMessageIds, + associatedMedia: message.associatedMedia, + associatedThreadInfo: message.associatedThreadInfo, + associatedStories: message.associatedStories + ) + self.subject = .message(updatedMessage) + } default: break } @@ -1000,7 +1063,7 @@ private final class GiftViewSheetContent: CombinedComponent { } } - func presentActionLockedForHostedGift() { + func presentActionLockedForHostedGift(gift: StarGift.UniqueGift) { guard let controller = self.getController() as? GiftViewScreen else { return } @@ -1012,7 +1075,7 @@ private final class GiftViewSheetContent: CombinedComponent { text: presentationData.strings.Gift_UnavailableAction_Text, actions: [ TextAlertAction(type: .defaultAction, title: presentationData.strings.Gift_UnavailableAction_OpenFragment, action: { - context.sharedContext.openExternalUrl(context: context, urlContext: .generic, url: presentationData.strings.Gift_UnavailableAction_OpenFragment_URL, forceExternal: true, presentationData: presentationData, navigationController: controller.navigationController as? NavigationController, dismissInput: {}) + context.sharedContext.openExternalUrl(context: context, urlContext: .generic, url: "https://fragment.com/gift/\(gift.slug)", forceExternal: true, presentationData: presentationData, navigationController: controller.navigationController as? NavigationController, dismissInput: {}) }), TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}) ], @@ -1027,7 +1090,7 @@ private final class GiftViewSheetContent: CombinedComponent { } guard gift.hostPeerId == nil else { - self.presentActionLockedForHostedGift() + self.presentActionLockedForHostedGift(gift: gift) return } @@ -1092,7 +1155,7 @@ private final class GiftViewSheetContent: CombinedComponent { } guard gift.hostPeerId == nil else { - self.presentActionLockedForHostedGift() + self.presentActionLockedForHostedGift(gift: gift) return } @@ -2332,8 +2395,12 @@ private final class GiftViewSheetContent: CombinedComponent { limitTotal = nil convertStars = nil uniqueGift = gift - if let hostPeerId = gift.hostPeerId, hostPeerId == component.context.account.peerId { - isMyHostedUniqueGift = true + if let hostPeerId = gift.hostPeerId { + if hostPeerId == component.context.account.peerId { + isMyHostedUniqueGift = true + } else if let reference = arguments.reference, case let .peer(peerId, _) = reference, peerId.namespace == Namespaces.Peer.CloudChannel, hostPeerId == peerId { + isMyHostedUniqueGift = true + } } } savedToProfile = arguments.savedToProfile @@ -4797,10 +4864,13 @@ final class GiftViewSheetComponent: CombinedComponent { let controller = environment.controller var headerContent: AnyComponent? - if let arguments = context.component.subject.arguments, case .unique = arguments.gift, let fromPeerId = arguments.fromPeerId, let fromPeerName = arguments.fromPeerName, arguments.fromPeerId != context.component.context.account.peerId { + if let arguments = context.component.subject.arguments, case .unique = arguments.gift, let fromPeerId = arguments.fromPeerId, var fromPeerName = arguments.fromPeerName, arguments.fromPeerId != context.component.context.account.peerId && !(arguments.fromPeerId?.isTelegramNotifications ?? false) { let dateString = stringForMediumDate(timestamp: arguments.date, strings: environment.strings, dateTimeFormat: environment.dateTimeFormat, withTime: false) - let rawString = "**\(fromPeerName)** sent you this gift on **\(dateString)**." + if fromPeerName.count > 25 { + fromPeerName = "\(fromPeerName.prefix(25))…" + } + let rawString = environment.strings.Gift_View_SenderInfo(fromPeerName, dateString).string let attributedString = parseMarkdownIntoAttributedString(rawString, attributes: MarkdownAttributes(body: MarkdownAttributeSet(font: Font.regular(13.0), textColor: .white), bold: MarkdownAttributeSet(font: Font.semibold(13.0), textColor: .white), link: MarkdownAttributeSet(font: Font.regular(13.0), textColor: .white), linkAttribute: { _ in return nil })) let context = context.component.context diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/ListItems/PeerInfoScreenLabeledValueItem.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/ListItems/PeerInfoScreenLabeledValueItem.swift index 9714b3055b..9f8a03df3d 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/ListItems/PeerInfoScreenLabeledValueItem.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/ListItems/PeerInfoScreenLabeledValueItem.swift @@ -14,6 +14,7 @@ import EmojiTextAttachmentView import ComponentFlow import ButtonComponent import ComponentDisplayAdapters +import TextNodeWithEntities enum PeerInfoScreenLabeledValueTextColor { case primary @@ -69,6 +70,7 @@ final class PeerInfoScreenLabeledValueItem: PeerInfoScreenItem { let text: String let entities: [MessageTextEntity] let additionalText: String? + let handleSpoilers: Bool let textColor: PeerInfoScreenLabeledValueTextColor let textBehavior: PeerInfoScreenLabeledValueTextBehavior let leftIcon: PeerInfoScreenLabeledValueLeftIcon? @@ -89,6 +91,7 @@ final class PeerInfoScreenLabeledValueItem: PeerInfoScreenItem { text: String, entities: [MessageTextEntity] = [], additionalText: String? = nil, + handleSpoilers: Bool = false, textColor: PeerInfoScreenLabeledValueTextColor = .primary, textBehavior: PeerInfoScreenLabeledValueTextBehavior = .singleLine, leftIcon: PeerInfoScreenLabeledValueLeftIcon? = nil, @@ -108,6 +111,7 @@ final class PeerInfoScreenLabeledValueItem: PeerInfoScreenItem { self.text = text self.entities = entities self.additionalText = additionalText + self.handleSpoilers = handleSpoilers self.textColor = textColor self.textBehavior = textBehavior self.leftIcon = leftIcon @@ -157,7 +161,8 @@ private final class PeerInfoScreenLabeledValueItemNode: PeerInfoScreenItemNode { private let maskNode: ASImageNode private let labelNode: ImmediateTextNode private let rightLabelNode: ImmediateTextNode - private let textNode: ImmediateTextNode + private var spoilerTextNode: ImmediateTextNodeWithEntities? + private let textNode: ImmediateTextNodeWithEntities private let additionalTextNode: ImmediateTextNode private let measureTextNode: ImmediateTextNode private let bottomSeparatorNode: ASDisplayNode @@ -211,7 +216,7 @@ private final class PeerInfoScreenLabeledValueItemNode: PeerInfoScreenItemNode { self.rightLabelNode.displaysAsynchronously = false self.rightLabelNode.isUserInteractionEnabled = false - self.textNode = ImmediateTextNode() + self.textNode = ImmediateTextNodeWithEntities() self.textNode.displaysAsynchronously = false self.textNode.isUserInteractionEnabled = false @@ -391,7 +396,7 @@ private final class PeerInfoScreenLabeledValueItemNode: PeerInfoScreenItemNode { } self.view.addGestureRecognizer(recognizer) } - + @objc private func tapLongTapOrDoubleTapGesture(_ recognizer: TapLongTapOrDoubleTapGestureRecognizer) { switch recognizer.state { case .ended: @@ -522,6 +527,15 @@ private final class PeerInfoScreenLabeledValueItemNode: PeerInfoScreenItemNode { let additionalSideInset: CGFloat = !self.iconNode.isHidden ? 32.0 : 0.0 + self.textNode.arguments = TextNodeWithEntities.Arguments( + context: context, + cache: context.animationCache, + renderer: context.animationRenderer, + placeholderColor: presentationData.theme.list.mediaPlaceholderColor, + attemptSynchronous: false + ) + self.textNode.spoilerColor = presentationData.theme.list.itemPrimaryTextColor + var text = item.text let maxNumberOfLines: Int switch item.textBehavior { @@ -588,8 +602,6 @@ private final class PeerInfoScreenLabeledValueItemNode: PeerInfoScreenItemNode { collapsedNumberOfLines = 4 } - - maxNumberOfLines = self.isExpanded ? maxLines : collapsedNumberOfLines self.textNode.maximumNumberOfLines = maxNumberOfLines } @@ -683,6 +695,46 @@ private final class PeerInfoScreenLabeledValueItemNode: PeerInfoScreenItemNode { } textTransition.updateFrame(node: self.textNode, frame: textFrame) + if item.handleSpoilers { + let spoilerTextNode: ImmediateTextNodeWithEntities + if let current = self.spoilerTextNode { + spoilerTextNode = current + } else { + spoilerTextNode = ImmediateTextNodeWithEntities() + spoilerTextNode.alpha = 0.0 + self.spoilerTextNode = spoilerTextNode + + self.textNode.dustNode?.textNode = spoilerTextNode + } + + spoilerTextNode.displaySpoilers = true + spoilerTextNode.displaySpoilerEffect = false + spoilerTextNode.attributedText = self.textNode.attributedText + spoilerTextNode.maximumNumberOfLines = self.textNode.maximumNumberOfLines + spoilerTextNode.truncationType = self.textNode.truncationType + spoilerTextNode.textAlignment = self.textNode.textAlignment + spoilerTextNode.verticalAlignment = self.textNode.verticalAlignment + spoilerTextNode.lineSpacing = self.textNode.lineSpacing + spoilerTextNode.cutout = self.textNode.cutout + spoilerTextNode.insets = self.textNode.insets + spoilerTextNode.textShadowColor = self.textNode.textShadowColor + spoilerTextNode.textStroke = self.textNode.textStroke + spoilerTextNode.isUserInteractionEnabled = false + + let _ = spoilerTextNode.updateLayout(CGSize(width: width - sideInset * 2.0 - additionalSideInset, height: .greatestFiniteMagnitude)) + spoilerTextNode.frame = textFrame + + if spoilerTextNode.supernode == nil { + self.contextSourceNode.contentNode.addSubnode(spoilerTextNode) + } + } else if let spoilerTextNode = self.spoilerTextNode { + self.spoilerTextNode = nil + spoilerTextNode.removeFromSupernode() + + self.textNode.dustNode?.textNode = nil + } + + transition.updateFrame(node: self.additionalTextNode, frame: additionalTextFrame) let iconButtonFrame = CGRect(x: width - safeInsets.right - height, y: 0.0, width: height, height: height) @@ -820,6 +872,9 @@ private final class PeerInfoScreenLabeledValueItemNode: PeerInfoScreenItemNode { if let (index, attributes) = self.textNode.attributesAtPoint(CGPoint(x: point.x - textNodeFrame.minX, y: point.y - textNodeFrame.minY)) { var item: TextLinkItem? var urlRange: NSRange? + if let _ = attributes[NSAttributedString.Key(rawValue: TelegramTextAttributes.Spoiler)], let dustNode = self.textNode.dustNode, !dustNode.isRevealed { + return nil + } if let url = attributes[NSAttributedString.Key(rawValue: TelegramTextAttributes.URL)] as? String { item = .url(url: url, concealed: false) @@ -906,6 +961,14 @@ private final class PeerInfoScreenLabeledValueItemNode: PeerInfoScreenItemNode { break } } + if let _ = attributes[NSAttributedString.Key(rawValue: TelegramTextAttributes.Spoiler)], let dustNode = self.textNode.dustNode, !dustNode.isRevealed { + rects = nil + textNode = nil + + Queue.mainQueue().justDispatch { + dustNode.revealAtLocation(CGPoint(x: point.x - textNodeFrame.minX, y: point.y - textNodeFrame.minY)) + } + } } if textNode == nil { let additionalTextNodeFrame = self.additionalTextNode.frame diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift index 1c51a71f3a..81025bf22e 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift @@ -114,6 +114,7 @@ import VerifyAlertController import GiftViewScreen import PeerMessagesMediaPlaylist import EdgeEffect +import Pasteboard public enum PeerInfoAvatarEditingMode { case generic @@ -8278,8 +8279,10 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro } var noteText: String? + var noteEntities: [MessageTextEntity]? if let cachedData = cachedData as? CachedUserData { noteText = cachedData.note?.text + noteEntities = cachedData.note?.entities } guard let noteText, !noteText.isEmpty else { @@ -8290,7 +8293,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro guard let self else { return } - UIPasteboard.general.string = noteText + storeMessageTextInPasteboard(noteText, entities: noteEntities ?? []) let toastText = self.presentationData.strings.PeerInfo_ToastNoteCopied self.controller?.present(UndoOverlayController(presentationData: self.presentationData, content: .copy(text: toastText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoGiftsPaneNode.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoGiftsPaneNode.swift index 5057e9a486..c1409f7b9d 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoGiftsPaneNode.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoGiftsPaneNode.swift @@ -1335,7 +1335,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr text: presentationData.strings.Gift_UnavailableAction_Text, actions: [ TextAlertAction(type: .defaultAction, title: presentationData.strings.Gift_UnavailableAction_OpenFragment, action: { - context.sharedContext.openExternalUrl(context: context, urlContext: .generic, url: presentationData.strings.Gift_UnavailableAction_OpenFragment_URL, forceExternal: true, presentationData: presentationData, navigationController: nil, dismissInput: {}) + context.sharedContext.openExternalUrl(context: context, urlContext: .generic, url: "https://fragment.com/gift/\(uniqueGift.slug)", forceExternal: true, presentationData: presentationData, navigationController: nil, dismissInput: {}) }), TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}) ], diff --git a/submodules/TelegramUI/Components/Settings/BirthdayPickerScreen/Sources/BirthdayPickerContentComponent.swift b/submodules/TelegramUI/Components/Settings/BirthdayPickerScreen/Sources/BirthdayPickerContentComponent.swift index 0845c1d338..f55bb36caf 100644 --- a/submodules/TelegramUI/Components/Settings/BirthdayPickerScreen/Sources/BirthdayPickerContentComponent.swift +++ b/submodules/TelegramUI/Components/Settings/BirthdayPickerScreen/Sources/BirthdayPickerContentComponent.swift @@ -142,7 +142,18 @@ public final class BirthdayPickerContentComponent: Component { var contentHeight: CGFloat = 0.0 let titleString = NSMutableAttributedString() - titleString.append(NSAttributedString(string: self.peer.flatMap { component.strings.SuggestBirthdate_Suggest_Title($0.compactDisplayTitle).string } ?? component.strings.Birthday_Title, font: Font.semibold(17.0), textColor: component.theme.list.itemPrimaryTextColor)) + let titleRawString: String + if let peer = self.peer { + var peerName = peer.compactDisplayTitle + if peerName.count > 20 { + peerName = "\(peerName.prefix(20))…" + } + titleRawString = component.strings.SuggestBirthdate_Suggest_Title(peerName).string + } else { + titleRawString = component.strings.Birthday_Title + } + + titleString.append(NSAttributedString(string: titleRawString, font: Font.semibold(17.0), textColor: component.theme.list.itemPrimaryTextColor)) let titleSize = self.title.update( transition: .immediate, diff --git a/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/GiftListItemComponent.swift b/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/GiftListItemComponent.swift index 0709174e5a..87f23eca4a 100644 --- a/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/GiftListItemComponent.swift +++ b/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/GiftListItemComponent.swift @@ -23,6 +23,7 @@ final class GiftListItemComponent: Component { let selectedId: Int64? let selectionUpdated: (StarGift.UniqueGift) -> Void let tag: AnyObject? + let updated: (ComponentTransition) -> Void init( context: AccountContext, @@ -31,7 +32,8 @@ final class GiftListItemComponent: Component { starGifts: [StarGift], selectedId: Int64?, selectionUpdated: @escaping (StarGift.UniqueGift) -> Void, - tag: AnyObject? + tag: AnyObject?, + updated: @escaping (ComponentTransition) -> Void ) { self.context = context self.theme = theme @@ -40,6 +42,7 @@ final class GiftListItemComponent: Component { self.selectedId = selectedId self.selectionUpdated = selectionUpdated self.tag = tag + self.updated = updated } static func ==(lhs: GiftListItemComponent, rhs: GiftListItemComponent) -> Bool { @@ -151,16 +154,17 @@ final class GiftListItemComponent: Component { return } self.resaleGiftsState = state - if !self.isUpdating { - self.state?.updated(transition: isFirstTime ? .easeInOut(duration: 0.25) : .immediate) + let transition: ComponentTransition = isFirstTime ? .easeInOut(duration: 0.25) : .immediate + component.updated(transition) } isFirstTime = false })) } if !self.isUpdating { - self.state?.updated(transition: .easeInOut(duration: 0.25)) + let transition: ComponentTransition = .easeInOut(duration: 0.25) + component.updated(transition) } } diff --git a/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/UserApperanceScreen.swift b/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/UserApperanceScreen.swift index 9fb46e7c2b..a29ec3d6c6 100644 --- a/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/UserApperanceScreen.swift +++ b/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/UserApperanceScreen.swift @@ -183,6 +183,7 @@ final class UserAppearanceScreenComponent: Component { private let nameGiftsSection = ComponentView() private var isUpdating: Bool = false + private var forceNextUpdate = false private var component: UserAppearanceScreenComponent? private(set) weak var state: EmptyComponentState? @@ -887,6 +888,9 @@ final class UserAppearanceScreenComponent: Component { } } else { self.updatedPeerProfileEmoji = .some(nil) + if case .starGift = resolvedState.emojiStatus?.content { + self.updatedPeerStatus = .some(nil) + } } default: break @@ -943,6 +947,12 @@ final class UserAppearanceScreenComponent: Component { self.isUpdating = false } + var forceUpdate = false + if self.forceNextUpdate { + self.forceNextUpdate = false + forceUpdate = true + } + let environment = environment[EnvironmentType.self].value let themeUpdated = self.environment?.theme !== environment.theme self.environment = environment @@ -1383,7 +1393,6 @@ final class UserAppearanceScreenComponent: Component { selectedGiftId = id } //TODO:localize - self.profileGiftsSection.parentState = self.state let giftsSectionSize = self.profileGiftsSection.update( transition: transition, component: AnyComponent(ListSectionComponent( @@ -1445,13 +1454,22 @@ final class UserAppearanceScreenComponent: Component { self.state?.updated(transition: .spring(duration: 0.4)) } }, - tag: giftListTag + tag: giftListTag, + updated: { [weak self] transition in + if let self { + self.forceNextUpdate = true + if !self.isUpdating { + self.state?.updated(transition: transition) + } + } + } ) )), ], displaySeparators: false )), environment: {}, + forceUpdate: forceUpdate, containerSize: CGSize(width: availableSize.width - sideInset * 2.0, height: 10000.0) ) let giftsSectionFrame = CGRect(origin: CGPoint(x: sideInset, y: contentHeight), size: giftsSectionSize) @@ -1638,7 +1656,6 @@ final class UserAppearanceScreenComponent: Component { } } - self.nameGiftsSection.parentState = self.state let giftsSectionSize = self.nameGiftsSection.update( transition: transition, component: AnyComponent(ListSectionComponent( @@ -1674,13 +1691,21 @@ final class UserAppearanceScreenComponent: Component { self.updatedPeerNameEmoji = peerColor.backgroundEmojiId self.state?.updated(transition: .spring(duration: 0.4)) }, - tag: giftListTag + tag: giftListTag, + updated: { [weak self] transition in + if let self { + if !self.isUpdating { + self.state?.updated(transition: transition) + } + } + } ) )), ], displaySeparators: false )), environment: {}, + forceUpdate: forceUpdate, containerSize: CGSize(width: availableSize.width - sideInset * 2.0, height: 10000.0) ) let giftsSectionFrame = CGRect(origin: CGPoint(x: sideInset, y: contentHeight), size: giftsSectionSize) diff --git a/submodules/TelegramUI/Components/TextNodeWithEntities/Sources/TextNodeWithEntities.swift b/submodules/TelegramUI/Components/TextNodeWithEntities/Sources/TextNodeWithEntities.swift index 3e392a1ea7..9622b268fe 100644 --- a/submodules/TelegramUI/Components/TextNodeWithEntities/Sources/TextNodeWithEntities.swift +++ b/submodules/TelegramUI/Components/TextNodeWithEntities/Sources/TextNodeWithEntities.swift @@ -665,9 +665,12 @@ public class ImmediateTextNodeWithEntities: TextNode { let _ = apply() + var enableAnimations = true if let arguments = self.arguments { self.updateInlineStickers(context: arguments.context, cache: arguments.cache, renderer: arguments.renderer, textLayout: layout, placeholderColor: arguments.placeholderColor, fontSizeNorm: arguments.fontSizeNorm) + enableAnimations = arguments.context.sharedContext.energyUsageSettings.fullTranslucency } + self.updateSpoilers(enableAnimations: enableAnimations, textLayout: layout) return ImmediateTextNodeLayoutInfo(size: layout.size, truncated: layout.truncated, numberOfLines: layout.numberOfLines) }