mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
72 lines
3.1 KiB
Swift
72 lines
3.1 KiB
Swift
import Foundation
|
|
import Display
|
|
import Postbox
|
|
import SwiftSignalKit
|
|
|
|
public struct ChatListNodePeersFilter: OptionSet {
|
|
public var rawValue: Int32
|
|
|
|
public init(rawValue: Int32) {
|
|
self.rawValue = rawValue
|
|
}
|
|
|
|
public static let onlyWriteable = ChatListNodePeersFilter(rawValue: 1 << 0)
|
|
public static let onlyPrivateChats = ChatListNodePeersFilter(rawValue: 1 << 1)
|
|
public static let onlyGroups = ChatListNodePeersFilter(rawValue: 1 << 2)
|
|
public static let onlyChannels = ChatListNodePeersFilter(rawValue: 1 << 3)
|
|
public static let onlyManageable = ChatListNodePeersFilter(rawValue: 1 << 4)
|
|
|
|
public static let excludeSecretChats = ChatListNodePeersFilter(rawValue: 1 << 5)
|
|
public static let excludeRecent = ChatListNodePeersFilter(rawValue: 1 << 6)
|
|
public static let excludeSavedMessages = ChatListNodePeersFilter(rawValue: 1 << 7)
|
|
|
|
public static let doNotSearchMessages = ChatListNodePeersFilter(rawValue: 1 << 8)
|
|
public static let removeSearchHeader = ChatListNodePeersFilter(rawValue: 1 << 9)
|
|
|
|
public static let excludeDisabled = ChatListNodePeersFilter(rawValue: 1 << 10)
|
|
public static let includeSavedMessages = ChatListNodePeersFilter(rawValue: 1 << 11)
|
|
|
|
public static let excludeChannels = ChatListNodePeersFilter(rawValue: 1 << 12)
|
|
}
|
|
|
|
public final class PeerSelectionControllerParams {
|
|
public let context: AccountContext
|
|
public let filter: ChatListNodePeersFilter
|
|
public let hasChatListSelector: Bool
|
|
public let hasContactSelector: Bool
|
|
public let hasGlobalSearch: Bool
|
|
public let title: String?
|
|
public let attemptSelection: ((Peer) -> Void)?
|
|
public let createNewGroup: (() -> Void)?
|
|
public let pretendPresentedInModal: Bool
|
|
public let multipleSelection: Bool
|
|
public let forwardedMessagesCount: Int
|
|
|
|
public init(context: AccountContext, filter: ChatListNodePeersFilter = [.onlyWriteable], hasChatListSelector: Bool = true, hasContactSelector: Bool = true, hasGlobalSearch: Bool = true, title: String? = nil, attemptSelection: ((Peer) -> Void)? = nil, createNewGroup: (() -> Void)? = nil, pretendPresentedInModal: Bool = false, multipleSelection: Bool = false, forwardedMessagesCount: Int = 0) {
|
|
self.context = context
|
|
self.filter = filter
|
|
self.hasChatListSelector = hasChatListSelector
|
|
self.hasContactSelector = hasContactSelector
|
|
self.hasGlobalSearch = hasGlobalSearch
|
|
self.title = title
|
|
self.attemptSelection = attemptSelection
|
|
self.createNewGroup = createNewGroup
|
|
self.pretendPresentedInModal = pretendPresentedInModal
|
|
self.multipleSelection = multipleSelection
|
|
self.forwardedMessagesCount = forwardedMessagesCount
|
|
}
|
|
}
|
|
|
|
public enum PeerSelectionControllerSendMode {
|
|
case generic
|
|
case silent
|
|
case schedule
|
|
}
|
|
|
|
public protocol PeerSelectionController: ViewController {
|
|
var peerSelected: ((Peer) -> Void)? { get set }
|
|
var multiplePeersSelected: (([Peer], [PeerId: Peer], NSAttributedString, PeerSelectionControllerSendMode) -> Void)? { get set }
|
|
var inProgress: Bool { get set }
|
|
var customDismiss: (() -> Void)? { get set }
|
|
}
|