mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Display an error when trying to create a voice chat as an anonymous admin
This commit is contained in:
parent
dd0edaefa8
commit
76aecfbcea
@ -114,7 +114,6 @@ public func getCurrentGroupCall(account: Account, callId: Int64, accessHash: Int
|
||||
)
|
||||
}
|
||||
|> mapError { _ -> GetCurrentGroupCallError in
|
||||
return .generic
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -122,6 +121,7 @@ public func getCurrentGroupCall(account: Account, callId: Int64, accessHash: Int
|
||||
|
||||
public enum CreateGroupCallError {
|
||||
case generic
|
||||
case anonymousNotAllowed
|
||||
}
|
||||
|
||||
public func createGroupCall(account: Account, peerId: PeerId) -> Signal<GroupCallInfo, CreateGroupCallError> {
|
||||
@ -135,7 +135,10 @@ public func createGroupCall(account: Account, peerId: PeerId) -> Signal<GroupCal
|
||||
}
|
||||
|
||||
return account.network.request(Api.functions.phone.createGroupCall(channel: inputPeer, randomId: Int32.random(in: Int32.min ... Int32.max)))
|
||||
|> mapError { _ -> CreateGroupCallError in
|
||||
|> mapError { error -> CreateGroupCallError in
|
||||
if error.errorDescription == "ANONYMOUS_CALLS_DISABLED" {
|
||||
return .anonymousNotAllowed
|
||||
}
|
||||
return .generic
|
||||
}
|
||||
|> mapToSignal { result -> Signal<GroupCallInfo, CreateGroupCallError> in
|
||||
|
@ -3247,13 +3247,22 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
||||
return
|
||||
}
|
||||
strongSelf.context.joinGroupCall(peerId: peerId, activeCall: CachedChannelData.ActiveCall(id: info.id, accessHash: info.accessHash), sourcePanel: nil)
|
||||
}, error: { [weak self] _ in
|
||||
}, error: { [weak self] error in
|
||||
dismissStatus?()
|
||||
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.headerNode.navigationButtonContainer.performAction?(.cancel)
|
||||
|
||||
let text: String
|
||||
switch error {
|
||||
case .generic:
|
||||
text = strongSelf.presentationData.strings.Login_UnknownError
|
||||
case .anonymousNotAllowed:
|
||||
text = strongSelf.presentationData.strings.VoiceChat_AnonymousDisabledAlertText
|
||||
}
|
||||
strongSelf.controller?.present(textAlertController(context: strongSelf.context, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||
}, completed: { [weak self] in
|
||||
dismissStatus?()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user