mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Privacy settings
This commit is contained in:
@@ -14,6 +14,8 @@ import PresentationDataUtils
|
||||
import ContactListUI
|
||||
import CounterContollerTitleView
|
||||
import EditableTokenListNode
|
||||
import PremiumUI
|
||||
import UndoUI
|
||||
|
||||
private func peerTokenTitle(accountPeerId: PeerId, peer: Peer, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder) -> String {
|
||||
if peer.id == accountPeerId {
|
||||
@@ -30,7 +32,7 @@ class ContactMultiselectionControllerImpl: ViewController, ContactMultiselection
|
||||
private let context: AccountContext
|
||||
private let mode: ContactMultiselectionControllerMode
|
||||
private let isPeerEnabled: ((EnginePeer) -> Bool)?
|
||||
private let attemptDisabledItemSelection: ((EnginePeer) -> Void)?
|
||||
private let attemptDisabledItemSelection: ((EnginePeer, ChatListDisabledPeerReason) -> Void)?
|
||||
|
||||
private let titleView: CounterContollerTitleView
|
||||
|
||||
@@ -80,6 +82,7 @@ class ContactMultiselectionControllerImpl: ViewController, ContactMultiselection
|
||||
private var initialPeersDisposable: Disposable?
|
||||
private let options: [ContactListAdditionalOption]
|
||||
private let filters: [ContactListFilter]
|
||||
private let onlyWriteable: Bool
|
||||
private let limit: Int32?
|
||||
|
||||
init(_ params: ContactMultiselectionControllerParams) {
|
||||
@@ -90,6 +93,7 @@ class ContactMultiselectionControllerImpl: ViewController, ContactMultiselection
|
||||
self.attemptDisabledItemSelection = params.attemptDisabledItemSelection
|
||||
self.options = params.options
|
||||
self.filters = params.filters
|
||||
self.onlyWriteable = params.onlyWriteable
|
||||
self.limit = params.limit
|
||||
self.presentationData = params.updatedPresentationData?.initial ?? params.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
@@ -239,7 +243,7 @@ class ContactMultiselectionControllerImpl: ViewController, ContactMultiselection
|
||||
}
|
||||
|
||||
override func loadDisplayNode() {
|
||||
self.displayNode = ContactMultiselectionControllerNode(navigationBar: self.navigationBar, context: self.context, presentationData: self.presentationData, mode: self.mode, isPeerEnabled: self.isPeerEnabled, attemptDisabledItemSelection: self.attemptDisabledItemSelection, options: self.options, filters: self.filters, limit: self.limit, reachedSelectionLimit: self.params.reachedLimit)
|
||||
self.displayNode = ContactMultiselectionControllerNode(navigationBar: self.navigationBar, context: self.context, presentationData: self.presentationData, mode: self.mode, isPeerEnabled: self.isPeerEnabled, attemptDisabledItemSelection: self.attemptDisabledItemSelection, options: self.options, filters: self.filters, onlyWriteable: self.onlyWriteable, limit: self.limit, reachedSelectionLimit: self.params.reachedLimit)
|
||||
switch self.contactsNode.contentNode {
|
||||
case let .contacts(contactsNode):
|
||||
self._listReady.set(contactsNode.ready)
|
||||
@@ -366,6 +370,35 @@ class ContactMultiselectionControllerImpl: ViewController, ContactMultiselection
|
||||
}
|
||||
}
|
||||
|
||||
self.contactsNode.openDisabledPeer = { [weak self] peer, reason in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
switch reason {
|
||||
case .generic:
|
||||
break
|
||||
case .premiumRequired:
|
||||
//TODO:localize
|
||||
self.forEachController { c in
|
||||
if let c = c as? UndoOverlayController {
|
||||
c.dismiss()
|
||||
}
|
||||
return true
|
||||
}
|
||||
self.present(UndoOverlayController(presentationData: presentationData, content: .premiumPaywall(title: nil, text: "**\(peer.compactDisplayTitle)** only accepts messages from contacts and **Premium** users.", customUndoText: "View", timeout: nil, linkAction: { _ in
|
||||
}), elevatedLayout: false, animateInAsReplacement: true, action: { [weak self] action in
|
||||
guard let self else {
|
||||
return false
|
||||
}
|
||||
if case .undo = action {
|
||||
let premiumController = PremiumIntroScreen(context: self.context, source: .settings)
|
||||
self.push(premiumController)
|
||||
}
|
||||
return false
|
||||
}), in: .current)
|
||||
}
|
||||
}
|
||||
|
||||
self.contactsNode.removeSelectedPeer = { [weak self] peerId in
|
||||
if let strongSelf = self {
|
||||
var updatedCount: Int?
|
||||
|
||||
Reference in New Issue
Block a user