mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-07 09:20:08 +00:00
Update counters
This commit is contained in:
parent
2b37325505
commit
6dc31ae148
@ -386,6 +386,7 @@ private final class ChatFolderLinkPreviewScreenComponent: Component {
|
|||||||
|
|
||||||
let titleString: String
|
let titleString: String
|
||||||
var allChatsAdded = false
|
var allChatsAdded = false
|
||||||
|
var canAddChatCount = 0
|
||||||
if case .linkList = component.subject {
|
if case .linkList = component.subject {
|
||||||
//TODO:localize
|
//TODO:localize
|
||||||
titleString = "Share Folder"
|
titleString = "Share Folder"
|
||||||
@ -397,13 +398,14 @@ private final class ChatFolderLinkPreviewScreenComponent: Component {
|
|||||||
if linkContents.alreadyMemberPeerIds == Set(linkContents.peers.map(\.id)) {
|
if linkContents.alreadyMemberPeerIds == Set(linkContents.peers.map(\.id)) {
|
||||||
allChatsAdded = true
|
allChatsAdded = true
|
||||||
}
|
}
|
||||||
|
canAddChatCount = linkContents.peers.map(\.id).count - linkContents.alreadyMemberPeerIds.count
|
||||||
|
|
||||||
if allChatsAdded {
|
if allChatsAdded {
|
||||||
titleString = "Add Folder"
|
titleString = "Add Folder"
|
||||||
} else if linkContents.peers.count == 1 {
|
} else if canAddChatCount == 1 {
|
||||||
titleString = "Add \(linkContents.peers.count) chat"
|
titleString = "Add \(canAddChatCount) chat"
|
||||||
} else {
|
} else {
|
||||||
titleString = "Add \(linkContents.peers.count) chats"
|
titleString = "Add \(canAddChatCount) chats"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
titleString = "Add Folder"
|
titleString = "Add Folder"
|
||||||
@ -433,8 +435,8 @@ private final class ChatFolderLinkPreviewScreenComponent: Component {
|
|||||||
var topBadge: String?
|
var topBadge: String?
|
||||||
if case .linkList = component.subject {
|
if case .linkList = component.subject {
|
||||||
} else if case .remove = component.subject {
|
} else if case .remove = component.subject {
|
||||||
} else if !allChatsAdded, let linkContents = component.linkContents, linkContents.localFilterId != nil {
|
} else if !allChatsAdded, let linkContents = component.linkContents, linkContents.localFilterId != nil, canAddChatCount != 0 {
|
||||||
topBadge = "+\(linkContents.peers.count)"
|
topBadge = "+\(canAddChatCount)"
|
||||||
}
|
}
|
||||||
|
|
||||||
let topIconSize = self.topIcon.update(
|
let topIconSize = self.topIcon.update(
|
||||||
@ -472,10 +474,10 @@ private final class ChatFolderLinkPreviewScreenComponent: Component {
|
|||||||
text = "Do you want to add a new chat folder\nand join its groups and channels?"
|
text = "Do you want to add a new chat folder\nand join its groups and channels?"
|
||||||
} else {
|
} else {
|
||||||
let chatCountString: String
|
let chatCountString: String
|
||||||
if linkContents.peers.count == 1 {
|
if canAddChatCount == 1 {
|
||||||
chatCountString = "1 chat"
|
chatCountString = "1 chat"
|
||||||
} else {
|
} else {
|
||||||
chatCountString = "\(linkContents.peers.count) chats"
|
chatCountString = "\(canAddChatCount) chats"
|
||||||
}
|
}
|
||||||
if let title = linkContents.title {
|
if let title = linkContents.title {
|
||||||
text = "Do you want to add **\(chatCountString)** to the\nfolder **\(title)**?"
|
text = "Do you want to add **\(chatCountString)** to the\nfolder **\(title)**?"
|
||||||
@ -934,7 +936,7 @@ private final class ChatFolderLinkPreviewScreenComponent: Component {
|
|||||||
actionButtonBadge = 0
|
actionButtonBadge = 0
|
||||||
actionButtonTitle = "OK"
|
actionButtonTitle = "OK"
|
||||||
} else if let linkContents = component.linkContents {
|
} else if let linkContents = component.linkContents {
|
||||||
actionButtonBadge = self.selectedItems.count
|
actionButtonBadge = max(0, self.selectedItems.count - (linkContents.peers.count - canAddChatCount))
|
||||||
if linkContents.localFilterId != nil {
|
if linkContents.localFilterId != nil {
|
||||||
if self.selectedItems.isEmpty {
|
if self.selectedItems.isEmpty {
|
||||||
actionButtonTitle = "Do Not Join Any Chats"
|
actionButtonTitle = "Do Not Join Any Chats"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user