Various fixes

This commit is contained in:
Ilya Laktyushin 2024-12-28 16:29:12 +04:00
parent bc6b9b1b61
commit acae4de3fb
12 changed files with 70 additions and 37 deletions

View File

@ -13601,3 +13601,7 @@ Sorry for the inconvenience.";
"Gift.View.Self.Title" = "Saved Gift"; "Gift.View.Self.Title" = "Saved Gift";
"Gift.View.Self.Description" = "You can display this gift on your page or turn it into a unique collectible and send to others."; "Gift.View.Self.Description" = "You can display this gift on your page or turn it into a unique collectible and send to others.";
"BotVerification.ChooseChat" = "Choose Chat to Verify";
"BotVerification.Added" = "**%@** has been notified and will receive your verification mark and description upon accepting.";
"BotVerification.Removed" = "You have removed **%@'s** verification.";

View File

@ -28,7 +28,6 @@ public struct ChatListNodePeersFilter: OptionSet {
public static let removeSearchHeader = ChatListNodePeersFilter(rawValue: 1 << 9) public static let removeSearchHeader = ChatListNodePeersFilter(rawValue: 1 << 9)
public static let excludeDisabled = ChatListNodePeersFilter(rawValue: 1 << 10) public static let excludeDisabled = ChatListNodePeersFilter(rawValue: 1 << 10)
public static let includeSavedMessages = ChatListNodePeersFilter(rawValue: 1 << 11)
public static let excludeChannels = ChatListNodePeersFilter(rawValue: 1 << 12) public static let excludeChannels = ChatListNodePeersFilter(rawValue: 1 << 12)
public static let onlyGroupsAndChannels = ChatListNodePeersFilter(rawValue: 1 << 13) public static let onlyGroupsAndChannels = ChatListNodePeersFilter(rawValue: 1 << 13)
@ -36,6 +35,8 @@ public struct ChatListNodePeersFilter: OptionSet {
public static let excludeGroups = ChatListNodePeersFilter(rawValue: 1 << 14) public static let excludeGroups = ChatListNodePeersFilter(rawValue: 1 << 14)
public static let excludeUsers = ChatListNodePeersFilter(rawValue: 1 << 15) public static let excludeUsers = ChatListNodePeersFilter(rawValue: 1 << 15)
public static let excludeBots = ChatListNodePeersFilter(rawValue: 1 << 16) public static let excludeBots = ChatListNodePeersFilter(rawValue: 1 << 16)
public static let includeSelf = ChatListNodePeersFilter(rawValue: 1 << 7)
} }

View File

