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
var verifiedIcon: CredibilityIcon = .none
if let peer = peer {
if peer.isFake {
if peer.id == self.context.account.peerId && !self.isSettings {
credibilityIcon = .none
} else if peer.isFake {
credibilityIcon = .fake
} else if peer.isScam {
credibilityIcon = .scam
@ -969,7 +971,11 @@ final class PeerInfoHeaderNode: ASDisplayNode {
if let peer = peer {
var title: String
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 {
title = presentationData.strings.ChatList_AuthorHidden
} 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 case .pinnedMessages = strongSelf.subject {
return
}
if !strongSelf.presentationInterfaceState.isPremium {
//TODO:localize
let context = strongSelf.context
@ -2807,7 +2811,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
return .none
}
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 message.threadId == nil {

View File

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