From 8fece7c49aad53deeea793f829523003b6796ed4 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Wed, 9 Apr 2025 15:01:57 +0400 Subject: [PATCH] Various fixes --- .../Sources/QuickShareToastScreen.swift | 4 ++-- .../Sources/StoryComposeLayer.swift | 2 -- .../TelegramUI/Sources/ChatController.swift | 15 +++++++++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/submodules/TelegramUI/Components/Chat/QuickShareScreen/Sources/QuickShareToastScreen.swift b/submodules/TelegramUI/Components/Chat/QuickShareScreen/Sources/QuickShareToastScreen.swift index 8864d62ac6..e1c71a1a22 100644 --- a/submodules/TelegramUI/Components/Chat/QuickShareScreen/Sources/QuickShareToastScreen.swift +++ b/submodules/TelegramUI/Components/Chat/QuickShareScreen/Sources/QuickShareToastScreen.swift @@ -237,7 +237,7 @@ private final class QuickShareToastScreenComponent: Component { transition: .immediate, component: AnyComponent(PlainButtonComponent( content: AnyComponent(MultilineTextComponent( - text: .plain(NSAttributedString(string: "Undo", font: Font.regular(17.0), textColor: environment.theme.list.itemAccentColor.withMultiplied(hue: 0.933, saturation: 0.61, brightness: 1.0))) + text: .plain(NSAttributedString(string: component.peer.id != component.context.account.peerId ? environment.strings.Undo_Undo : "", font: Font.regular(17.0), textColor: environment.theme.list.itemAccentColor.withMultiplied(hue: 0.933, saturation: 0.61, brightness: 1.0))) )), effectAlignment: .center, contentInsets: UIEdgeInsets(top: -8.0, left: -8.0, bottom: -8.0, right: -8.0), @@ -267,7 +267,7 @@ private final class QuickShareToastScreenComponent: Component { linkAttribute: { _ in return nil }) ))), environment: {}, - containerSize: CGSize(width: availableContentSize.width - contentInsets.left - contentInsets.right - spacing - iconSize.width - 16.0, height: availableContentSize.height) + containerSize: CGSize(width: availableContentSize.width - contentInsets.left - contentInsets.right - spacing - iconSize.width - actionButtonSize.width - 16.0 - 4.0, height: availableContentSize.height) ) var contentHeight: CGFloat = 0.0 diff --git a/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryComposeLayer.swift b/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryComposeLayer.swift index 5ff4735024..9a533f8c6e 100644 --- a/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryComposeLayer.swift +++ b/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryComposeLayer.swift @@ -28,8 +28,6 @@ func metalLibrary(device: MTLDevice) -> MTLLibrary? { return library } - - final class StoryBlobLayer: MetalEngineSubjectLayer, MetalEngineSubject { var internalData: MetalEngineSubjectInternalData? diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index f3d3d2ec17..f09798f46f 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -5754,6 +5754,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G } else { displayedPeerVerification = .single(false) } + + let globalPrivacySettings = context.engine.data.get(TelegramEngine.EngineData.Item.Configuration.GlobalPrivacy()) self.peerDisposable.set(combineLatest( queue: Queue.mainQueue(), @@ -5769,8 +5771,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G isPremiumRequiredForMessaging, managingBot, adMessage, - displayedPeerVerification - ).startStrict(next: { [weak self] peerView, globalNotificationSettings, onlineMemberCount, hasScheduledMessages, peerReportNotice, pinnedCount, threadInfo, hasSearchTags, hasSavedChats, isPremiumRequiredForMessaging, managingBot, adMessage, displayedPeerVerification in + displayedPeerVerification, + globalPrivacySettings + ).startStrict(next: { [weak self] peerView, globalNotificationSettings, onlineMemberCount, hasScheduledMessages, peerReportNotice, pinnedCount, threadInfo, hasSearchTags, hasSavedChats, isPremiumRequiredForMessaging, managingBot, adMessage, displayedPeerVerification, globalPrivacySettings in if let strongSelf = self { if strongSelf.peerView === peerView && strongSelf.reportIrrelvantGeoNotice == peerReportNotice && strongSelf.hasScheduledMessages == hasScheduledMessages && strongSelf.threadInfo == threadInfo && strongSelf.presentationInterfaceState.hasSearchTags == hasSearchTags && strongSelf.presentationInterfaceState.hasSavedChats == hasSavedChats && strongSelf.presentationInterfaceState.isPremiumRequiredForMessaging == isPremiumRequiredForMessaging && managingBot == strongSelf.presentationInterfaceState.contactStatus?.managingBot && adMessage?.id == strongSelf.presentationInterfaceState.adMessage?.id { return @@ -5869,6 +5872,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G var contactStatus: ChatContactStatus? var businessIntro: TelegramBusinessIntro? var sendPaidMessageStars: StarsAmount? + var alwaysShowGiftButton = false + var disallowedGifts: TelegramDisallowedGifts? if let peer = peerView.peers[peerView.peerId] { if let cachedData = peerView.cachedData as? CachedUserData { contactStatus = ChatContactStatus(canAddContact: !peerView.peerIsContact, canReportIrrelevantLocation: false, peerStatusSettings: cachedData.peerStatusSettings, invitedBy: nil, managingBot: managingBot) @@ -5878,6 +5883,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G if case let .peer(peerId) = chatLocation, peerId.namespace == Namespaces.Peer.SecretChat { } else { sendPaidMessageStars = cachedData.sendPaidMessageStars + if cachedData.disallowedGifts != .All { + alwaysShowGiftButton = globalPrivacySettings.displayGiftButton || cachedData.flags.contains(.displayGiftButton) + } + disallowedGifts = cachedData.disallowedGifts } } else if let cachedData = peerView.cachedData as? CachedGroupData { var invitedBy: Peer? @@ -6113,6 +6122,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G .updatedHasSearchTags(hasSearchTags) .updatedIsPremiumRequiredForMessaging(isPremiumRequiredForMessaging) .updatedSendPaidMessageStars(sendPaidMessageStars) + .updatedAlwaysShowGiftButton(alwaysShowGiftButton) + .updatedDisallowedGifts(disallowedGifts) .updatedHasSavedChats(hasSavedChats) .updatedAppliedBoosts(appliedBoosts) .updatedBoostsToUnrestrict(boostsToUnrestrict)