ChatListItem: fix legacy group title

This commit is contained in:
Peter 2019-06-26 22:02:18 +03:00
parent 0541f464a8
commit 9808bcde25
3 changed files with 27 additions and 8 deletions

View File

@ -7,8 +7,8 @@
ldflags = -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -dead_strip -Xlinker -no_deduplicate $(config custom.other_cxxflags)
[swift]
version = 4.0
compiler_flags = -DBUCK -enable-testing -Onone -whole-module-optimization -suppress-warnings -Xcc -fno-optimize-sibling-calls $(config custom.other_swift_compiler_flags)
version = 5
compiler_flags = -DBUCK -enable-testing -O -whole-module-optimization -suppress-warnings -Xcc -fno-optimize-sibling-calls $(config custom.other_swift_compiler_flags)
use_filelist = true
[apple]

View File

@ -0,0 +1,20 @@
load('//tools:buck_utils.bzl', 'config_with_updated_linker_flags', 'configs_with_config', 'combined_config')
load('//tools:buck_defs.bzl', 'SHARED_CONFIGS', 'EXTENSION_LIB_SPECIFIC_CONFIG')
apple_library(
name = 'TelegramApi',
srcs = glob([
'Sources/*.swift',
]),
configs = configs_with_config(combined_config([SHARED_CONFIGS, EXTENSION_LIB_SPECIFIC_CONFIG])),
swift_compiler_flags = [
'-suppress-warnings',
'-application-extension',
],
visibility = ['PUBLIC'],
deps = [
],
frameworks = [
'$SDKROOT/System/Library/Frameworks/Foundation.framework',
],
)

View File

@ -732,7 +732,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
var contentImageMedia: Media?
switch contentData {
case let .chat(itemPeer, peer, _, messageText):
case let .chat(itemPeer, _, _, messageText):
let messageText = messageText.replacingOccurrences(of: "\n\n", with: " ")
if inlineAuthorPrefix == nil, let embeddedState = embeddedState as? ChatEmbeddedInterfaceState {
@ -755,7 +755,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
if let messagePeer = itemPeer.chatMainPeer {
peerText = messagePeer.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
}
} else if let author = message.author as? TelegramUser, let peer = peer, !(peer is TelegramUser) {
} else if let author = message.author as? TelegramUser, let peer = itemPeer.chatMainPeer, !(peer is TelegramUser) {
if let peer = peer as? TelegramChannel, case .broadcast = peer.info {
} else {
peerText = author.id == account.peerId ? item.presentationData.strings.DialogList_You : author.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
@ -827,12 +827,12 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
}
switch contentData {
case let .chat(_, peer, _, _):
case let .chat(itemPeer, _, _, _):
if isPeerGroup {
titleAttributedString = NSAttributedString(string: item.presentationData.strings.ChatList_ArchivedChatsTitle, font: titleFont, textColor: theme.titleColor)
} else if peer?.id == item.context.account.peerId {
} else if itemPeer.chatMainPeer?.id == item.context.account.peerId {
titleAttributedString = NSAttributedString(string: item.presentationData.strings.DialogList_SavedMessages, font: titleFont, textColor: theme.titleColor)
} else if let displayTitle = peer?.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder) {
} else if let displayTitle = itemPeer.chatMainPeer?.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder) {
titleAttributedString = NSAttributedString(string: displayTitle, font: titleFont, textColor: item.index.messageIndex.id.peerId.namespace == Namespaces.Peer.SecretChat ? theme.secretTitleColor : theme.titleColor)
}
case .group:
@ -940,7 +940,6 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
}
titleIconsWidth += currentMutedIconImage.size.width
}
let isSecret = !isPeerGroup && item.index.messageIndex.id.peerId.namespace == Namespaces.Peer.SecretChat
if isSecret {