mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-02 00:17:02 +00:00
Merge commit 'a1ebe57732412ef869e7e3c41ea099a674431f70'
This commit is contained in:
commit
c2d2da131c
@ -721,8 +721,10 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
|
|
||||||
@objc private func tapGesture(_ recognizer: UITapGestureRecognizer) {
|
@objc private func tapGesture(_ recognizer: UITapGestureRecognizer) {
|
||||||
if case .ended = recognizer.state, let component = self.component, let itemLayout = self.itemLayout {
|
if case .ended = recognizer.state, let component = self.component, let itemLayout = self.itemLayout {
|
||||||
if hasFirstResponder(self) || self.sendMessageContext.currentInputMode == .media {
|
if self.hasActiveDeactivateableInput() {
|
||||||
self.deactivateInput()
|
Queue.mainQueue().justDispatch {
|
||||||
|
self.deactivateInput()
|
||||||
|
}
|
||||||
} else if self.displayViewList {
|
} else if self.displayViewList {
|
||||||
let point = recognizer.location(in: self)
|
let point = recognizer.location(in: self)
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ private final class PeerInfoScreenLabeledValueItemNode: PeerInfoScreenItemNode {
|
|||||||
if enabledEntities.isEmpty {
|
if enabledEntities.isEmpty {
|
||||||
return NSAttributedString(string: text, font: Font.regular(17.0), textColor: textColorValue)
|
return NSAttributedString(string: text, font: Font.regular(17.0), textColor: textColorValue)
|
||||||
} else {
|
} else {
|
||||||
let fontSize: CGFloat = 15.0
|
let fontSize: CGFloat = 17.0
|
||||||
|
|
||||||
let baseFont = Font.regular(fontSize)
|
let baseFont = Font.regular(fontSize)
|
||||||
let linkFont = baseFont
|
let linkFont = baseFont
|
||||||
|
@ -1195,6 +1195,11 @@ func peerInfoHeaderActionButtons(peer: Peer?, isSecretChat: Bool, isContact: Boo
|
|||||||
if !isContact && !isSecretChat, let user = peer as? TelegramUser, user.botInfo == nil {
|
if !isContact && !isSecretChat, let user = peer as? TelegramUser, user.botInfo == nil {
|
||||||
result = [.message, .addContact]
|
result = [.message, .addContact]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if "".isEmpty {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1202,9 +1207,7 @@ func peerInfoHeaderButtons(peer: Peer?, cachedData: CachedPeerData?, isOpenedFro
|
|||||||
var result: [PeerInfoHeaderButtonKey] = []
|
var result: [PeerInfoHeaderButtonKey] = []
|
||||||
if let user = peer as? TelegramUser {
|
if let user = peer as? TelegramUser {
|
||||||
if !isOpenedFromChat {
|
if !isOpenedFromChat {
|
||||||
if isContact || user.botInfo != nil {
|
result.append(.message)
|
||||||
result.append(.message)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
var callsAvailable = false
|
var callsAvailable = false
|
||||||
var videoCallsAvailable = false
|
var videoCallsAvailable = false
|
||||||
|
@ -1017,63 +1017,39 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
|
|||||||
items[.calls]!.append(PeerInfoScreenCallListItem(id: 20, messages: callMessages))
|
items[.calls]!.append(PeerInfoScreenCallListItem(id: 20, messages: callMessages))
|
||||||
}
|
}
|
||||||
|
|
||||||
var username: String?
|
if let phone = user.phone {
|
||||||
var additionalUsernames: String?
|
let formattedPhone = formatPhoneNumber(context: context, number: phone)
|
||||||
var phoneNumber: String?
|
let label: String
|
||||||
|
if formattedPhone.hasPrefix("+888 ") {
|
||||||
|
label = presentationData.strings.UserInfo_AnonymousNumberLabel
|
||||||
|
} else {
|
||||||
|
label = presentationData.strings.ContactInfo_PhoneLabelMobile
|
||||||
|
}
|
||||||
|
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 2, label: label, text: formattedPhone, textColor: .accent, action: { node in
|
||||||
|
interaction.openPhone(phone, node, nil)
|
||||||
|
}, longTapAction: nil, contextAction: { node, gesture, _ in
|
||||||
|
interaction.openPhone(phone, node, gesture)
|
||||||
|
}, requestLayout: {
|
||||||
|
interaction.requestLayout(false)
|
||||||
|
}))
|
||||||
|
}
|
||||||
if let mainUsername = user.addressName {
|
if let mainUsername = user.addressName {
|
||||||
username = mainUsername
|
var additionalUsernames: String?
|
||||||
let usernames = user.usernames.filter { $0.isActive && $0.username != mainUsername }
|
let usernames = user.usernames.filter { $0.isActive && $0.username != mainUsername }
|
||||||
if !usernames.isEmpty {
|
if !usernames.isEmpty {
|
||||||
additionalUsernames = presentationData.strings.Profile_AdditionalUsernames(String(usernames.map { "@\($0.username)" }.joined(separator: ", "))).string
|
additionalUsernames = presentationData.strings.Profile_AdditionalUsernames(String(usernames.map { "@\($0.username)" }.joined(separator: ", "))).string
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if let phone = user.phone {
|
|
||||||
phoneNumber = formatPhoneNumber(context: context, number: phone)
|
|
||||||
if let phone = phoneNumber, !phone.isEmpty && !phone.hasPrefix("+") {
|
|
||||||
phoneNumber = "+\(phone)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if user.botInfo == nil {
|
|
||||||
if username != nil || phoneNumber != nil {
|
|
||||||
items[.peerInfo]!.append(PeerInfoScreenContactInfoItem(
|
|
||||||
id: 1,
|
|
||||||
username: username.flatMap { "@\($0)" } ?? "",
|
|
||||||
phoneNumber: phoneNumber ?? "",
|
|
||||||
additionalText: additionalUsernames,
|
|
||||||
usernameAction: { _ in
|
|
||||||
interaction.openUsername(username ?? "")
|
|
||||||
},
|
|
||||||
usernameLongTapAction: { sourceNode in
|
|
||||||
interaction.openPeerInfoContextMenu(.link(customLink: nil), sourceNode, nil)
|
|
||||||
},
|
|
||||||
phoneAction: { node in
|
|
||||||
interaction.openPhone(phoneNumber ?? "", node, nil)
|
|
||||||
},
|
|
||||||
phoneLongTapAction: { _ in },
|
|
||||||
linkItemAction: { type, item, _, _ in
|
|
||||||
if case .tap = type {
|
|
||||||
if case let .mention(username) = item {
|
|
||||||
interaction.openUsername(String(username[username.index(username.startIndex, offsetBy: 1)...]))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
requestLayout: {
|
|
||||||
interaction.requestLayout(false)
|
|
||||||
}
|
|
||||||
))
|
|
||||||
}
|
|
||||||
} else if let username {
|
|
||||||
items[.peerInfo]!.append(
|
items[.peerInfo]!.append(
|
||||||
PeerInfoScreenLabeledValueItem(
|
PeerInfoScreenLabeledValueItem(
|
||||||
id: 1,
|
id: 1,
|
||||||
label: "",
|
label: presentationData.strings.Profile_Username,
|
||||||
text: "@\(username)",
|
text: "@\(mainUsername)",
|
||||||
additionalText: additionalUsernames,
|
additionalText: additionalUsernames,
|
||||||
textColor: .accent,
|
textColor: .accent,
|
||||||
icon: .qrCode,
|
icon: .qrCode,
|
||||||
action: { _ in
|
action: { _ in
|
||||||
interaction.openUsername(username)
|
interaction.openUsername(mainUsername)
|
||||||
}, longTapAction: { sourceNode in
|
}, longTapAction: { sourceNode in
|
||||||
interaction.openPeerInfoContextMenu(.link(customLink: nil), sourceNode, nil)
|
interaction.openPeerInfoContextMenu(.link(customLink: nil), sourceNode, nil)
|
||||||
}, linkItemAction: { type, item, _, _ in
|
}, linkItemAction: { type, item, _, _ in
|
||||||
@ -1097,11 +1073,11 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
|
|||||||
interaction.requestLayout(false)
|
interaction.requestLayout(false)
|
||||||
}))
|
}))
|
||||||
} else if user.isScam {
|
} else if user.isScam {
|
||||||
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: "", text: user.botInfo != nil ? presentationData.strings.UserInfo_ScamBotWarning : presentationData.strings.UserInfo_ScamUserWarning, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: user.botInfo != nil ? enabledPrivateBioEntities : []), action: nil, requestLayout: {
|
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: user.botInfo == nil ? presentationData.strings.Profile_About : presentationData.strings.Profile_BotInfo, text: user.botInfo != nil ? presentationData.strings.UserInfo_ScamBotWarning : presentationData.strings.UserInfo_ScamUserWarning, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: user.botInfo != nil ? enabledPrivateBioEntities : []), action: nil, requestLayout: {
|
||||||
interaction.requestLayout(false)
|
interaction.requestLayout(false)
|
||||||
}))
|
}))
|
||||||
} else if let about = cachedData.about, !about.isEmpty {
|
} else if let about = cachedData.about, !about.isEmpty {
|
||||||
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: "", text: about, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: user.isPremium ? enabledPublicBioEntities : enabledPrivateBioEntities), action: nil, longTapAction: bioContextAction, linkItemAction: bioLinkAction, requestLayout: {
|
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: user.botInfo == nil ? presentationData.strings.Profile_About : presentationData.strings.Profile_BotInfo, text: about, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: user.isPremium ? enabledPublicBioEntities : enabledPrivateBioEntities), action: nil, longTapAction: bioContextAction, linkItemAction: bioLinkAction, requestLayout: {
|
||||||
interaction.requestLayout(false)
|
interaction.requestLayout(false)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
@ -1123,6 +1099,14 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
|
|||||||
interaction.openReport(.user)
|
interaction.openReport(.user)
|
||||||
}))
|
}))
|
||||||
} else {
|
} else {
|
||||||
|
if !data.isContact {
|
||||||
|
if user.botInfo == nil {
|
||||||
|
items[.peerInfo]!.append(PeerInfoScreenActionItem(id: 3, text: presentationData.strings.PeerInfo_AddToContacts, action: {
|
||||||
|
interaction.openAddContact()
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var isBlocked = false
|
var isBlocked = false
|
||||||
if let cachedData = data.cachedData as? CachedUserData, cachedData.isBlocked {
|
if let cachedData = data.cachedData as? CachedUserData, cachedData.isBlocked {
|
||||||
isBlocked = true
|
isBlocked = true
|
||||||
@ -1135,7 +1119,7 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
|
|||||||
} else {
|
} else {
|
||||||
if user.flags.contains(.isSupport) || data.isContact {
|
if user.flags.contains(.isSupport) || data.isContact {
|
||||||
} else {
|
} else {
|
||||||
if user.botInfo == nil && isOpenedFromChat {
|
if user.botInfo == nil {
|
||||||
items[.peerInfo]!.append(PeerInfoScreenActionItem(id: 4, text: presentationData.strings.Conversation_BlockUser, color: .destructive, action: {
|
items[.peerInfo]!.append(PeerInfoScreenActionItem(id: 4, text: presentationData.strings.Conversation_BlockUser, color: .destructive, action: {
|
||||||
interaction.updateBlocked(true)
|
interaction.updateBlocked(true)
|
||||||
}))
|
}))
|
||||||
@ -1191,7 +1175,7 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
|
|||||||
items[.peerInfo]!.append(
|
items[.peerInfo]!.append(
|
||||||
PeerInfoScreenLabeledValueItem(
|
PeerInfoScreenLabeledValueItem(
|
||||||
id: ItemUsername,
|
id: ItemUsername,
|
||||||
label: "",
|
label: presentationData.strings.Channel_LinkItem,
|
||||||
text: linkText,
|
text: linkText,
|
||||||
textColor: .accent,
|
textColor: .accent,
|
||||||
icon: .qrCode,
|
icon: .qrCode,
|
||||||
@ -1243,7 +1227,7 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
|
|||||||
items[.peerInfo]!.append(
|
items[.peerInfo]!.append(
|
||||||
PeerInfoScreenLabeledValueItem(
|
PeerInfoScreenLabeledValueItem(
|
||||||
id: ItemUsername,
|
id: ItemUsername,
|
||||||
label: "",
|
label: presentationData.strings.Channel_LinkItem,
|
||||||
text: "https://t.me/\(mainUsername)",
|
text: "https://t.me/\(mainUsername)",
|
||||||
additionalText: additionalUsernames,
|
additionalText: additionalUsernames,
|
||||||
textColor: .accent,
|
textColor: .accent,
|
||||||
@ -1295,7 +1279,7 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
|
|||||||
if case .group = channel.info {
|
if case .group = channel.info {
|
||||||
enabledEntities = enabledPrivateBioEntities
|
enabledEntities = enabledPrivateBioEntities
|
||||||
}
|
}
|
||||||
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: ItemAbout, label: "", text: aboutText, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: enabledEntities), action: nil, longTapAction: bioContextAction, linkItemAction: bioLinkAction, requestLayout: {
|
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: ItemAbout, label: presentationData.strings.Channel_Info_Description, text: aboutText, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: enabledEntities), action: nil, longTapAction: bioContextAction, linkItemAction: bioLinkAction, requestLayout: {
|
||||||
interaction.requestLayout(true)
|
interaction.requestLayout(true)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
@ -1341,7 +1325,7 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let aboutText = aboutText {
|
if let aboutText = aboutText {
|
||||||
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: "", text: aboutText, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: enabledPrivateBioEntities), action: nil, longTapAction: bioContextAction, linkItemAction: bioLinkAction, requestLayout: {
|
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: presentationData.strings.Channel_Info_Description, text: aboutText, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: enabledPrivateBioEntities), action: nil, longTapAction: bioContextAction, linkItemAction: bioLinkAction, requestLayout: {
|
||||||
interaction.requestLayout(true)
|
interaction.requestLayout(true)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user