From 2de35288528eb190951db4699338551cbbfaa768 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Sun, 11 Aug 2024 21:48:30 +0200 Subject: [PATCH] Various improvements --- .../Telegram-iOS/en.lproj/Localizable.strings | 2 +- .../Sources/ChatListController.swift | 16 ++++++ .../Sources/ChatListControllerNode.swift | 3 ++ .../Sources/Node/ChatListNode.swift | 2 +- .../Sources/Node/ChatListNoticeItem.swift | 37 +++++++------- .../Navigation/NavigationController.swift | 6 ++- .../Source/Navigation/NavigationLayout.swift | 5 ++ .../Display/Source/ViewController.swift | 1 + .../TelegramEngine/Payments/Stars.swift | 8 +-- .../Sources/ChatAvatarNavigationNode.swift | 50 +++++++++++++++++++ .../Sources/StarsPurchaseScreen.swift | 2 +- .../Sources/StarsTransactionScreen.swift | 18 +++++-- .../Sources/StarsTransactionsScreen.swift | 10 ++-- .../TelegramUI/Sources/TextLinkHandling.swift | 12 ++--- 14 files changed, 131 insertions(+), 41 deletions(-) diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 8a502a8149..0f76d386ed 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -12774,7 +12774,7 @@ Sorry for the inconvenience."; "ChatList.SubscriptionsLowBalance.Stars_1" = "%@ Star needed"; "ChatList.SubscriptionsLowBalance.Stars_any" = "%@ Stars needed"; -"ChatList.SubscriptionsLowBalance.Single.Title" = "%1$@ for %@$@"; +"ChatList.SubscriptionsLowBalance.Single.Title" = "%1$@ for %2$@"; "ChatList.SubscriptionsLowBalance.Single.Text" = "Insufficient funds to cover your subscription."; "ChatList.SubscriptionsLowBalance.Multiple.Title" = "%@ for your subscriptions"; diff --git a/submodules/ChatListUI/Sources/ChatListController.swift b/submodules/ChatListUI/Sources/ChatListController.swift index 0a3d4341b9..60b193b220 100644 --- a/submodules/ChatListUI/Sources/ChatListController.swift +++ b/submodules/ChatListUI/Sources/ChatListController.swift @@ -1174,6 +1174,14 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController } self.openBirthdaySetup() } + + self.chatListDisplayNode.mainContainerNode.openStarsTopup = { [weak self] amount in + guard let self else { + return + } + self.openStarsTopup(amount: amount) + } + self.chatListDisplayNode.mainContainerNode.openPremiumManagement = { [weak self] in guard let self else { return @@ -5978,6 +5986,14 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController self.push(controller) } + func openStarsTopup(amount: Int64?) { + guard let starsContext = self.context.starsContext else { + return + } + let controller = self.context.sharedContext.makeStarsPurchaseScreen(context: self.context, starsContext: starsContext, options: [], purpose: amount.flatMap({ .topUp(requiredStars: $0, purpose: "subs") }) ?? .generic, completion: { _ in }) + self.push(controller) + } + private var storyCameraTransitionInCoordinator: StoryCameraTransitionInCoordinator? var hasStoryCameraTransition: Bool { return self.storyCameraTransitionInCoordinator != nil diff --git a/submodules/ChatListUI/Sources/ChatListControllerNode.swift b/submodules/ChatListUI/Sources/ChatListControllerNode.swift index 99971d76a1..2b628cdf7d 100644 --- a/submodules/ChatListUI/Sources/ChatListControllerNode.swift +++ b/submodules/ChatListUI/Sources/ChatListControllerNode.swift @@ -348,6 +348,9 @@ public final class ChatListContainerNode: ASDisplayNode, ASGestureRecognizerDele itemNode.listNode.openPremiumManagement = { [weak self] in self?.openPremiumManagement?() } + itemNode.listNode.openStarsTopup = { [weak self] amount in + self?.openStarsTopup?(amount) + } self.currentItemStateValue.set(itemNode.listNode.state |> map { state in let filterId: Int32? diff --git a/submodules/ChatListUI/Sources/Node/ChatListNode.swift b/submodules/ChatListUI/Sources/Node/ChatListNode.swift index a670c2403b..d99c45eb76 100644 --- a/submodules/ChatListUI/Sources/Node/ChatListNode.swift +++ b/submodules/ChatListUI/Sources/Node/ChatListNode.swift @@ -1984,7 +1984,7 @@ public final class ChatListNode: ListView { if let starsSubscriptionsContext { return starsSubscriptionsContext.state |> map { state in - if state.balance > 0 { + if state.balance > 0 && !state.subscriptions.isEmpty { return .starsSubscriptionLowBalance( amount: state.balance, peers: state.subscriptions.map { $0.peer } diff --git a/submodules/ChatListUI/Sources/Node/ChatListNoticeItem.swift b/submodules/ChatListUI/Sources/Node/ChatListNoticeItem.swift index e3ce47bb39..cb37b98221 100644 --- a/submodules/ChatListUI/Sources/Node/ChatListNoticeItem.swift +++ b/submodules/ChatListUI/Sources/Node/ChatListNoticeItem.swift @@ -85,11 +85,12 @@ private let separatorHeight = 1.0 / UIScreen.main.scale private let titleFont = Font.semibold(15.0) private let textFont = Font.regular(15.0) +private let smallTextFont = Font.regular(14.0) final class ChatListNoticeItemNode: ItemListRevealOptionsItemNode { private let contentContainer: ASDisplayNode - private let titleNode: TextNode - private let textNode: TextNodeWithEntities + private let titleNode: TextNodeWithEntities + private let textNode: TextNode private let arrowNode: ASImageNode private let separatorNode: ASDisplayNode @@ -114,8 +115,8 @@ final class ChatListNoticeItemNode: ItemListRevealOptionsItemNode { required init() { self.contentContainer = ASDisplayNode() - self.titleNode = TextNode() - self.textNode = TextNodeWithEntities() + self.titleNode = TextNodeWithEntities() + self.textNode = TextNode() self.arrowNode = ASImageNode() self.separatorNode = ASDisplayNode() @@ -124,8 +125,8 @@ final class ChatListNoticeItemNode: ItemListRevealOptionsItemNode { self.contentContainer.clipsToBounds = true self.clipsToBounds = true - self.contentContainer.addSubnode(self.titleNode) - self.contentContainer.addSubnode(self.textNode.textNode) + self.contentContainer.addSubnode(self.titleNode.textNode) + self.contentContainer.addSubnode(self.textNode) self.contentContainer.addSubnode(self.arrowNode) self.addSubnode(self.contentContainer) @@ -154,8 +155,8 @@ final class ChatListNoticeItemNode: ItemListRevealOptionsItemNode { func asyncLayout() -> (_ item: ChatListNoticeItem, _ params: ListViewItemLayoutParams, _ isLast: Bool) -> (ListViewItemNodeLayout, () -> Void) { let previousItem = self.item - let makeTitleLayout = TextNode.asyncLayout(self.titleNode) - let makeTextLayout = TextNodeWithEntities.asyncLayout(self.textNode) + let makeTitleLayout = TextNodeWithEntities.asyncLayout(self.titleNode) + let makeTextLayout = TextNode.asyncLayout(self.textNode) let makeOkButtonTextLayout = TextNode.asyncLayout(self.okButtonText) let makeCancelButtonTextLayout = TextNode.asyncLayout(self.cancelButtonText) @@ -278,10 +279,10 @@ final class ChatListNoticeItemNode: ItemListRevealOptionsItemNode { let attributedTitle = NSMutableAttributedString(string: "⭐️\(title)", font: titleFont, textColor: item.theme.rootController.navigationBar.primaryTextColor) if let range = attributedTitle.string.range(of: "⭐️") { attributedTitle.addAttribute(ChatTextInputAttributes.customEmoji, value: ChatTextInputTextCustomEmojiAttribute(interactivelySelectedFromPackId: nil, fileId: 0, file: nil, custom: .stars(tinted: false)), range: NSRange(range, in: attributedTitle.string)) - attributedTitle.addAttribute(.baselineOffset, value: -1.0, range: NSRange(range, in: attributedTitle.string)) + attributedTitle.addAttribute(.baselineOffset, value: 2.0, range: NSRange(range, in: attributedTitle.string)) } titleString = attributedTitle - textString = NSAttributedString(string: text, font: textFont, textColor: item.theme.rootController.navigationBar.secondaryTextColor) + textString = NSAttributedString(string: text, font: smallTextFont, textColor: item.theme.rootController.navigationBar.secondaryTextColor) } var leftInset: CGFloat = sideInset @@ -311,19 +312,19 @@ final class ChatListNoticeItemNode: ItemListRevealOptionsItemNode { strongSelf.arrowNode.image = PresentationResourcesItemList.disclosureArrowImage(item.theme) } - let _ = titleLayout.1() + let _ = titleLayout.1(TextNodeWithEntities.Arguments(context: item.context, cache: item.context.animationCache, renderer: item.context.animationRenderer, placeholderColor: .white, attemptSynchronous: true)) if case .center = alignment { - strongSelf.titleNode.frame = CGRect(origin: CGPoint(x: floor((params.width - titleLayout.0.size.width) * 0.5), y: verticalInset), size: titleLayout.0.size) + strongSelf.titleNode.textNode.frame = CGRect(origin: CGPoint(x: floor((params.width - titleLayout.0.size.width) * 0.5), y: verticalInset), size: titleLayout.0.size) } else { - strongSelf.titleNode.frame = CGRect(origin: CGPoint(x: leftInset, y: verticalInset), size: titleLayout.0.size) + strongSelf.titleNode.textNode.frame = CGRect(origin: CGPoint(x: leftInset, y: verticalInset), size: titleLayout.0.size) } - let _ = textLayout.1(TextNodeWithEntities.Arguments(context: item.context, cache: item.context.animationCache, renderer: item.context.animationRenderer, placeholderColor: .white, attemptSynchronous: true)) + let _ = textLayout.1() if case .center = alignment { - strongSelf.textNode.textNode.frame = CGRect(origin: CGPoint(x: floor((params.width - textLayout.0.size.width) * 0.5), y: strongSelf.titleNode.frame.maxY + spacing), size: textLayout.0.size) + strongSelf.textNode.frame = CGRect(origin: CGPoint(x: floor((params.width - textLayout.0.size.width) * 0.5), y: strongSelf.titleNode.textNode.frame.maxY + spacing), size: textLayout.0.size) } else { - strongSelf.textNode.textNode.frame = CGRect(origin: CGPoint(x: leftInset, y: strongSelf.titleNode.frame.maxY + spacing), size: textLayout.0.size) + strongSelf.textNode.frame = CGRect(origin: CGPoint(x: leftInset, y: strongSelf.titleNode.textNode.frame.maxY + spacing), size: textLayout.0.size) } if !avatarPeers.isEmpty { @@ -405,8 +406,8 @@ final class ChatListNoticeItemNode: ItemListRevealOptionsItemNode { let buttonWidth: CGFloat = floor(buttonsWidth * 0.5) let buttonHeight: CGFloat = 32.0 - let okButtonFrame = CGRect(origin: CGPoint(x: floor((params.width - buttonsWidth) * 0.5), y: strongSelf.textNode.textNode.frame.maxY + 6.0), size: CGSize(width: buttonWidth, height: buttonHeight)) - let cancelButtonFrame = CGRect(origin: CGPoint(x: okButtonFrame.maxX, y: strongSelf.textNode.textNode.frame.maxY + 6.0), size: CGSize(width: buttonWidth, height: buttonHeight)) + let okButtonFrame = CGRect(origin: CGPoint(x: floor((params.width - buttonsWidth) * 0.5), y: strongSelf.textNode.frame.maxY + 6.0), size: CGSize(width: buttonWidth, height: buttonHeight)) + let cancelButtonFrame = CGRect(origin: CGPoint(x: okButtonFrame.maxX, y: strongSelf.textNode.frame.maxY + 6.0), size: CGSize(width: buttonWidth, height: buttonHeight)) okButton.frame = okButtonFrame cancelButton.frame = cancelButtonFrame diff --git a/submodules/Display/Source/Navigation/NavigationController.swift b/submodules/Display/Source/Navigation/NavigationController.swift index 60c371dd67..ba10231f7e 100644 --- a/submodules/Display/Source/Navigation/NavigationController.swift +++ b/submodules/Display/Source/Navigation/NavigationController.swift @@ -745,8 +745,10 @@ open class NavigationController: UINavigationController, ContainableController, let modalContainer = self.modalContainers[i] var isStandaloneModal = false - if let controller = modalContainer.container.controllers.first, case .standaloneModal = controller.navigationPresentation { - isStandaloneModal = true + if let controller = modalContainer.container.controllers.first { + if [.standaloneModal, .standaloneFlatModal].contains(controller.navigationPresentation) { + isStandaloneModal = true + } } let containerTransition: ContainedViewLayoutTransition diff --git a/submodules/Display/Source/Navigation/NavigationLayout.swift b/submodules/Display/Source/Navigation/NavigationLayout.swift index 61cfc02b45..a2a123c073 100644 --- a/submodules/Display/Source/Navigation/NavigationLayout.swift +++ b/submodules/Display/Source/Navigation/NavigationLayout.swift @@ -43,6 +43,11 @@ func makeNavigationLayout(mode: NavigationControllerMode, layout: ContainerViewL requiresModal = true beginsModal = true isStandalone = true + case .standaloneFlatModal: + requiresModal = true + beginsModal = true + isStandalone = true + isFlat = true case .modalInLargeLayout: switch layout.metrics.widthClass { case .compact: diff --git a/submodules/Display/Source/ViewController.swift b/submodules/Display/Source/ViewController.swift index 0c3d1a7e92..aaf2778854 100644 --- a/submodules/Display/Source/ViewController.swift +++ b/submodules/Display/Source/ViewController.swift @@ -64,6 +64,7 @@ public enum ViewControllerNavigationPresentation { case modal case flatModal case standaloneModal + case standaloneFlatModal case modalInLargeLayout case modalInCompactLayout } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Payments/Stars.swift b/submodules/TelegramCore/Sources/TelegramEngine/Payments/Stars.swift index b38d00b01d..714e87683e 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Payments/Stars.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Payments/Stars.swift @@ -251,7 +251,9 @@ private func _internal_requestStarsSubscriptions(account: Account, peerId: Engin if let subscriptions { for entry in subscriptions { if let parsedSubscription = StarsContext.State.Subscription(apiSubscription: entry, transaction: transaction) { - parsedSubscriptions.append(parsedSubscription) + if !missingBalance || parsedSubscription.flags.contains(.missingBalance) { + parsedSubscriptions.append(parsedSubscription) + } } } } @@ -923,7 +925,7 @@ private final class StarsSubscriptionsContextImpl { private var stateDisposable: Disposable? private let updateDisposable = MetaDisposable() - init(account: Account, starsContext: StarsContext?, missingBalance: Bool = false) { + init(account: Account, starsContext: StarsContext?, missingBalance: Bool) { assert(Queue.mainQueue().isCurrent()) self.account = account @@ -964,7 +966,7 @@ private final class StarsSubscriptionsContextImpl { self.nextOffset = status.nextSubscriptionsOffset var updatedState = self._state - updatedState.balance = status.balance + updatedState.balance = status.subscriptionsMissingBalance ?? 0 updatedState.subscriptions = nextOffset.isEmpty ? status.subscriptions : updatedState.subscriptions + status.subscriptions updatedState.isLoading = false updatedState.canLoadMore = self.nextOffset != nil diff --git a/submodules/TelegramUI/Components/Chat/ChatAvatarNavigationNode/Sources/ChatAvatarNavigationNode.swift b/submodules/TelegramUI/Components/Chat/ChatAvatarNavigationNode/Sources/ChatAvatarNavigationNode.swift index 1917457a40..865e0b55ac 100644 --- a/submodules/TelegramUI/Components/Chat/ChatAvatarNavigationNode/Sources/ChatAvatarNavigationNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatAvatarNavigationNode/Sources/ChatAvatarNavigationNode.swift @@ -33,6 +33,7 @@ public final class ChatAvatarNavigationNode: ASDisplayNode { public var storyData: (hasUnseen: Bool, hasUnseenCloseFriends: Bool)? public let statusView: ComponentView + private var starView: StarView? private var cachedDataDisposable = MetaDisposable() private var hierarchyTrackingLayer: HierarchyTrackingLayer? @@ -120,6 +121,25 @@ public final class ChatAvatarNavigationNode: ASDisplayNode { self.context = context self.avatarNode.setPeer(context: context, theme: theme, peer: peer, authorOfMessage: authorOfMessage, overrideImage: overrideImage, emptyColor: emptyColor, clipStyle: clipStyle, synchronousLoad: synchronousLoad, displayDimensions: displayDimensions, storeUnrounded: storeUnrounded) + if let peer, peer.isSubscription { + let starView: StarView + if let current = self.starView { + starView = current + } else { + starView = StarView() + self.starView = starView + self.containerNode.view.addSubview(starView) + } + starView.outlineColor = theme.rootController.navigationBar.opaqueBackgroundColor + + let starSize = CGSize(width: 15.0, height: 15.0) + let starFrame = CGRect(origin: CGPoint(x: self.containerNode.bounds.width - starSize.width + 1.0, y: self.containerNode.bounds.height - starSize.height + 1.0), size: starSize) + starView.frame = starFrame + } else if let starView = self.starView { + self.starView = nil + starView.removeFromSuperview() + } + if let peer = peer, peer.isPremium { self.cachedDataDisposable.set((context.account.postbox.peerView(id: peer.id) |> deliverOnMainQueue).start(next: { [weak self] peerView in @@ -283,3 +303,33 @@ public final class ChatAvatarNavigationNode: ASDisplayNode { } } } + +private class StarView: UIView { + let outline = SimpleLayer() + let foreground = SimpleLayer() + + var outlineColor: UIColor = .white { + didSet { + self.outline.layerTintColor = self.outlineColor.cgColor + } + } + + override init(frame: CGRect) { + self.outline.contents = UIImage(bundleImageName: "Premium/Stars/StarMediumOutline")?.cgImage + self.foreground.contents = UIImage(bundleImageName: "Premium/Stars/StarMedium")?.cgImage + + super.init(frame: frame) + + self.layer.addSublayer(self.outline) + self.layer.addSublayer(self.foreground) + } + + required init?(coder: NSCoder) { + preconditionFailure() + } + + override func layoutSubviews() { + self.outline.frame = self.bounds + self.foreground.frame = self.bounds + } +} diff --git a/submodules/TelegramUI/Components/Stars/StarsPurchaseScreen/Sources/StarsPurchaseScreen.swift b/submodules/TelegramUI/Components/Stars/StarsPurchaseScreen/Sources/StarsPurchaseScreen.swift index f1765f36f4..0ea22e1777 100644 --- a/submodules/TelegramUI/Components/Stars/StarsPurchaseScreen/Sources/StarsPurchaseScreen.swift +++ b/submodules/TelegramUI/Components/Stars/StarsPurchaseScreen/Sources/StarsPurchaseScreen.swift @@ -1169,7 +1169,7 @@ func generateStarsIcon(count: Int) -> UIImage { let mainImage = UIImage(bundleImageName: "Premium/Stars/StarLarge") if let cgImage = mainImage?.cgImage, let partCGImage = partImage.cgImage { - context.draw(cgImage, in: CGRect(origin: CGPoint(x: originX, y: 0.0), size: imageSize), byTiling: false) + context.draw(cgImage, in: CGRect(origin: CGPoint(x: originX, y: 0.0), size: imageSize).insetBy(dx: -1.5, dy: -1.5), byTiling: false) originX += spacing + UIScreenPixel for _ in 0 ..< count - 1 { diff --git a/submodules/TelegramUI/Components/Stars/StarsTransactionScreen/Sources/StarsTransactionScreen.swift b/submodules/TelegramUI/Components/Stars/StarsTransactionScreen/Sources/StarsTransactionScreen.swift index 0849afdcad..a03c0ee0d2 100644 --- a/submodules/TelegramUI/Components/Stars/StarsTransactionScreen/Sources/StarsTransactionScreen.swift +++ b/submodules/TelegramUI/Components/Stars/StarsTransactionScreen/Sources/StarsTransactionScreen.swift @@ -241,18 +241,26 @@ private final class StarsTransactionSheetContent: CombinedComponent { isSubscription = true var hasLeft = false - if let toPeer, case let .channel(channel) = toPeer, channel.participationStatus == .left { - hasLeft = true + var isKicked = false + if let toPeer, case let .channel(channel) = toPeer { + switch channel.participationStatus { + case .left: + hasLeft = true + case .kicked: + isKicked = true + default: + break + } } - if hasLeft { + if hasLeft || isKicked { if subscription.flags.contains(.isCancelled) { statusText = strings.Stars_Transaction_Subscription_Cancelled statusIsDestructive = true if date > Int32(CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970) { buttonText = strings.Stars_Transaction_Subscription_Renew } else { - if let _ = subscription.inviteHash { + if let _ = subscription.inviteHash, !isKicked { buttonText = strings.Stars_Transaction_Subscription_JoinAgainChannel } else { buttonText = strings.Common_OK @@ -1136,7 +1144,7 @@ public class StarsTransactionScreen: ViewControllerComponentContainer { theme: forceDark ? .dark : .default ) - self.navigationPresentation = .flatModal + self.navigationPresentation = .standaloneFlatModal self.automaticallyControlPresentationContextLayout = false openPeerImpl = { [weak self] peer in diff --git a/submodules/TelegramUI/Components/Stars/StarsTransactionsScreen/Sources/StarsTransactionsScreen.swift b/submodules/TelegramUI/Components/Stars/StarsTransactionsScreen/Sources/StarsTransactionsScreen.swift index 7b654761cd..d85c0e58e3 100644 --- a/submodules/TelegramUI/Components/Stars/StarsTransactionsScreen/Sources/StarsTransactionsScreen.swift +++ b/submodules/TelegramUI/Components/Stars/StarsTransactionsScreen/Sources/StarsTransactionsScreen.swift @@ -135,7 +135,7 @@ final class StarsTransactionsScreenComponent: Component { private var allTransactionsContext: StarsTransactionsContext? private var incomingTransactionsContext: StarsTransactionsContext? private var outgoingTransactionsContext: StarsTransactionsContext? - + override init(frame: CGRect) { self.navigationBackgroundView = BlurredBackgroundView(color: nil, enableBlur: true) self.navigationBackgroundView.alpha = 0.0 @@ -912,6 +912,8 @@ public final class StarsTransactionsScreen: ViewControllerComponentContainer { private let options = Promise<[StarsTopUpOption]>() + private let navigateDisposable = MetaDisposable() + public init(context: AccountContext, starsContext: StarsContext, forceDark: Bool = false) { self.context = context self.starsContext = starsContext @@ -979,7 +981,7 @@ public final class StarsTransactionsScreen: ViewControllerComponentContainer { } } else { if let inviteHash = subscription.inviteHash { - self.context.sharedContext.openResolvedUrl(.join(inviteHash), context: self.context, urlContext: .generic, navigationController: self.navigationController as? NavigationController, forceExternal: false, openPeer: { _, _ in }, sendFile: nil, sendSticker: nil, sendEmoji: nil, requestMessageActionUrlAuth: nil, joinVoiceChat: nil, present: { _, _ in }, dismissInput: {}, contentContext: nil, progress: Promise(), completion: nil) + self.context.sharedContext.handleTextLinkAction(context: self.context, peerId: nil, navigateDisposable: self.navigateDisposable, controller: self, action: .tap, itemLink: .url(url: "https://t.me/+\(inviteHash)", concealed: false)) } } }) @@ -1099,7 +1101,7 @@ public final class StarsTransactionsScreen: ViewControllerComponentContainer { fatalError("init(coder:) has not been implemented") } - override public func viewDidLoad() { - super.viewDidLoad() + deinit { + self.navigateDisposable.dispose() } } diff --git a/submodules/TelegramUI/Sources/TextLinkHandling.swift b/submodules/TelegramUI/Sources/TextLinkHandling.swift index 5c3d6a7f65..d387a59935 100644 --- a/submodules/TelegramUI/Sources/TextLinkHandling.swift +++ b/submodules/TelegramUI/Sources/TextLinkHandling.swift @@ -92,15 +92,15 @@ func handleTextLinkActionImpl(context: AccountContext, peerId: EnginePeer.Id?, n let sourceLocation = InstantPageSourceLocation(userLocation: peerId.flatMap(MediaResourceUserLocation.peer) ?? .other, peerType: .group) let browserController = context.sharedContext.makeInstantPageController(context: context, webPage: webPage, anchor: anchor, sourceLocation: sourceLocation) (controller.navigationController as? NavigationController)?.pushViewController(browserController, animated: true) - case let .join(link): - controller.present(JoinLinkPreviewController(context: context, link: link, navigateToPeer: { peer, peekData in - openResolvedPeerImpl(peer, .chat(textInputState: nil, subject: nil, peekData: peekData)) - }, parentNavigationController: controller.navigationController as? NavigationController), in: .window(.root)) - case .boost, .chatFolder: +// case let .join(link): +// controller.present(JoinLinkPreviewController(context: context, link: link, navigateToPeer: { peer, peekData in +// openResolvedPeerImpl(peer, .chat(textInputState: nil, subject: nil, peekData: peekData)) +// }, parentNavigationController: controller.navigationController as? NavigationController), in: .window(.root)) + case .boost, .chatFolder, .join: if let navigationController = controller.navigationController as? NavigationController { openResolvedUrlImpl(result, context: context, urlContext: peerId.flatMap { .chat(peerId: $0, message: nil, updatedPresentationData: nil) } ?? .generic, navigationController: navigationController, forceExternal: false, openPeer: { peer, navigateToPeer in openResolvedPeerImpl(peer, navigateToPeer) - }, sendFile: nil, sendSticker: nil, sendEmoji: nil, joinVoiceChat: nil, present: { c, a in }, dismissInput: {}, contentContext: nil, progress: nil, completion: nil) + }, sendFile: nil, sendSticker: nil, sendEmoji: nil, joinVoiceChat: nil, present: { c, a in }, dismissInput: {}, contentContext: nil, progress: Promise(), completion: nil) } default: break