Various Fixes

This commit is contained in:
Ilya Laktyushin
2021-10-09 20:01:21 +04:00
parent 5114a1d068
commit f52f73a4df
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