Merge commit '1ec1f5ca7824066a078a9abd21e1b36810e2ab90'

This commit is contained in:
Ali
2021-10-12 22:41:14 +04:00
11 changed files with 220 additions and 21 deletions

View File

@@ -9,6 +9,7 @@ public enum JoinLinkError {
case tooMuchJoined
case tooMuchUsers
case requestSent
case flood
}
func apiUpdatesGroups(_ updates: Api.Updates) -> [Api.Chat] {
@@ -38,7 +39,7 @@ public enum ExternalJoiningChatState {
}
func _internal_joinChatInteractively(with hash: String, account: Account) -> Signal <PeerId?, JoinLinkError> {
return account.network.request(Api.functions.messages.importChatInvite(hash: hash))
return account.network.request(Api.functions.messages.importChatInvite(hash: hash), automaticFloodWait: false)
|> mapError { error -> JoinLinkError in
switch error.errorDescription {
case "CHANNELS_TOO_MUCH":
@@ -48,7 +49,11 @@ func _internal_joinChatInteractively(with hash: String, account: Account) -> Sig
case "INVITE_REQUEST_SENT":
return .requestSent
default:
return .generic
if error.description.hasPrefix("FLOOD_WAIT") {
return .flood
} else {
return .generic
}
}
}
|> mapToSignal { updates -> Signal<PeerId?, JoinLinkError> in