From 6ec58eb9b46e24b40d40114636d4fab9ecc8d711 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Sun, 26 Nov 2023 20:11:40 +0400 Subject: [PATCH] Various fixes --- .../Telegram-iOS/en.lproj/Localizable.strings | 4 ++++ .../TGModernConversationInputMicButton.m | 24 ++++++++++++++++++- ...essageJoinedChannelBubbleContentNode.swift | 4 ++-- .../StoryContentCaptionComponent.swift | 13 ++++++---- .../TelegramUI/Sources/ChatController.swift | 3 +++ 5 files changed, 41 insertions(+), 7 deletions(-) diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 83ddf8f55f..b2a55dc231 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -10548,3 +10548,7 @@ Sorry for the inconvenience."; "MediaEditor.VideoRemovalConfirmation" = "Are you sure you want to delete video message?"; "MediaEditor.HoldToRecordVideo" = "Hold to record video"; + +"Chat.ChannelRecommendation.PremiumTooltip" = "Subcribe to [Telegram Premium]() to unlock up to **100** channels."; + +"Story.ForwardAuthorHiddenTooltip" = "The account was hidden by the user"; diff --git a/submodules/LegacyComponents/Sources/TGModernConversationInputMicButton.m b/submodules/LegacyComponents/Sources/TGModernConversationInputMicButton.m index 88ff9f0696..bf73ed470e 100644 --- a/submodules/LegacyComponents/Sources/TGModernConversationInputMicButton.m +++ b/submodules/LegacyComponents/Sources/TGModernConversationInputMicButton.m @@ -563,6 +563,27 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius _hidesPanelOnLock = true; } ++ (UIImage *)stopIconImage +{ + static dispatch_once_t onceToken; + static UIImage *iconImage; + dispatch_once(&onceToken, ^ + { + CGRect rect = CGRectMake(0, 0, 22.0f, 22.0f); + UIGraphicsBeginImageContextWithOptions(rect.size, false, 0); + CGContextRef context = UIGraphicsGetCurrentContext(); + + CGContextAddPath(context, [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 22, 22) cornerRadius:7].CGPath); + CGContextSetFillColorWithColor(context, UIColorRGBA(0x0ffffff, 1.3f).CGColor); + CGContextFillPath(context); + + iconImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + }); + return iconImage; +} + + - (void)animateLock { if (!_animatedIn) { return; @@ -575,8 +596,9 @@ static const CGFloat outerCircleMinScale = innerCircleRadius / outerCircleRadius snapshotView.frame = _innerIconView.frame; [_innerIconWrapperView insertSubview:snapshotView atIndex:0]; + UIImage *icon = _hidesPanelOnLock ? [TGModernConversationInputMicButton stopIconImage] : TGComponentsImageNamed(@"RecordSendIcon"); _previousIcon = _innerIconView.image; - [self setIcon:TGTintedImage(TGComponentsImageNamed(@"RecordSendIcon"), _pallete != nil ? _pallete.iconColor : [UIColor whiteColor])]; + [self setIcon:TGTintedImage(icon, _pallete != nil && !_hidesPanelOnLock ? _pallete.iconColor : [UIColor whiteColor])]; _currentScale = 1; _cancelTargetTranslation = 0; diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageJoinedChannelBubbleContentNode/Sources/ChatMessageJoinedChannelBubbleContentNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageJoinedChannelBubbleContentNode/Sources/ChatMessageJoinedChannelBubbleContentNode.swift index 7b354c8096..064658edfa 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageJoinedChannelBubbleContentNode/Sources/ChatMessageJoinedChannelBubbleContentNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageJoinedChannelBubbleContentNode/Sources/ChatMessageJoinedChannelBubbleContentNode.swift @@ -342,7 +342,7 @@ public class ChatMessageJoinedChannelBubbleContentNode: ChatMessageBubbleContent let presentationData = item.context.sharedContext.currentPresentationData.with { $0 } let controller = UndoOverlayController( presentationData: presentationData, - content: .premiumPaywall(title: nil, text: "Subcribe to [Telegram Premium]() to unlock up to **100** channels.", customUndoText: nil, timeout: nil, linkAction: nil), + content: .premiumPaywall(title: nil, text: item.presentationData.strings.Chat_ChannelRecommendation_PremiumTooltip, customUndoText: nil, timeout: nil, linkAction: nil), elevatedLayout: false, action: { [weak self] action in if case .info = action { @@ -680,7 +680,7 @@ private final class ChannelItemComponent: Component { self.component = component self.state = state - self.contextContainer.isGestureEnabled = component.contextAction != nil + self.contextContainer.isGestureEnabled = true let titleSize = self.title.update( transition: .immediate, diff --git a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContentCaptionComponent.swift b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContentCaptionComponent.swift index 12ddeeea5d..8e108c77d6 100644 --- a/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContentCaptionComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryContainerScreen/Sources/StoryContentCaptionComponent.swift @@ -674,7 +674,6 @@ final class StoryContentCaptionComponent: Component { let authorName: String let isChannel: Bool let text: String? - var isEnabled = true switch forwardInfo { case let .known(peer, _, _): @@ -701,7 +700,6 @@ final class StoryContentCaptionComponent: Component { authorName = name isChannel = false text = "" - isEnabled = false } if let text { @@ -731,9 +729,16 @@ final class StoryContentCaptionComponent: Component { action: { [weak self] in if let self, case let .known(peer, _, _) = forwardInfo, let story = self.forwardInfoStory { self.component?.openStory(peer, story) + } else if let controller = self?.component?.controller() as? StoryContainerScreen { + let tooltipController = TooltipController(content: .text(component.strings.Story_ForwardAuthorHiddenTooltip), baseFontSize: 17.0, dismissByTapOutside: true, dismissImmediatelyOnLayoutUpdate: true) + controller.present(tooltipController, in: .window(.root), with: TooltipControllerPresentationArguments(sourceNodeAndRect: { [weak self, weak controller] in + if let self, let controller, let forwardInfoPanel = self.forwardInfoPanel?.view { + return (controller.node, forwardInfoPanel.convert(forwardInfoPanel.bounds, to: controller.view)) + } + return nil + })) } - }, - isEnabled: isEnabled + } ) ), environment: {}, diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index e7e4c88d46..de51e8af43 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -10002,6 +10002,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G }, presentController: { [weak self] controller, arguments in self?.present(controller, in: .window(.root), with: arguments) }, presentControllerInCurrent: { [weak self] controller, arguments in + if controller is UndoOverlayController { + self?.dismissAllTooltips() + } self?.present(controller, in: .current, with: arguments) }, getNavigationController: { [weak self] in return self?.navigationController as? NavigationController