Tag improvements

This commit is contained in:
Isaac 2024-01-26 21:09:01 +01:00
parent 53ba8afced
commit e579de45cd
4 changed files with 35 additions and 18 deletions

View File

@ -489,7 +489,9 @@ final class PeerInfoHeaderNode: ASDisplayNode {
let credibilityIcon: CredibilityIcon let credibilityIcon: CredibilityIcon
var verifiedIcon: CredibilityIcon = .none var verifiedIcon: CredibilityIcon = .none
if let peer = peer { if let peer = peer {
if peer.isFake { if peer.id == self.context.account.peerId && !self.isSettings {
credibilityIcon = .none
} else if peer.isFake {
credibilityIcon = .fake credibilityIcon = .fake
} else if peer.isScam { } else if peer.isScam {
credibilityIcon = .scam credibilityIcon = .scam
@ -969,7 +971,11 @@ final class PeerInfoHeaderNode: ASDisplayNode {
if let peer = peer { if let peer = peer {
var title: String var title: String
if peer.id == self.context.account.peerId && !self.isSettings { if peer.id == self.context.account.peerId && !self.isSettings {
title = presentationData.strings.Conversation_SavedMessages if case .replyThread = self.chatLocation {
title = presentationData.strings.Conversation_MyNotes
} else {
title = presentationData.strings.Conversation_SavedMessages
}
} else if peer.id.isAnonymousSavedMessages { } else if peer.id.isAnonymousSavedMessages {
title = presentationData.strings.ChatList_AuthorHidden title = presentationData.strings.ChatList_AuthorHidden
} else if let threadData = threadData { } else if let threadData = threadData {

View File

@ -1266,6 +1266,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
} }
if !force && message.areReactionsTags(accountPeerId: strongSelf.context.account.peerId) { if !force && message.areReactionsTags(accountPeerId: strongSelf.context.account.peerId) {
if case .pinnedMessages = strongSelf.subject {
return
}
if !strongSelf.presentationInterfaceState.isPremium { if !strongSelf.presentationInterfaceState.isPremium {
//TODO:localize //TODO:localize
let context = strongSelf.context let context = strongSelf.context
@ -2807,7 +2811,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
return .none return .none
} }
if case let .replyThread(replyThreadMessage) = strongSelf.chatLocation, replyThreadMessage.peerId == strongSelf.context.account.peerId { if case let .replyThread(replyThreadMessage) = strongSelf.chatLocation, replyThreadMessage.peerId == strongSelf.context.account.peerId {
return .none if replyThreadMessage.threadId != strongSelf.context.account.peerId.toInt64() {
return .none
}
} }
if case .peer = strongSelf.chatLocation, let channel = strongSelf.presentationInterfaceState.renderedPeer?.peer as? TelegramChannel, channel.flags.contains(.isForum) { if case .peer = strongSelf.chatLocation, let channel = strongSelf.presentationInterfaceState.renderedPeer?.peer as? TelegramChannel, channel.flags.contains(.isForum) {
if message.threadId == nil { if message.threadId == nil {

View File

@ -118,21 +118,24 @@ extension ChatControllerImpl {
}) })
}))) })))
if self.presentationInterfaceState.historyFilter?.customTags != tags { if case .pinnedMessages = self.subject {
items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.Chat_ReactionContextMenu_FilterByTag, icon: { theme in } else {
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/TagFilter"), color: theme.contextMenu.primaryColor) if self.presentationInterfaceState.historyFilter?.customTags != tags {
}, action: { [weak self] _, a in items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.Chat_ReactionContextMenu_FilterByTag, icon: { theme in
guard let self else { return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/TagFilter"), color: theme.contextMenu.primaryColor)
a(.default) }, action: { [weak self] _, a in
return guard let self else {
} a(.default)
self.chatDisplayNode.historyNode.frozenMessageForScrollingReset = message.id return
self.interfaceInteraction?.updateHistoryFilter { _ in }
return ChatPresentationInterfaceState.HistoryFilter(customTags: tags, isActive: true) self.chatDisplayNode.historyNode.frozenMessageForScrollingReset = message.id
} self.interfaceInteraction?.updateHistoryFilter { _ in
return ChatPresentationInterfaceState.HistoryFilter(customTags: tags, isActive: true)
}
a(.default) a(.default)
}))) })))
}
} }
items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.Chat_ReactionContextMenu_RemoveTag, textColor: .destructive, icon: { theme in items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.Chat_ReactionContextMenu_RemoveTag, textColor: .destructive, icon: { theme in

View File

@ -287,7 +287,9 @@ func canReplyInChat(_ chatPresentationInterfaceState: ChatPresentationInterfaceS
break break
} }
if case let .replyThread(replyThreadMessage) = chatPresentationInterfaceState.chatLocation, replyThreadMessage.peerId == accountPeerId { if case let .replyThread(replyThreadMessage) = chatPresentationInterfaceState.chatLocation, replyThreadMessage.peerId == accountPeerId {
return false if replyThreadMessage.threadId != accountPeerId.toInt64() {
return false
}
} }
if let channel = peer as? TelegramChannel, channel.flags.contains(.isForum) { if let channel = peer as? TelegramChannel, channel.flags.contains(.isForum) {