mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Codes improvements
This commit is contained in:
parent
8430789c5d
commit
ab6d94b4eb
@ -5822,8 +5822,6 @@ Sorry for the inconvenience.";
|
||||
|
||||
"Conversation.EditingPhotoPanelTitle" = "Edit Photo";
|
||||
|
||||
"Conversation.TextCopied" = "Text copied to clipboard";
|
||||
|
||||
"Media.LimitedAccessTitle" = "Limited Access to Media";
|
||||
"Media.LimitedAccessText" = "You've given Telegram access only to select number of photos.";
|
||||
"Media.LimitedAccessManage" = "Manage";
|
||||
@ -12941,3 +12939,5 @@ Sorry for the inconvenience.";
|
||||
"Notification.StarsGiveaway.Subtitle.Stars_any" = "%@ Stars";
|
||||
|
||||
"VerificationCodes.DescriptionText" = "This chat is used to receive verification codes from third-party services.";
|
||||
|
||||
"Conversation.CodeCopied" = "Code copied to clipboard";
|
||||
|
@ -806,7 +806,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
||||
var type: PeerType = .group
|
||||
for message in messages {
|
||||
if let user = message.author?._asPeer() as? TelegramUser {
|
||||
if user.botInfo != nil {
|
||||
if user.botInfo != nil && !user.id.isVerificationCodes {
|
||||
type = .bot
|
||||
} else {
|
||||
type = .user
|
||||
|
@ -764,7 +764,7 @@ public enum ChatListSearchEntry: Comparable, Identifiable {
|
||||
}
|
||||
|
||||
var status: ContactsPeerItemStatus = .none
|
||||
if case let .user(user) = primaryPeer, let _ = user.botInfo {
|
||||
if case let .user(user) = primaryPeer, let _ = user.botInfo, !primaryPeer.id.isVerificationCodes {
|
||||
if let subscriberCount = user.subscriberCount {
|
||||
status = .custom(string: presentationData.strings.Conversation_StatusBotSubscribers(subscriberCount), multiline: false, isActive: false, icon: nil)
|
||||
} else {
|
||||
|
@ -2270,14 +2270,20 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
|
||||
if let messagePeer = itemPeer.chatMainPeer {
|
||||
peerText = messagePeer.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
|
||||
}
|
||||
} else if let message = messages.last, let author = message.author?._asPeer(), let peer = itemPeer.chatMainPeer, !isUser {
|
||||
if case let .channel(peer) = peer, case .broadcast = peer.info {
|
||||
} else if !displayAsMessage {
|
||||
if let forwardInfo = message.forwardInfo, forwardInfo.flags.contains(.isImported), let authorSignature = forwardInfo.authorSignature {
|
||||
peerText = authorSignature
|
||||
} else {
|
||||
peerText = author.id == account.peerId ? item.presentationData.strings.DialogList_You : EnginePeer(author).displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
|
||||
authorIsCurrentChat = author.id == peer.id
|
||||
} else if let message = messages.last, let author = message.author?._asPeer(), let peer = itemPeer.chatMainPeer {
|
||||
if peer.id.isVerificationCodes {
|
||||
if let message = messages.last, let forwardInfo = message.forwardInfo, let author = forwardInfo.author {
|
||||
peerText = EnginePeer(author).compactDisplayTitle
|
||||
}
|
||||
} else if !isUser {
|
||||
if case let .channel(peer) = peer, case .broadcast = peer.info {
|
||||
} else if !displayAsMessage {
|
||||
if let forwardInfo = message.forwardInfo, forwardInfo.flags.contains(.isImported), let authorSignature = forwardInfo.authorSignature {
|
||||
peerText = authorSignature
|
||||
} else {
|
||||
peerText = author.id == account.peerId ? item.presentationData.strings.DialogList_You : EnginePeer(author).displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
|
||||
authorIsCurrentChat = author.id == peer.id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -551,7 +551,11 @@ public final class ChatMessageAvatarHeaderNodeImpl: ListViewItemHeaderNode, Chat
|
||||
}
|
||||
|
||||
public func setPeer(context: AccountContext, theme: PresentationTheme, synchronousLoad: Bool, peer: Peer, authorOfMessage: MessageReference?, emptyColor: UIColor) {
|
||||
self.containerNode.isGestureEnabled = true
|
||||
if let messageReference = self.messageReference, let id = messageReference.id {
|
||||
self.containerNode.isGestureEnabled = !id.peerId.isVerificationCodes
|
||||
} else {
|
||||
self.containerNode.isGestureEnabled = true
|
||||
}
|
||||
|
||||
var overrideImage: AvatarNodeImageOverride?
|
||||
if peer.isDeleted {
|
||||
|
@ -1376,7 +1376,7 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
}
|
||||
}
|
||||
|
||||
let enableCopy = !item.associatedData.isCopyProtectionEnabled && !item.message.isCopyProtected()
|
||||
let enableCopy = (!item.associatedData.isCopyProtectionEnabled && !item.message.isCopyProtected()) || item.message.id.peerId.isVerificationCodes
|
||||
textSelectionNode.enableCopy = enableCopy
|
||||
|
||||
var enableQuote = !item.message.text.isEmpty
|
||||
@ -1390,7 +1390,7 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
if !item.controllerInteraction.canSendMessages() && !enableCopy {
|
||||
enableQuote = false
|
||||
}
|
||||
if item.message.id.peerId.namespace == Namespaces.Peer.SecretChat {
|
||||
if item.message.id.peerId.namespace == Namespaces.Peer.SecretChat || item.message.id.peerId.isVerificationCodes {
|
||||
enableQuote = false
|
||||
}
|
||||
if item.message.containsSecretMedia {
|
||||
|
@ -11666,7 +11666,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
||||
var isBot = false
|
||||
for message in messages {
|
||||
if let author = message.author, case let .user(user) = author {
|
||||
if user.botInfo != nil {
|
||||
if user.botInfo != nil && !user.id.isVerificationCodes {
|
||||
isBot = true
|
||||
}
|
||||
break
|
||||
@ -11676,7 +11676,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
||||
if isBot {
|
||||
type = .bot
|
||||
} else if let user = peer as? TelegramUser {
|
||||
if user.botInfo != nil {
|
||||
if user.botInfo != nil && !user.id.isVerificationCodes {
|
||||
type = .bot
|
||||
} else {
|
||||
type = .user
|
||||
|
@ -4062,7 +4062,7 @@ extension ChatControllerImpl {
|
||||
}
|
||||
var isBot = false
|
||||
for message in messages {
|
||||
if let author = message.author, case let .user(user) = author, user.botInfo != nil {
|
||||
if let author = message.author, case let .user(user) = author, user.botInfo != nil && !user.id.isVerificationCodes {
|
||||
isBot = true
|
||||
break
|
||||
}
|
||||
@ -4071,7 +4071,7 @@ extension ChatControllerImpl {
|
||||
if isBot {
|
||||
type = .bot
|
||||
} else if let user = peer as? TelegramUser {
|
||||
if user.botInfo != nil {
|
||||
if user.botInfo != nil && !user.id.isVerificationCodes {
|
||||
type = .bot
|
||||
} else {
|
||||
type = .user
|
||||
|
@ -3800,8 +3800,13 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
if let strongSelf = self {
|
||||
storeMessageTextInPasteboard(text, entities: nil)
|
||||
|
||||
var infoText = presentationData.strings.Conversation_TextCopied
|
||||
if let peerId = strongSelf.chatLocation.peerId, peerId.isVerificationCodes && text.rangeOfCharacter(from: CharacterSet.decimalDigits.inverted) == nil {
|
||||
infoText = presentationData.strings.Conversation_CodeCopied
|
||||
}
|
||||
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.present(UndoOverlayController(presentationData: presentationData, content: .copy(text: presentationData.strings.Conversation_TextCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in
|
||||
strongSelf.present(UndoOverlayController(presentationData: presentationData, content: .copy(text: infoText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in
|
||||
return true
|
||||
}), in: .current)
|
||||
}
|
||||
|
@ -1110,7 +1110,7 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
let isSecret = self.chatPresentationInterfaceState.copyProtectionEnabled || self.chatLocation.peerId?.namespace == Namespaces.Peer.SecretChat
|
||||
let isSecret = self.chatPresentationInterfaceState.copyProtectionEnabled || self.chatLocation.peerId?.namespace == Namespaces.Peer.SecretChat || self.chatLocation.peerId?.isVerificationCodes == true
|
||||
if self.historyNodeContainer.isSecret != isSecret {
|
||||
self.historyNodeContainer.isSecret = isSecret
|
||||
setLayerDisableScreenshots(self.titleAccessoryPanelContainer.layer, isSecret)
|
||||
|
Loading…
x
Reference in New Issue
Block a user