mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Add support for multiple users selection in bots peer requests
This commit is contained in:
@@ -202,12 +202,19 @@ class ContactMultiselectionControllerImpl: ViewController, ContactMultiselection
|
||||
self.navigationItem.rightBarButtonItem = self.rightNavigationButton
|
||||
rightNavigationButton.isEnabled = true //count != 0 || self.params.alwaysEnabled
|
||||
case .premiumGifting:
|
||||
let maxCount: Int32 = 10
|
||||
let maxCount: Int32 = self.limit ?? 10
|
||||
var count = 0
|
||||
if case let .contacts(contactsNode) = self.contactsNode.contentNode {
|
||||
count = contactsNode.selectionState?.selectedPeerIndices.count ?? 0
|
||||
}
|
||||
self.titleView.title = CounterContollerTitle(title: self.presentationData.strings.Premium_Gift_ContactSelection_Title, counter: "\(count)/\(maxCount)")
|
||||
case .requestedUsersSelection:
|
||||
let maxCount: Int32 = self.limit ?? 10
|
||||
var count = 0
|
||||
if case let .contacts(contactsNode) = self.contactsNode.contentNode {
|
||||
count = contactsNode.selectionState?.selectedPeerIndices.count ?? 0
|
||||
}
|
||||
self.titleView.title = CounterContollerTitle(title: self.presentationData.strings.RequestPeer_SelectUsers, counter: "\(count)/\(maxCount)")
|
||||
case .channelCreation:
|
||||
self.titleView.title = CounterContollerTitle(title: self.presentationData.strings.GroupInfo_AddParticipantTitle, counter: "")
|
||||
let rightNavigationButton = UIBarButtonItem(title: self.presentationData.strings.Common_Next, style: .done, target: self, action: #selector(self.rightNavigationButtonPressed))
|
||||
@@ -325,7 +332,7 @@ class ContactMultiselectionControllerImpl: ViewController, ContactMultiselection
|
||||
switch strongSelf.mode {
|
||||
case .groupCreation, .peerSelection, .chatSelection:
|
||||
strongSelf.rightNavigationButton?.isEnabled = updatedCount != 0 || strongSelf.params.alwaysEnabled
|
||||
case .channelCreation, .premiumGifting:
|
||||
case .channelCreation, .premiumGifting, .requestedUsersSelection:
|
||||
break
|
||||
}
|
||||
|
||||
@@ -334,8 +341,11 @@ class ContactMultiselectionControllerImpl: ViewController, ContactMultiselection
|
||||
let maxCount: Int32 = strongSelf.limitsConfiguration?.maxSupergroupMemberCount ?? 5000
|
||||
strongSelf.titleView.title = CounterContollerTitle(title: strongSelf.presentationData.strings.Compose_NewGroupTitle, counter: "\(updatedCount)/\(maxCount)")
|
||||
case .premiumGifting:
|
||||
let maxCount: Int32 = 10
|
||||
let maxCount: Int32 = strongSelf.limit ?? 10
|
||||
strongSelf.titleView.title = CounterContollerTitle(title: strongSelf.presentationData.strings.Premium_Gift_ContactSelection_Title, counter: "\(updatedCount)/\(maxCount)")
|
||||
case .requestedUsersSelection:
|
||||
let maxCount: Int32 = strongSelf.limit ?? 10
|
||||
strongSelf.titleView.title = CounterContollerTitle(title: strongSelf.presentationData.strings.RequestPeer_SelectUsers, counter: "\(updatedCount)/\(maxCount)")
|
||||
case .peerSelection, .channelCreation, .chatSelection:
|
||||
break
|
||||
}
|
||||
@@ -407,7 +417,7 @@ class ContactMultiselectionControllerImpl: ViewController, ContactMultiselection
|
||||
switch strongSelf.mode {
|
||||
case .groupCreation, .peerSelection, .chatSelection:
|
||||
strongSelf.rightNavigationButton?.isEnabled = updatedCount != 0 || strongSelf.params.alwaysEnabled
|
||||
case .channelCreation, .premiumGifting:
|
||||
case .channelCreation, .premiumGifting, .requestedUsersSelection:
|
||||
break
|
||||
}
|
||||
switch strongSelf.mode {
|
||||
@@ -415,8 +425,11 @@ class ContactMultiselectionControllerImpl: ViewController, ContactMultiselection
|
||||
let maxCount: Int32 = strongSelf.limitsConfiguration?.maxSupergroupMemberCount ?? 5000
|
||||
strongSelf.titleView.title = CounterContollerTitle(title: strongSelf.presentationData.strings.Compose_NewGroupTitle, counter: "\(updatedCount)/\(maxCount)")
|
||||
case .premiumGifting:
|
||||
let maxCount: Int32 = 10
|
||||
let maxCount: Int32 = strongSelf.limit ?? 10
|
||||
strongSelf.titleView.title = CounterContollerTitle(title: strongSelf.presentationData.strings.Premium_Gift_ContactSelection_Title, counter: "\(updatedCount)/\(maxCount)")
|
||||
case .requestedUsersSelection:
|
||||
let maxCount: Int32 = strongSelf.limit ?? 10
|
||||
strongSelf.titleView.title = CounterContollerTitle(title: strongSelf.presentationData.strings.RequestPeer_SelectUsers, counter: "\(updatedCount)/\(maxCount)")
|
||||
case .peerSelection, .channelCreation, .chatSelection:
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user