@ -439,7 +439,7 @@ public enum ChatListSearchEntry: Comparable, Identifiable {
case topic(EnginePeer, ChatListItemContent.ThreadInfo, Int, PresentationTheme, PresentationStrings, ChatListSearchSectionExpandType) case topic(EnginePeer, ChatListItemContent.ThreadInfo, Int, PresentationTheme, PresentationStrings, ChatListSearchSectionExpandType)
case recentlySearchedPeer(EnginePeer, EnginePeer?, (Int32, Bool)?, Int, PresentationTheme, PresentationStrings, PresentationPersonNameOrder, PresentationPersonNameOrder, PeerStoryStats?, Bool) case recentlySearchedPeer(EnginePeer, EnginePeer?, (Int32, Bool)?, Int, PresentationTheme, PresentationStrings, PresentationPersonNameOrder, PresentationPersonNameOrder, PeerStoryStats?, Bool)
case localPeer(EnginePeer, EnginePeer?, (Int32, Bool)?, Int, PresentationTheme, PresentationStrings, PresentationPersonNameOrder, PresentationPersonNameOrder, ChatListSearchSectionExpandType, PeerStoryStats?, Bool) case localPeer(EnginePeer, EnginePeer?, (Int32, Bool)?, Int, PresentationTheme, PresentationStrings, PresentationPersonNameOrder, PresentationPersonNameOrder, ChatListSearchSectionExpandType, PeerStoryStats?, Bool, Bool)
case globalPeer(FoundPeer, (Int32, Bool)?, Int, PresentationTheme, PresentationStrings, PresentationPersonNameOrder, PresentationPersonNameOrder, ChatListSearchSectionExpandType, PeerStoryStats?, Bool, String?) case globalPeer(FoundPeer, (Int32, Bool)?, Int, PresentationTheme, PresentationStrings, PresentationPersonNameOrder, PresentationPersonNameOrder, ChatListSearchSectionExpandType, PeerStoryStats?, Bool, String?)
case message(EngineMessage, EngineRenderedPeer, EnginePeerReadCounters?, EngineMessageHistoryThread.Info?, ChatListPresentationData, Int32, Bool?, Bool, MessageOrderingKey, (id: String, size: Int64, isFirstInList: Bool)?, MessageSection, Bool, PeerStoryStats?, Bool, TelegramSearchPeersScope) case message(EngineMessage, EngineRenderedPeer, EnginePeerReadCounters?, EngineMessageHistoryThread.Info?, ChatListPresentationData, Int32, Bool?, Bool, MessageOrderingKey, (id: String, size: Int64, isFirstInList: Bool)?, MessageSection, Bool, PeerStoryStats?, Bool, TelegramSearchPeersScope)
case messagePlaceholder(Int32, ChatListPresentationData, TelegramSearchPeersScope) case messagePlaceholder(Int32, ChatListPresentationData, TelegramSearchPeersScope)
@ -452,7 +452,7 @@ public enum ChatListSearchEntry: Comparable, Identifiable {
return .threadId(threadInfo.id) return .threadId(threadInfo.id)
case let .recentlySearchedPeer(peer, _, _, _, _, _, _, _, _, _): case let .recentlySearchedPeer(peer, _, _, _, _, _, _, _, _, _):
return .localPeerId(peer.id) return .localPeerId(peer.id)
case let .localPeer(peer, _, _, _, _, _, _, _, _, _, _): case let .localPeer(peer, _, _, _, _, _, _, _, _, _, _, _):
return .localPeerId(peer.id) return .localPeerId(peer.id)
case let .globalPeer(peer, _, _, _, _, _, _, _, _, _, _): case let .globalPeer(peer, _, _, _, _, _, _, _, _, _, _):
return .globalPeerId(peer.peer.id) return .globalPeerId(peer.peer.id)
@ -481,8 +481,8 @@ public enum ChatListSearchEntry: Comparable, Identifiable {
} else { } else {
return false return false
} }
case let .localPeer(lhsPeer, lhsAssociatedPeer, lhsUnreadBadge, lhsIndex, lhsTheme, lhsStrings, lhsSortOrder, lhsDisplayOrder, lhsExpandType, lhsStoryStats, lhsRequiresPremiumForMessaging): case let .localPeer(lhsPeer, lhsAssociatedPeer, lhsUnreadBadge, lhsIndex, lhsTheme, lhsStrings, lhsSortOrder, lhsDisplayOrder, lhsExpandType, lhsStoryStats, lhsRequiresPremiumForMessaging, lhsIsSelf):
if case let .localPeer(rhsPeer, rhsAssociatedPeer, rhsUnreadBadge, rhsIndex, rhsTheme, rhsStrings, rhsSortOrder, rhsDisplayOrder, rhsExpandType, rhsStoryStats, rhsRequiresPremiumForMessaging) = rhs, lhsPeer == rhsPeer && lhsAssociatedPeer == rhsAssociatedPeer && lhsIndex == rhsIndex && lhsTheme === rhsTheme && lhsStrings === rhsStrings && lhsSortOrder == rhsSortOrder && lhsDisplayOrder == rhsDisplayOrder && lhsUnreadBadge?.0 == rhsUnreadBadge?.0 && lhsUnreadBadge?.1 == rhsUnreadBadge?.1 && lhsExpandType == rhsExpandType && lhsStoryStats == rhsStoryStats && lhsRequiresPremiumForMessaging == rhsRequiresPremiumForMessaging { if case let .localPeer(rhsPeer, rhsAssociatedPeer, rhsUnreadBadge, rhsIndex, rhsTheme, rhsStrings, rhsSortOrder, rhsDisplayOrder, rhsExpandType, rhsStoryStats, rhsRequiresPremiumForMessaging, rhsIsSelf) = rhs, lhsPeer == rhsPeer && lhsAssociatedPeer == rhsAssociatedPeer && lhsIndex == rhsIndex && lhsTheme === rhsTheme && lhsStrings === rhsStrings && lhsSortOrder == rhsSortOrder && lhsDisplayOrder == rhsDisplayOrder && lhsUnreadBadge?.0 == rhsUnreadBadge?.0 && lhsUnreadBadge?.1 == rhsUnreadBadge?.1 && lhsExpandType == rhsExpandType && lhsStoryStats == rhsStoryStats && lhsRequiresPremiumForMessaging == rhsRequiresPremiumForMessaging && lhsIsSelf == rhsIsSelf {
return true return true
} else { } else {
return false return false
@ -614,11 +614,11 @@ public enum ChatListSearchEntry: Comparable, Identifiable {
} else { } else {
return true return true
} }
case let .localPeer(_, _, _, lhsIndex, _, _, _, _, _, _, _): case let .localPeer(_, _, _, lhsIndex, _, _, _, _, _, _, _, _):
switch rhs { switch rhs {
case .topic, .recentlySearchedPeer: case .topic, .recentlySearchedPeer:
return false return false
case let .localPeer(_, _, _, rhsIndex, _, _, _, _, _, _, _): case let .localPeer(_, _, _, rhsIndex, _, _, _, _, _, _, _, _):
return lhsIndex <= rhsIndex return lhsIndex <= rhsIndex
case .globalPeer, .message, .messagePlaceholder, .emptyMessagesFooter, .addContact: case .globalPeer, .message, .messagePlaceholder, .emptyMessagesFooter, .addContact:
return true return true
@ -808,7 +808,7 @@ public enum ChatListSearchEntry: Comparable, Identifiable {
openStories(peer.id, sourceNode.avatarNode) openStories(peer.id, sourceNode.avatarNode)
} }
}) })
case let .localPeer(peer, associatedPeer, unreadBadge, _, theme, strings, nameSortOrder, nameDisplayOrder, expandType, storyStats, requiresPremiumForMessaging): case let .localPeer(peer, associatedPeer, unreadBadge, _, theme, strings, nameSortOrder, nameDisplayOrder, expandType, storyStats, requiresPremiumForMessaging, isSelf):
let primaryPeer: EnginePeer let primaryPeer: EnginePeer
var chatPeer: EnginePeer? var chatPeer: EnginePeer?
if let associatedPeer = associatedPeer { if let associatedPeer = associatedPeer {
@ -916,7 +916,7 @@ public enum ChatListSearchEntry: Comparable, Identifiable {
) )
} }
return ContactsPeerItem(presentationData: ItemListPresentationData(presentationData), sortOrder: nameSortOrder, displayOrder: nameDisplayOrder, context: context, peerMode: .generalSearch(isSavedMessages: isSavedMessages), peer: .peer(peer: primaryPeer, chatPeer: chatPeer), status: status, badge: badge, requiresPremiumForMessaging: requiresPremiumForMessaging, enabled: enabled, selection: .none, editing: ContactsPeerItemEditing(editable: false, editing: false, revealed: false), buttonAction: buttonAction, index: nil, header: header, action: { contactPeer in return ContactsPeerItem(presentationData: ItemListPresentationData(presentationData), sortOrder: nameSortOrder, displayOrder: nameDisplayOrder, context: context, peerMode: .generalSearch(isSavedMessages: isSavedMessages), aliasHandling: isSelf ? .standard : .treatSelfAsSaved, peer: .peer(peer: primaryPeer, chatPeer: chatPeer), status: status, badge: badge, requiresPremiumForMessaging: requiresPremiumForMessaging, enabled: enabled, selection: .none, editing: ContactsPeerItemEditing(editable: false, editing: false, revealed: false), buttonAction: buttonAction, index: nil, header: header, action: { contactPeer in
if case let .peer(maybePeer, maybeChatPeer) = contactPeer, let peer = maybePeer, let chatPeer = maybeChatPeer { if case let .peer(maybePeer, maybeChatPeer) = contactPeer, let peer = maybePeer, let chatPeer = maybeChatPeer {
interaction.peerSelected(chatPeer, peer, nil, nil, false) interaction.peerSelected(chatPeer, peer, nil, nil, false)
} else { } else {
@ -2783,7 +2783,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
} }
return false return false
} else { } else {
guard !peersFilter.contains(.excludeSavedMessages) || peer.id != accountPeer.id else { return false } guard !peersFilter.contains(.excludeSavedMessages) || peersFilter.contains(.includeSelf) || peer.id != accountPeer.id else { return false }
guard !peersFilter.contains(.excludeSecretChats) || peer.id.namespace != Namespaces.Peer.SecretChat else { return false } guard !peersFilter.contains(.excludeSecretChats) || peer.id.namespace != Namespaces.Peer.SecretChat else { return false }
guard !peersFilter.contains(.onlyPrivateChats) || peer.id.namespace == Namespaces.Peer.CloudUser else { return false } guard !peersFilter.contains(.onlyPrivateChats) || peer.id.namespace == Namespaces.Peer.CloudUser else { return false }
@ -2821,7 +2821,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
var totalNumberOfLocalPeers = 0 var totalNumberOfLocalPeers = 0
for renderedPeer in foundLocalPeers.peers { for renderedPeer in foundLocalPeers.peers {
if let peer = renderedPeer.peers[renderedPeer.peerId], peer.id != context.account.peerId, filteredPeer(peer, EnginePeer(accountPeer)) { if let peer = renderedPeer.peers[renderedPeer.peerId], peer.id != context.account.peerId || peersFilter.contains(.includeSelf), filteredPeer(peer, EnginePeer(accountPeer)) {
if !existingPeerIds.contains(peer.id) { if !existingPeerIds.contains(peer.id) {
existingPeerIds.insert(peer.id) existingPeerIds.insert(peer.id)
totalNumberOfLocalPeers += 1 totalNumberOfLocalPeers += 1
@ -2856,11 +2856,22 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
if lowercasedQuery.count > 1 && (presentationData.strings.DialogList_SavedMessages.lowercased().hasPrefix(lowercasedQuery) || "saved messages".hasPrefix(lowercasedQuery)) { if lowercasedQuery.count > 1 && (presentationData.strings.DialogList_SavedMessages.lowercased().hasPrefix(lowercasedQuery) || "saved messages".hasPrefix(lowercasedQuery)) {
if !existingPeerIds.contains(accountPeer.id), filteredPeer(EnginePeer(accountPeer), EnginePeer(accountPeer)) { if !existingPeerIds.contains(accountPeer.id), filteredPeer(EnginePeer(accountPeer), EnginePeer(accountPeer)) {
existingPeerIds.insert(accountPeer.id) existingPeerIds.insert(accountPeer.id)
entries.append(.localPeer(EnginePeer(accountPeer), nil, nil, index, presentationData.theme, presentationData.strings, presentationData.nameSortOrder, presentationData.nameDisplayOrder, localExpandType, nil, false)) entries.append(.localPeer(EnginePeer(accountPeer), nil, nil, index, presentationData.theme, presentationData.strings, presentationData.nameSortOrder, presentationData.nameDisplayOrder, localExpandType, nil, false, false))
index += 1 index += 1
} }
} }
if peersFilter.contains(.includeSelf) {
for renderedPeer in foundLocalPeers.peers {
if renderedPeer.peerId == context.account.peerId, let peer = renderedPeer.peers[renderedPeer.peerId], filteredPeer(peer, EnginePeer(accountPeer)) {
if !existingPeerIds.contains(peer.id) {
entries.append(.localPeer(peer, nil, nil, index, presentationData.theme, presentationData.strings, presentationData.nameSortOrder, presentationData.nameDisplayOrder, localExpandType, nil, false, true))
}
break
}
}
}
for renderedPeer in foundLocalPeers.peers { for renderedPeer in foundLocalPeers.peers {
if !foundLocalPeers.recentlySearchedPeerIds.contains(renderedPeer.peerId) { if !foundLocalPeers.recentlySearchedPeerIds.contains(renderedPeer.peerId) {
continue continue
@ -2899,7 +2910,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
if matches { if matches {
existingPeerIds.insert(peer.id) existingPeerIds.insert(peer.id)
entries.append(.localPeer(peer, nil, nil, index, presentationData.theme, presentationData.strings, presentationData.nameSortOrder, presentationData.nameDisplayOrder, localExpandType, nil, false)) entries.append(.localPeer(peer, nil, nil, index, presentationData.theme, presentationData.strings, presentationData.nameSortOrder, presentationData.nameDisplayOrder, localExpandType, nil, false, false))
} }
} }
} }
@ -2922,7 +2933,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
associatedPeer = renderedPeer.peers[associatedPeerId] associatedPeer = renderedPeer.peers[associatedPeerId]
} }
entries.append(.localPeer(peer, associatedPeer, foundLocalPeers.unread[peer.id], index, presentationData.theme, presentationData.strings, presentationData.nameSortOrder, presentationData.nameDisplayOrder, localExpandType, nil, false)) entries.append(.localPeer(peer, associatedPeer, foundLocalPeers.unread[peer.id], index, presentationData.theme, presentationData.strings, presentationData.nameSortOrder, presentationData.nameDisplayOrder, localExpandType, nil, false, false))
index += 1 index += 1
numberOfLocalPeers += 1 numberOfLocalPeers += 1
} }
@ -2936,7 +2947,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
if !existingPeerIds.contains(peer.peer.id), filteredPeer(EnginePeer(peer.peer), EnginePeer(accountPeer)) { if !existingPeerIds.contains(peer.peer.id), filteredPeer(EnginePeer(peer.peer), EnginePeer(accountPeer)) {
existingPeerIds.insert(peer.peer.id) existingPeerIds.insert(peer.peer.id)
entries.append(.localPeer(EnginePeer(peer.peer), nil, nil, index, presentationData.theme, presentationData.strings, presentationData.nameSortOrder, presentationData.nameDisplayOrder, localExpandType, nil, false)) entries.append(.localPeer(EnginePeer(peer.peer), nil, nil, index, presentationData.theme, presentationData.strings, presentationData.nameSortOrder, presentationData.nameDisplayOrder, localExpandType, nil, false, false))
index += 1 index += 1
numberOfLocalPeers += 1 numberOfLocalPeers += 1
} }
@ -3362,7 +3373,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
if case let .user(user) = peer, user.flags.contains(.requirePremium) { if case let .user(user) = peer, user.flags.contains(.requirePremium) {
requiresPremiumForMessagingPeerIds.append(peer.id) requiresPremiumForMessagingPeerIds.append(peer.id)
} }
case let .localPeer(peer, _, _, _, _, _, _, _, _, _, _): case let .localPeer(peer, _, _, _, _, _, _, _, _, _, _, _):
storyStatsIds.append(peer.id) storyStatsIds.append(peer.id)
if case let .user(user) = peer, user.flags.contains(.requirePremium) { if case let .user(user) = peer, user.flags.contains(.requirePremium) {
requiresPremiumForMessagingPeerIds.append(peer.id) requiresPremiumForMessagingPeerIds.append(peer.id)
@ -3406,8 +3417,8 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
switch mappedItems[i] { switch mappedItems[i] {
case let .recentlySearchedPeer(peer, associatedPeer, unreadBadge, index, theme, strings, sortOrder, displayOrder, _, _): case let .recentlySearchedPeer(peer, associatedPeer, unreadBadge, index, theme, strings, sortOrder, displayOrder, _, _):
mappedItems[i] = .recentlySearchedPeer(peer, associatedPeer, unreadBadge, index, theme, strings, sortOrder, displayOrder, stats[peer.id] ?? nil, requiresPremiumForMessaging[peer.id] ?? false) mappedItems[i] = .recentlySearchedPeer(peer, associatedPeer, unreadBadge, index, theme, strings, sortOrder, displayOrder, stats[peer.id] ?? nil, requiresPremiumForMessaging[peer.id] ?? false)
case let .localPeer(peer, associatedPeer, unreadBadge, index, theme, strings, sortOrder, displayOrder, expandType, _, _): case let .localPeer(peer, associatedPeer, unreadBadge, index, theme, strings, sortOrder, displayOrder, expandType, _, _, isSelf):
mappedItems[i] = .localPeer(peer, associatedPeer, unreadBadge, index, theme, strings, sortOrder, displayOrder, expandType, stats[peer.id] ?? nil, requiresPremiumForMessaging[peer.id] ?? false) mappedItems[i] = .localPeer(peer, associatedPeer, unreadBadge, index, theme, strings, sortOrder, displayOrder, expandType, stats[peer.id] ?? nil, requiresPremiumForMessaging[peer.id] ?? false, isSelf)
case let .globalPeer(peer, unreadBadge, index, theme, strings, sortOrder, displayOrder, expandType, _, _, searchQuery): case let .globalPeer(peer, unreadBadge, index, theme, strings, sortOrder, displayOrder, expandType, _, _, searchQuery):
mappedItems[i] = .globalPeer(peer, unreadBadge, index, theme, strings, sortOrder, displayOrder, expandType, stats[peer.peer.id] ?? nil, requiresPremiumForMessaging[peer.peer.id] ?? false, searchQuery) mappedItems[i] = .globalPeer(peer, unreadBadge, index, theme, strings, sortOrder, displayOrder, expandType, stats[peer.peer.id] ?? nil, requiresPremiumForMessaging[peer.peer.id] ?? false, searchQuery)
case let .message(message, peer, combinedPeerReadState, threadInfo, presentationData, totalCount, selected, displayCustomHeader, key, resourceId, section, allPaused, _, _, searchScope): case let .message(message, peer, combinedPeerReadState, threadInfo, presentationData, totalCount, selected, displayCustomHeader, key, resourceId, section, allPaused, _, _, searchScope):
@ -3441,7 +3452,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
if let entries = entriesAndFlags { if let entries = entriesAndFlags {
var filteredEntries: [ChatListSearchEntry] = [] var filteredEntries: [ChatListSearchEntry] = []
for entry in entries { for entry in entries {
if case let .localPeer(peer, _, _, _, _, _, _, _, _, _, _) = entry { if case let .localPeer(peer, _, _, _, _, _, _, _, _, _, _, _) = entry {
peers.append(peer) peers.append(peer)
} else if case .globalPeer = entry { } else if case .globalPeer = entry {
} else { } else {

View File

@ -3105,7 +3105,8 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
if peer.isVerified { if peer.isVerified {
currentCredibilityIconContent = .verified(fillColor: item.presentationData.theme.list.itemCheckColors.fillColor, foregroundColor: item.presentationData.theme.list.itemCheckColors.foregroundColor, sizeType: .compact) currentCredibilityIconContent = .verified(fillColor: item.presentationData.theme.list.itemCheckColors.fillColor, foregroundColor: item.presentationData.theme.list.itemCheckColors.foregroundColor, sizeType: .compact)
} else if let verificationIconFileId = peer.verificationIconFileId { }
if let verificationIconFileId = peer.verificationIconFileId {
currentVerifiedIconContent = .animation(content: .customEmoji(fileId: verificationIconFileId), size: CGSize(width: 32.0, height: 32.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(0)) currentVerifiedIconContent = .animation(content: .customEmoji(fileId: verificationIconFileId), size: CGSize(width: 32.0, height: 32.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(0))
} }
} }
@ -3132,7 +3133,8 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
if peer.isVerified { if peer.isVerified {
currentCredibilityIconContent = .verified(fillColor: item.presentationData.theme.list.itemCheckColors.fillColor, foregroundColor: item.presentationData.theme.list.itemCheckColors.foregroundColor, sizeType: .compact) currentCredibilityIconContent = .verified(fillColor: item.presentationData.theme.list.itemCheckColors.fillColor, foregroundColor: item.presentationData.theme.list.itemCheckColors.foregroundColor, sizeType: .compact)
} else if let verificationIconFileId = peer.verificationIconFileId { }
if let verificationIconFileId = peer.verificationIconFileId {
currentVerifiedIconContent = .animation(content: .customEmoji(fileId: verificationIconFileId), size: CGSize(width: 32.0, height: 32.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(0)) currentVerifiedIconContent = .animation(content: .customEmoji(fileId: verificationIconFileId), size: CGSize(width: 32.0, height: 32.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(0))
} }
} }

View File

@ -73,6 +73,11 @@ public enum ContactsPeerItemPeerMode: Equatable {
case app(isPopular: Bool) case app(isPopular: Bool)
} }
public enum ContactsPeerItemAliasHandling {
case standard
case treatSelfAsSaved
}
public enum ContactsPeerItemBadgeType { public enum ContactsPeerItemBadgeType {
case active case active
case inactive case inactive
@ -176,6 +181,7 @@ public class ContactsPeerItem: ItemListItem, ListViewItemWithHeader {
let displayOrder: PresentationPersonNameOrder let displayOrder: PresentationPersonNameOrder
let context: AccountContext let context: AccountContext
let peerMode: ContactsPeerItemPeerMode let peerMode: ContactsPeerItemPeerMode
let aliasHandling: ContactsPeerItemAliasHandling
public let peer: ContactsPeerItemPeer public let peer: ContactsPeerItemPeer
let status: ContactsPeerItemStatus let status: ContactsPeerItemStatus
let badge: ContactsPeerItemBadge? let badge: ContactsPeerItemBadge?
@ -217,6 +223,7 @@ public class ContactsPeerItem: ItemListItem, ListViewItemWithHeader {
displayOrder: PresentationPersonNameOrder, displayOrder: PresentationPersonNameOrder,
context: AccountContext, context: AccountContext,
peerMode: ContactsPeerItemPeerMode, peerMode: ContactsPeerItemPeerMode,
aliasHandling: ContactsPeerItemAliasHandling = .treatSelfAsSaved,
peer: ContactsPeerItemPeer, peer: ContactsPeerItemPeer,
status: ContactsPeerItemStatus, status: ContactsPeerItemStatus,
badge: ContactsPeerItemBadge? = nil, badge: ContactsPeerItemBadge? = nil,
@ -252,6 +259,7 @@ public class ContactsPeerItem: ItemListItem, ListViewItemWithHeader {
self.displayOrder = displayOrder self.displayOrder = displayOrder
self.context = context self.context = context
self.peerMode = peerMode self.peerMode = peerMode
self.aliasHandling = aliasHandling
self.peer = peer self.peer = peer
self.status = status self.status = status
self.badge = badge self.badge = badge
@ -786,7 +794,7 @@ public class ContactsPeerItemNode: ItemListRevealOptionsItemNode {
var verifiedIcon: EmojiStatusComponent.Content? var verifiedIcon: EmojiStatusComponent.Content?
switch item.peer { switch item.peer {
case let .peer(peer, _): case let .peer(peer, _):
if let peer = peer, (peer.id != item.context.account.peerId || item.peerMode == .memberList) { if let peer = peer, (peer.id != item.context.account.peerId || item.peerMode == .memberList || item.aliasHandling == .treatSelfAsSaved) {
if peer.isScam { if peer.isScam {
credibilityIcon = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_ScamAccount.uppercased()) credibilityIcon = .text(color: item.presentationData.theme.chat.message.incoming.scamColor, string: item.presentationData.strings.Message_ScamAccount.uppercased())
} else if peer.isFake { } else if peer.isFake {
@ -798,8 +806,9 @@ public class ContactsPeerItemNode: ItemListRevealOptionsItemNode {
} }
if peer.isVerified { if peer.isVerified {
verifiedIcon = .verified(fillColor: item.presentationData.theme.list.itemCheckColors.fillColor, foregroundColor: item.presentationData.theme.list.itemCheckColors.foregroundColor, sizeType: .compact) credibilityIcon = .verified(fillColor: item.presentationData.theme.list.itemCheckColors.fillColor, foregroundColor: item.presentationData.theme.list.itemCheckColors.foregroundColor, sizeType: .compact)
} else if let verificationIconFileId = peer.verificationIconFileId { }
if let verificationIconFileId = peer.verificationIconFileId {
verifiedIcon = .animation(content: .customEmoji(fileId: verificationIconFileId), size: CGSize(width: 32.0, height: 32.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(0)) verifiedIcon = .animation(content: .customEmoji(fileId: verificationIconFileId), size: CGSize(width: 32.0, height: 32.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(0))
} }
} }
@ -865,7 +874,7 @@ public class ContactsPeerItemNode: ItemListRevealOptionsItemNode {
textColor = item.presentationData.theme.list.itemPrimaryTextColor textColor = item.presentationData.theme.list.itemPrimaryTextColor
} }
if case let .user(user) = peer { if case let .user(user) = peer {
if peer.id == item.context.account.peerId, case let .generalSearch(isSavedMessages) = item.peerMode { if peer.id == item.context.account.peerId, case let .generalSearch(isSavedMessages) = item.peerMode, case .treatSelfAsSaved = item.aliasHandling {
if isSavedMessages { if isSavedMessages {
titleAttributedString = NSAttributedString(string: item.presentationData.strings.DialogList_MyNotes, font: titleBoldFont, textColor: textColor) titleAttributedString = NSAttributedString(string: item.presentationData.strings.DialogList_MyNotes, font: titleBoldFont, textColor: textColor)
} else { } else {
@ -1171,7 +1180,7 @@ public class ContactsPeerItemNode: ItemListRevealOptionsItemNode {
case let .peer(peer, _): case let .peer(peer, _):
if let peer = peer { if let peer = peer {
var overrideImage: AvatarNodeImageOverride? var overrideImage: AvatarNodeImageOverride?
if peer.id == item.context.account.peerId, case let .generalSearch(isSavedMessages) = item.peerMode { if peer.id == item.context.account.peerId, case let .generalSearch(isSavedMessages) = item.peerMode, case .treatSelfAsSaved = item.aliasHandling {
if isSavedMessages { if isSavedMessages {
overrideImage = .myNotesIcon overrideImage = .myNotesIcon
} else { } else {
@ -1433,6 +1442,7 @@ public class ContactsPeerItemNode: ItemListRevealOptionsItemNode {
if case .animation = verifiedIcon { if case .animation = verifiedIcon {
titleLeftOffset += iconSize.width + 4.0 titleLeftOffset += iconSize.width + 4.0
nextIconX += iconSize.width
} else { } else {
nextIconX += iconSize.width nextIconX += iconSize.width
} }

View File

@ -937,8 +937,9 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo
} }
if item.peer.isVerified { if item.peer.isVerified {
verifiedIcon = .verified(fillColor: item.presentationData.theme.list.itemCheckColors.fillColor, foregroundColor: item.presentationData.theme.list.itemCheckColors.foregroundColor, sizeType: .compact) credibilityIcon = .verified(fillColor: item.presentationData.theme.list.itemCheckColors.fillColor, foregroundColor: item.presentationData.theme.list.itemCheckColors.foregroundColor, sizeType: .compact)
} else if let verificationIconFileId = item.peer.verificationIconFileId { }
if let verificationIconFileId = item.peer.verificationIconFileId {
verifiedIcon = .animation(content: .customEmoji(fileId: verificationIconFileId), size: CGSize(width: 32.0, height: 32.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(0)) verifiedIcon = .animation(content: .customEmoji(fileId: verificationIconFileId), size: CGSize(width: 32.0, height: 32.0), placeholderColor: item.presentationData.theme.list.mediaPlaceholderColor, themeColor: item.presentationData.theme.list.itemAccentColor, loopMode: .count(0))
} }
} }

View File

@ -1115,6 +1115,7 @@ private final class GiftViewSheetContent: CombinedComponent {
text: .plain(value), text: .plain(value),
horizontalAlignment: .center, horizontalAlignment: .center,
maximumNumberOfLines: 0, maximumNumberOfLines: 0,
insets: id == "originalInfo" ? UIEdgeInsets(top: 2.0, left: 0.0, bottom: 2.0, right: 0.0) : .zero,
handleSpoilers: true handleSpoilers: true
) )
) )
@ -1306,6 +1307,7 @@ private final class GiftViewSheetContent: CombinedComponent {
placeholderColor: theme.list.mediaPlaceholderColor, placeholderColor: theme.list.mediaPlaceholderColor,
text: .plain(attributedText), text: .plain(attributedText),
maximumNumberOfLines: 0, maximumNumberOfLines: 0,
insets: UIEdgeInsets(top: 1.0, left: 0.0, bottom: 1.0, right: 0.0),
handleSpoilers: true handleSpoilers: true
) )
) )

View File

@ -521,7 +521,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
self.presentationData = presentationData self.presentationData = presentationData
let premiumConfiguration = PremiumConfiguration.with(appConfiguration: self.context.currentAppConfiguration.with { $0 }) let premiumConfiguration = PremiumConfiguration.with(appConfiguration: self.context.currentAppConfiguration.with { $0 })
let credibilityIcon: CredibilityIcon var credibilityIcon: CredibilityIcon
var verifiedIcon: CredibilityIcon = .none var verifiedIcon: CredibilityIcon = .none
if let peer = peer { if let peer = peer {
if peer.id == self.context.account.peerId && !self.isSettings && !self.isMyProfile { if peer.id == self.context.account.peerId && !self.isSettings && !self.isMyProfile {
@ -538,8 +538,9 @@ final class PeerInfoHeaderNode: ASDisplayNode {
credibilityIcon = .none credibilityIcon = .none
} }
if peer.isVerified { if peer.isVerified {
verifiedIcon = .verified credibilityIcon = .verified
} else if let verificationIconFileId = peer.verificationIconFileId { }
if let verificationIconFileId = peer.verificationIconFileId {
verifiedIcon = .emojiStatus(PeerEmojiStatus(fileId: verificationIconFileId, expirationDate: nil)) verifiedIcon = .emojiStatus(PeerEmojiStatus(fileId: verificationIconFileId, expirationDate: nil))
} }
} else { } else {

View File

@ -8818,9 +8818,9 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
let controller = self.context.sharedContext.makePeerSelectionController( let controller = self.context.sharedContext.makePeerSelectionController(
PeerSelectionControllerParams( PeerSelectionControllerParams(
context: self.context, context: self.context,
filter: [.excludeSecretChats, .excludeRecent, .excludeSavedMessages], filter: [.excludeSecretChats, .excludeRecent, .excludeSavedMessages, .includeSelf, .doNotSearchMessages],
hasContactSelector: false, hasContactSelector: false,
title: "Choose Chat to Verify" title: self.presentationData.strings.BotVerification_ChooseChat
) )
) )
controller.peerSelected = { [weak self, weak controller] peer, _ in controller.peerSelected = { [weak self, weak controller] peer, _ in
@ -8849,7 +8849,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
} }
let undoController = UndoOverlayController( let undoController = UndoOverlayController(
presentationData: self.presentationData, presentationData: self.presentationData,
content: .invitedToVoiceChat(context: self.context, peer: peer, title: nil, text: "You have removed **\(peer.compactDisplayTitle)'s** verification.", action: nil, duration: 5.0), content: .invitedToVoiceChat(context: self.context, peer: peer, title: nil, text: self.presentationData.strings.BotVerification_Removed(peer.compactDisplayTitle).string, action: nil, duration: 5.0),
elevatedLayout: false, elevatedLayout: false,
action: { _ in return true } action: { _ in return true }
) )
@ -8878,7 +8878,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
} }
let undoController = UndoOverlayController( let undoController = UndoOverlayController(
presentationData: self.presentationData, presentationData: self.presentationData,
content: .invitedToVoiceChat(context: self.context, peer: peer, title: nil, text: "**\(peer.compactDisplayTitle)** has been notified and will receive your verification mark and description upon accepting.", action: nil, duration: 5.0), content: .invitedToVoiceChat(context: self.context, peer: peer, title: nil, text: self.presentationData.strings.BotVerification_Added(peer.compactDisplayTitle).string, action: nil, duration: 5.0),
elevatedLayout: false, elevatedLayout: false,
action: { _ in return true } action: { _ in return true }
) )

File diff suppressed because one or more lines are too long

View File

@ -554,7 +554,7 @@ func moveReplyMessageToAnotherChat(selfController: ChatControllerImpl, replySubj
guard let selfController else { guard let selfController else {
return return
} }
let filter: ChatListNodePeersFilter = [.onlyWriteable, .includeSavedMessages, .excludeDisabled, .doNotSearchMessages] let filter: ChatListNodePeersFilter = [.onlyWriteable, .excludeDisabled, .doNotSearchMessages]
var attemptSelectionImpl: ((EnginePeer, ChatListDisabledPeerReason) -> Void)? var attemptSelectionImpl: ((EnginePeer, ChatListDisabledPeerReason) -> Void)?
let controller = selfController.context.sharedContext.makePeerSelectionController(PeerSelectionControllerParams( let controller = selfController.context.sharedContext.makePeerSelectionController(PeerSelectionControllerParams(
context: selfController.context, context: selfController.context,

View File

@ -29,7 +29,7 @@ extension ChatControllerImpl {
func forwardMessages(messages: [Message], options: ChatInterfaceForwardOptionsState? = nil, resetCurrent: Bool) { func forwardMessages(messages: [Message], options: ChatInterfaceForwardOptionsState? = nil, resetCurrent: Bool) {
let _ = self.presentVoiceMessageDiscardAlert(action: { let _ = self.presentVoiceMessageDiscardAlert(action: {
var filter: ChatListNodePeersFilter = [.onlyWriteable, .includeSavedMessages, .excludeDisabled, .doNotSearchMessages] var filter: ChatListNodePeersFilter = [.onlyWriteable, .excludeDisabled, .doNotSearchMessages]
var hasPublicPolls = false var hasPublicPolls = false
var hasPublicQuiz = false var hasPublicQuiz = false
for message in messages { for message in messages {