diff --git a/submodules/PhoneNumberFormat/Sources/PhoneNumbers.swift b/submodules/PhoneNumberFormat/Sources/PhoneNumbers.swift index b5e4652045..4ff9d7f6d6 100644 --- a/submodules/PhoneNumberFormat/Sources/PhoneNumbers.swift +++ b/submodules/PhoneNumberFormat/Sources/PhoneNumbers.swift @@ -39,7 +39,7 @@ private func removePlus(_ text: String?) -> String { return result } -private func lookupCountryIdByNumber(_ number: String, configuration: CountriesConfiguration) -> (Country, Country.CountryCode)? { +public func lookupCountryIdByNumber(_ number: String, configuration: CountriesConfiguration) -> (Country, Country.CountryCode)? { let number = removePlus(number) var results: [(Country, Country.CountryCode)]? = nil for i in 0 ..< number.count { diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index e439d566bd..e00e91e6ad 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -5473,13 +5473,15 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate return } - let _ = (getUserPeer(engine: self.context.engine, peerId: self.peerId) - |> deliverOnMainQueue).start(next: { [weak self] peer in + let _ = (combineLatest( + getUserPeer(engine: self.context.engine, peerId: self.peerId), + getUserPeer(engine: self.context.engine, peerId: self.context.account.peerId) + ) |> deliverOnMainQueue).start(next: { [weak self] peer, accountPeer in guard let strongSelf = self else { return } let presentationData = strongSelf.presentationData - + let telegramCallAction: (Bool) -> Void = { [weak self] isVideo in guard let strongSelf = self else { return @@ -5503,6 +5505,15 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .copy(text: presentationData.strings.Conversation_PhoneCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current) } + var accountIsFromUS = false + if let accountPeer, case let .user(user) = accountPeer, let phone = user.phone { + if let (country, _) = lookupCountryIdByNumber(phone, configuration: strongSelf.context.currentCountriesConfiguration.with { $0 }) { + if country.id == "US" { + accountIsFromUS = true + } + } + } + let formattedPhoneNumber = formatPhoneNumber(context: strongSelf.context, number: value) var isAnonymousNumber = false var items: [ContextMenuItem] = [] @@ -5552,7 +5563,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate ) } var actions = ContextController.Items(content: .list(items)) - if isAnonymousNumber { + if isAnonymousNumber && !accountIsFromUS { actions.tip = .animatedEmoji(text: strongSelf.presentationData.strings.UserInfo_AnonymousNumberInfo, arguments: nil, file: nil, action: { [weak self] in if let strongSelf = self { strongSelf.context.sharedContext.openExternalUrl(context: strongSelf.context, urlContext: .generic, url: "https://fragment.com", forceExternal: true, presentationData: strongSelf.presentationData, navigationController: nil, dismissInput: {})