ContactListNode: fix queue ordering

CreateGroupController: display errors on creation
ChatList: use muted mention badges in Archive
This commit is contained in:
Peter 2019-05-05 15:09:27 +04:00
parent 94c157bcee
commit 3e9f242acb
5 changed files with 36 additions and 2 deletions

View File

@ -767,6 +767,18 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
contentImageMedia = file
break
}
} else if let webpage = media as? TelegramMediaWebpage, case let .Loaded(content) = webpage.content {
if let image = content.image {
textLeftCutout += 26.0
contentImageMedia = image
break
} else if let file = content.file {
if file.isVideo && !file.isInstantVideo {
textLeftCutout += 26.0
contentImageMedia = file
break
}
}
}
}
}
@ -884,7 +896,11 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
let totalMentionCount = tagSummaryCount - actionsSummaryCount
if !isPeerGroup {
if totalMentionCount > 0 {
currentMentionBadgeImage = PresentationResourcesChatList.badgeBackgroundMention(item.presentationData.theme)
if Namespaces.PeerGroup.archive == item.peerGroupId {
currentMentionBadgeImage = PresentationResourcesChatList.badgeBackgroundInactiveMention(item.presentationData.theme)
} else {
currentMentionBadgeImage = PresentationResourcesChatList.badgeBackgroundMention(item.presentationData.theme)
}
mentionBadgeContent = .mention
} else if item.index.pinningIndex != nil && !isAd && currentBadgeBackgroundImage == nil {
currentPinnedIconImage = PresentationResourcesChatList.badgeBackgroundPinned(item.presentationData.theme)

View File

@ -1118,7 +1118,8 @@ final class ContactListNode: ASDisplayNode {
|> deliverOnMainQueue
}
}
self.disposable.set(transition.start(next: { [weak self] transition in
self.disposable.set((transition
|> deliverOnMainQueue).start(next: { [weak self] transition in
self?.enqueueTransition(transition)
}))

View File

@ -278,6 +278,16 @@ public func createGroupController(context: AccountContext, peerIds: [PeerId]) ->
let controller = ChatController(context: context, chatLocation: .peer(peerId))
replaceControllerImpl?(controller)
}
}, error: { error in
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
let text: String
switch error {
case .privacy:
text = presentationData.strings.Privacy_GroupsAndChannels_InviteToChannelMultipleError
case .generic:
text = presentationData.strings.Login_UnknownError
}
presentControllerImpl?(standardTextAlertController(theme: AlertControllerTheme(presentationTheme: presentationData.theme), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
}))
}
}, changeProfilePhoto: {

View File

@ -64,6 +64,7 @@ enum PresentationResourceKey: Int32 {
case chatListBadgeBackgroundActive
case chatListBadgeBackgroundInactive
case chatListBadgeBackgroundMention
case chatListBadgeBackgroundInactiveMention
case chatListBadgeBackgroundPinned
case chatListMutedIcon
case chatListVerifiedIcon

View File

@ -179,6 +179,12 @@ struct PresentationResourcesChatList {
})
}
static func badgeBackgroundInactiveMention(_ theme: PresentationTheme) -> UIImage? {
return theme.image(PresentationResourceKey.chatListBadgeBackgroundInactiveMention.rawValue, { theme in
return generateBadgeBackgroundImage(theme: theme, active: false, icon: generateTintedImage(image: UIImage(bundleImageName: "Chat List/MentionBadgeIcon"), color: theme.chatList.unreadBadgeInactiveTextColor))
})
}
static func badgeBackgroundPinned(_ theme: PresentationTheme) -> UIImage? {
return theme.image(PresentationResourceKey.chatListBadgeBackgroundPinned.rawValue, { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat List/PeerPinnedIcon"), color: theme.chatList.pinnedBadgeColor)