diff --git a/submodules/TelegramCore/Sources/GroupCalls.swift b/submodules/TelegramCore/Sources/GroupCalls.swift index c9b58221cf..047a018db3 100644 --- a/submodules/TelegramCore/Sources/GroupCalls.swift +++ b/submodules/TelegramCore/Sources/GroupCalls.swift @@ -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 { @@ -135,7 +135,10 @@ public func createGroupCall(account: Account, peerId: PeerId) -> Signal mapError { _ -> CreateGroupCallError in + |> mapError { error -> CreateGroupCallError in + if error.errorDescription == "ANONYMOUS_CALLS_DISABLED" { + return .anonymousNotAllowed + } return .generic } |> mapToSignal { result -> Signal in diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index 275bcfec57..c24dddf2e4 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -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?()