mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Add "group is full" error
This commit is contained in:
parent
da1c02c0a2
commit
b8c06ddffe
@ -6149,3 +6149,5 @@ Sorry for the inconvenience.";
|
||||
"Channel.Setup.LinkTypePrivate" = "Private";
|
||||
|
||||
"VoiceOver.ScrollStatus" = "Row %1$@ of %2$@";
|
||||
|
||||
"Conversation.UsersTooMuchError" = "Sorry, this group is full.";
|
||||
|
@ -128,22 +128,27 @@ public final class JoinLinkPreviewController: ViewController {
|
||||
}
|
||||
}, error: { [weak self] error in
|
||||
if let strongSelf = self {
|
||||
if case .tooMuchJoined = error {
|
||||
if let parentNavigationController = strongSelf.parentNavigationController {
|
||||
let context = strongSelf.context
|
||||
let link = strongSelf.link
|
||||
let navigateToPeer = strongSelf.navigateToPeer
|
||||
let resolvedState = strongSelf.resolvedState
|
||||
parentNavigationController.pushViewController(oldChannelsController(context: strongSelf.context, intent: .join, completed: { [weak parentNavigationController] value in
|
||||
if value {
|
||||
(parentNavigationController?.viewControllers.last as? ViewController)?.present(JoinLinkPreviewController(context: context, link: link, navigateToPeer: navigateToPeer, parentNavigationController: parentNavigationController, resolvedState: resolvedState), in: .window(.root))
|
||||
}
|
||||
}))
|
||||
} else {
|
||||
strongSelf.present(textAlertController(context: strongSelf.context, title: nil, text: strongSelf.presentationData.strings.Join_ChannelsTooMuch, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||
}
|
||||
strongSelf.dismiss()
|
||||
switch error {
|
||||
case .tooMuchJoined:
|
||||
if let parentNavigationController = strongSelf.parentNavigationController {
|
||||
let context = strongSelf.context
|
||||
let link = strongSelf.link
|
||||
let navigateToPeer = strongSelf.navigateToPeer
|
||||
let resolvedState = strongSelf.resolvedState
|
||||
parentNavigationController.pushViewController(oldChannelsController(context: strongSelf.context, intent: .join, completed: { [weak parentNavigationController] value in
|
||||
if value {
|
||||
(parentNavigationController?.viewControllers.last as? ViewController)?.present(JoinLinkPreviewController(context: context, link: link, navigateToPeer: navigateToPeer, parentNavigationController: parentNavigationController, resolvedState: resolvedState), in: .window(.root))
|
||||
}
|
||||
}))
|
||||
} else {
|
||||
strongSelf.present(textAlertController(context: strongSelf.context, title: nil, text: strongSelf.presentationData.strings.Join_ChannelsTooMuch, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||
}
|
||||
case .tooMuchUsers:
|
||||
strongSelf.present(textAlertController(context: strongSelf.context, title: nil, text: strongSelf.presentationData.strings.Conversation_UsersTooMuchError, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
|
||||
case .generic:
|
||||
break
|
||||
}
|
||||
strongSelf.dismiss()
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import SyncCore
|
||||
public enum JoinChannelError {
|
||||
case generic
|
||||
case tooMuchJoined
|
||||
case tooMuchUsers
|
||||
}
|
||||
|
||||
public func joinChannel(account: Account, peerId: PeerId) -> Signal<RenderedChannelParticipant?, JoinChannelError> {
|
||||
@ -18,10 +19,13 @@ public func joinChannel(account: Account, peerId: PeerId) -> Signal<RenderedChan
|
||||
if let inputChannel = apiInputChannel(peer) {
|
||||
return account.network.request(Api.functions.channels.joinChannel(channel: inputChannel))
|
||||
|> mapError { error -> JoinChannelError in
|
||||
if error.errorDescription == "CHANNELS_TOO_MUCH" {
|
||||
return .tooMuchJoined
|
||||
} else {
|
||||
return .generic
|
||||
switch error.errorDescription {
|
||||
case "CHANNELS_TOO_MUCH":
|
||||
return .tooMuchJoined
|
||||
case "USERS_TOO_MUCH":
|
||||
return .tooMuchUsers
|
||||
default:
|
||||
return .generic
|
||||
}
|
||||
}
|
||||
|> mapToSignal { updates -> Signal<RenderedChannelParticipant?, JoinChannelError> in
|
||||
|
@ -8,6 +8,7 @@ import SyncCore
|
||||
public enum JoinLinkError {
|
||||
case generic
|
||||
case tooMuchJoined
|
||||
case tooMuchUsers
|
||||
}
|
||||
|
||||
func apiUpdatesGroups(_ updates: Api.Updates) -> [Api.Chat] {
|
||||
@ -31,10 +32,13 @@ public enum ExternalJoiningChatState {
|
||||
public func joinChatInteractively(with hash: String, account: Account) -> Signal <PeerId?, JoinLinkError> {
|
||||
return account.network.request(Api.functions.messages.importChatInvite(hash: hash))
|
||||
|> mapError { error -> JoinLinkError in
|
||||
if error.errorDescription == "CHANNELS_TOO_MUCH" {
|
||||
return .tooMuchJoined
|
||||
} else {
|
||||
return .generic
|
||||
switch error.errorDescription {
|
||||
case "CHANNELS_TOO_MUCH":
|
||||
return .tooMuchJoined
|
||||
case "USERS_TOO_MUCH":
|
||||
return .tooMuchUsers
|
||||
default:
|
||||
return .generic
|
||||
}
|
||||
}
|
||||
|> mapToSignal { updates -> Signal<PeerId?, JoinLinkError> in
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -189,7 +189,9 @@ final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode {
|
||||
}
|
||||
}))
|
||||
return
|
||||
default:
|
||||
case .tooMuchUsers:
|
||||
text = presentationInterfaceState.strings.Conversation_UsersTooMuchError
|
||||
case .generic:
|
||||
if let channel = peer as? TelegramChannel, case .broadcast = channel.info {
|
||||
text = presentationInterfaceState.strings.Channel_ErrorAccessDenied
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user