Fix issues in old channels revoke UI

This commit is contained in:
Ali
2019-12-16 23:07:41 +04:00
parent db5fb4b642
commit c7e91c9b62
33 changed files with 3648 additions and 3459 deletions

View File

@@ -390,6 +390,7 @@ public func channelBannedMemberController(context: AccountContext, peerId: PeerI
var dismissImpl: (() -> Void)?
var presentControllerImpl: ((ViewController, Any?) -> Void)?
var pushControllerImpl: ((ViewController) -> Void)?
let peerView = Promise<PeerView>()
peerView.set(context.account.viewTracker.peerView(peerId))
@@ -654,7 +655,15 @@ public func channelBannedMemberController(context: AccountContext, peerId: PeerI
if peerId.namespace == Namespaces.Peer.CloudGroup {
let signal = convertGroupToSupergroup(account: context.account, peerId: peerId)
|> map(Optional.init)
|> `catch` { _ -> Signal<PeerId?, NoError> in
|> `catch` { error -> Signal<PeerId?, NoError> in
switch error {
case .tooManyChannels:
Queue.mainQueue().async {
pushControllerImpl?(oldChannelsController(context: context, intent: .upgrade))
}
default:
break
}
return .single(nil)
}
|> mapToSignal { upgradedPeerId -> Signal<PeerId?, NoError> in
@@ -679,6 +688,12 @@ public func channelBannedMemberController(context: AccountContext, peerId: PeerI
upgradedToSupergroup(upgradedPeerId, {
dismissImpl?()
})
} else {
updateState { current in
var current = current
current.updating = false
return current
}
}
}, error: { _ in
updateState { current in
@@ -748,5 +763,8 @@ public func channelBannedMemberController(context: AccountContext, peerId: PeerI
presentControllerImpl = { [weak controller] value, presentationArguments in
controller?.present(value, in: .window(.root), with: presentationArguments)
}
pushControllerImpl = { [weak controller] c in
controller?.push(c)
}
return controller
}