diff --git a/apps/android/app/src/main/java/chat/simplex/app/model/SimpleXAPI.kt b/apps/android/app/src/main/java/chat/simplex/app/model/SimpleXAPI.kt index 4426eb7082..410b8947be 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/model/SimpleXAPI.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/model/SimpleXAPI.kt @@ -821,7 +821,13 @@ open class ChatController(var ctrl: ChatCtrl?, val ntfManager: NtfManager, val a } else -> { if (!(networkErrorAlert(r))) { - apiErrorAlert("apiReceiveFile", generalGetString(R.string.error_receiving_file), r) + if (r is CR.ChatCmdError && r.chatError is ChatError.ChatErrorChat + && r.chatError.errorType is ChatErrorType.FileAlreadyReceiving + ) { + Log.d(TAG, "apiReceiveFile ignoring FileAlreadyReceiving error") + } else { + apiErrorAlert("apiReceiveFile", generalGetString(R.string.error_receiving_file), r) + } } null } @@ -2631,10 +2637,12 @@ sealed class ChatErrorType { val string: String get() = when (this) { is NoActiveUser -> "noActiveUser" is InvalidConnReq -> "invalidConnReq" + is FileAlreadyReceiving -> "fileAlreadyReceiving" is СommandError -> "commandError $message" } @Serializable @SerialName("noActiveUser") class NoActiveUser: ChatErrorType() @Serializable @SerialName("invalidConnReq") class InvalidConnReq: ChatErrorType() + @Serializable @SerialName("fileAlreadyReceiving") class FileAlreadyReceiving: ChatErrorType() @Serializable @SerialName("commandError") class СommandError(val message: String): ChatErrorType() } diff --git a/apps/ios/Shared/Model/SimpleXAPI.swift b/apps/ios/Shared/Model/SimpleXAPI.swift index 0db5a8ad2b..af3537435f 100644 --- a/apps/ios/Shared/Model/SimpleXAPI.swift +++ b/apps/ios/Shared/Model/SimpleXAPI.swift @@ -587,10 +587,15 @@ func apiReceiveFile(fileId: Int64, inline: Bool) async -> AChatItem? { ) } else if !networkErrorAlert(r) { logger.error("apiReceiveFile error: \(String(describing: r))") - am.showAlertMsg( - title: "Error receiving file", - message: "Error: \(String(describing: r))" - ) + switch r { + case .chatCmdError(.error(.fileAlreadyReceiving)): + logger.debug("apiReceiveFile ignoring fileAlreadyReceiving error") + default: + am.showAlertMsg( + title: "Error receiving file", + message: "Error: \(String(describing: r))" + ) + } } return nil }