mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Support input dismissal in controllers that use member search node
This commit is contained in:
@@ -498,6 +498,7 @@ public func channelAdminsController(context: AccountContext, peerId: PeerId, loa
|
|||||||
|
|
||||||
var pushControllerImpl: ((ViewController) -> Void)?
|
var pushControllerImpl: ((ViewController) -> Void)?
|
||||||
var presentControllerImpl: ((ViewController, Any?) -> Void)?
|
var presentControllerImpl: ((ViewController, Any?) -> Void)?
|
||||||
|
var dismissInputImpl: (() -> Void)?
|
||||||
|
|
||||||
let actionsDisposable = DisposableSet()
|
let actionsDisposable = DisposableSet()
|
||||||
|
|
||||||
@@ -584,24 +585,24 @@ public func channelAdminsController(context: AccountContext, peerId: PeerId, loa
|
|||||||
}
|
}
|
||||||
if let participant = participant {
|
if let participant = participant {
|
||||||
switch participant.participant {
|
switch participant.participant {
|
||||||
case .creator:
|
case .creator:
|
||||||
return
|
return
|
||||||
case let .member(_, _, _, banInfo, _):
|
case let .member(_, _, _, banInfo, _):
|
||||||
if let banInfo = banInfo {
|
if let banInfo = banInfo {
|
||||||
var canUnban = false
|
var canUnban = false
|
||||||
if banInfo.restrictedBy != context.account.peerId {
|
if banInfo.restrictedBy != context.account.peerId {
|
||||||
|
canUnban = true
|
||||||
|
}
|
||||||
|
if let channel = peerView.peers[peerId] as? TelegramChannel {
|
||||||
|
if channel.hasPermission(.banMembers) {
|
||||||
canUnban = true
|
canUnban = true
|
||||||
}
|
}
|
||||||
if let channel = peerView.peers[peerId] as? TelegramChannel {
|
|
||||||
if channel.hasPermission(.banMembers) {
|
|
||||||
canUnban = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !canUnban {
|
|
||||||
presentControllerImpl?(textAlertController(context: context, title: nil, text: presentationData.strings.Channel_Members_AddAdminErrorBlacklisted, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if !canUnban {
|
||||||
|
presentControllerImpl?(textAlertController(context: context, title: nil, text: presentationData.strings.Channel_Members_AddAdminErrorBlacklisted, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pushControllerImpl?(channelAdminController(context: context, peerId: peerId, adminId: peer.id, initialParticipant: participant?.participant, updated: { _ in
|
pushControllerImpl?(channelAdminController(context: context, peerId: peerId, adminId: peer.id, initialParticipant: participant?.participant, updated: { _ in
|
||||||
@@ -746,6 +747,8 @@ public func channelAdminsController(context: AccountContext, peerId: PeerId, loa
|
|||||||
}
|
}
|
||||||
}, pushController: { c in
|
}, pushController: { c in
|
||||||
pushControllerImpl?(c)
|
pushControllerImpl?(c)
|
||||||
|
}, dismissInput: {
|
||||||
|
dismissInputImpl?()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -772,6 +775,9 @@ public func channelAdminsController(context: AccountContext, peerId: PeerId, loa
|
|||||||
controller.view.endEditing(true)
|
controller.view.endEditing(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dismissInputImpl = { [weak controller] in
|
||||||
|
controller?.view.endEditing(true)
|
||||||
|
}
|
||||||
upgradedToSupergroupImpl = { [weak controller] upgradedPeerId, f in
|
upgradedToSupergroupImpl = { [weak controller] upgradedPeerId, f in
|
||||||
guard let controller = controller, let navigationController = controller.navigationController as? NavigationController else {
|
guard let controller = controller, let navigationController = controller.navigationController as? NavigationController else {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -277,6 +277,7 @@ public func channelBlacklistController(context: AccountContext, peerId: PeerId)
|
|||||||
|
|
||||||
var presentControllerImpl: ((ViewController, Any?) -> Void)?
|
var presentControllerImpl: ((ViewController, Any?) -> Void)?
|
||||||
var pushControllerImpl: ((ViewController) -> Void)?
|
var pushControllerImpl: ((ViewController) -> Void)?
|
||||||
|
var dismissInputImpl: (() -> Void)?
|
||||||
|
|
||||||
let actionsDisposable = DisposableSet()
|
let actionsDisposable = DisposableSet()
|
||||||
|
|
||||||
@@ -492,6 +493,8 @@ public func channelBlacklistController(context: AccountContext, peerId: PeerId)
|
|||||||
}
|
}
|
||||||
}, pushController: { c in
|
}, pushController: { c in
|
||||||
pushControllerImpl?(c)
|
pushControllerImpl?(c)
|
||||||
|
}, dismissInput: {
|
||||||
|
dismissInputImpl?()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,6 +520,9 @@ public func channelBlacklistController(context: AccountContext, peerId: PeerId)
|
|||||||
(controller.navigationController as? NavigationController)?.pushViewController(c)
|
(controller.navigationController as? NavigationController)?.pushViewController(c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dismissInputImpl = { [weak controller] in
|
||||||
|
controller?.view.endEditing(true)
|
||||||
|
}
|
||||||
controller.visibleBottomContentOffsetChanged = { offset in
|
controller.visibleBottomContentOffsetChanged = { offset in
|
||||||
if case let .known(value) = offset, value < 40.0 {
|
if case let .known(value) = offset, value < 40.0 {
|
||||||
context.peerChannelMemberCategoriesContextsManager.loadMore(peerId: peerId, control: loadMoreControl)
|
context.peerChannelMemberCategoriesContextsManager.loadMore(peerId: peerId, control: loadMoreControl)
|
||||||
|
|||||||
@@ -339,6 +339,7 @@ public func channelMembersController(context: AccountContext, peerId: PeerId) ->
|
|||||||
|
|
||||||
var presentControllerImpl: ((ViewController, Any?) -> Void)?
|
var presentControllerImpl: ((ViewController, Any?) -> Void)?
|
||||||
var pushControllerImpl: ((ViewController) -> Void)?
|
var pushControllerImpl: ((ViewController) -> Void)?
|
||||||
|
var dismissInputImpl: (() -> Void)?
|
||||||
|
|
||||||
let actionsDisposable = DisposableSet()
|
let actionsDisposable = DisposableSet()
|
||||||
|
|
||||||
@@ -506,6 +507,8 @@ public func channelMembersController(context: AccountContext, peerId: PeerId) ->
|
|||||||
}
|
}
|
||||||
}, pushController: { c in
|
}, pushController: { c in
|
||||||
pushControllerImpl?(c)
|
pushControllerImpl?(c)
|
||||||
|
}, dismissInput: {
|
||||||
|
dismissInputImpl?()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,6 +540,9 @@ public func channelMembersController(context: AccountContext, peerId: PeerId) ->
|
|||||||
(controller.navigationController as? NavigationController)?.pushViewController(c)
|
(controller.navigationController as? NavigationController)?.pushViewController(c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dismissInputImpl = { [weak controller] in
|
||||||
|
controller?.view.endEditing(true)
|
||||||
|
}
|
||||||
controller.visibleBottomContentOffsetChanged = { offset in
|
controller.visibleBottomContentOffsetChanged = { offset in
|
||||||
if let loadMoreControl = loadMoreControl, case let .known(value) = offset, value < 40.0 {
|
if let loadMoreControl = loadMoreControl, case let .known(value) = offset, value < 40.0 {
|
||||||
context.peerChannelMemberCategoriesContextsManager.loadMore(peerId: peerId, control: loadMoreControl)
|
context.peerChannelMemberCategoriesContextsManager.loadMore(peerId: peerId, control: loadMoreControl)
|
||||||
|
|||||||
@@ -466,6 +466,7 @@ public func channelPermissionsController(context: AccountContext, peerId origina
|
|||||||
|
|
||||||
var presentControllerImpl: ((ViewController, Any?) -> Void)?
|
var presentControllerImpl: ((ViewController, Any?) -> Void)?
|
||||||
var pushControllerImpl: ((ViewController) -> Void)?
|
var pushControllerImpl: ((ViewController) -> Void)?
|
||||||
|
var dismissInputImpl: (() -> Void)?
|
||||||
|
|
||||||
let actionsDisposable = DisposableSet()
|
let actionsDisposable = DisposableSet()
|
||||||
|
|
||||||
@@ -803,6 +804,8 @@ public func channelPermissionsController(context: AccountContext, peerId origina
|
|||||||
}
|
}
|
||||||
}, pushController: { c in
|
}, pushController: { c in
|
||||||
pushControllerImpl?(c)
|
pushControllerImpl?(c)
|
||||||
|
}, dismissInput: {
|
||||||
|
dismissInputImpl?()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -828,6 +831,9 @@ public func channelPermissionsController(context: AccountContext, peerId origina
|
|||||||
(controller.navigationController as? NavigationController)?.pushViewController(c)
|
(controller.navigationController as? NavigationController)?.pushViewController(c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dismissInputImpl = { [weak controller] in
|
||||||
|
controller?.view.endEditing(true)
|
||||||
|
}
|
||||||
upgradedToSupergroupImpl = { [weak controller] upgradedPeerId, f in
|
upgradedToSupergroupImpl = { [weak controller] upgradedPeerId, f in
|
||||||
guard let controller = controller, let navigationController = controller.navigationController as? NavigationController else {
|
guard let controller = controller, let navigationController = controller.navigationController as? NavigationController else {
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user