Skip to content

Commit

Permalink
Remove unused repositoryFacade param
Browse files Browse the repository at this point in the history
  • Loading branch information
JcMinarro authored and kanat committed Jan 9, 2024
1 parent 82bd4f3 commit 7791971
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,7 @@ internal constructor(
plugins.forEach { listener -> listener.onAttachmentSendRequest(channelType, channelId, preparedMessage) }

return attachmentsSender
.sendAttachments(preparedMessage, channelType, channelId, isRetrying, repositoryFacade)
.sendAttachments(preparedMessage, channelType, channelId, isRetrying)
.also { result ->
debugger.onInterceptionStop(result, preparedMessage)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package io.getstream.chat.android.client.attachment
import android.content.Context
import io.getstream.chat.android.client.attachment.worker.UploadAttachmentsAndroidWorker
import io.getstream.chat.android.client.extensions.internal.hasPendingAttachments
import io.getstream.chat.android.client.persistance.repository.RepositoryFacade
import io.getstream.chat.android.client.setup.state.ClientState
import io.getstream.chat.android.models.Attachment
import io.getstream.chat.android.models.Message
Expand Down Expand Up @@ -58,22 +57,21 @@ internal class AttachmentsSender(
channelType: String,
channelId: String,
isRetrying: Boolean,
repositoryFacade: RepositoryFacade,
): Result<Message> {
val result = if (!isRetrying) {
if (message.hasPendingAttachments()) {
logger.d {
"[sendAttachments] Message ${message.id}" +
" has ${message.attachments.size} pending attachments"
}
uploadAttachments(message, channelType, channelId, repositoryFacade)
uploadAttachments(message, channelType, channelId)
} else {
logger.d { "[sendAttachments] Message ${message.id} without attachments" }
Result.Success(message)
}
} else {
logger.d { "[sendAttachments] Retrying Message ${message.id}" }
retryMessage(message, channelType, channelId, repositoryFacade)
retryMessage(message, channelType, channelId)
}
return verifier.verifyAttachments(result)
}
Expand All @@ -91,9 +89,8 @@ internal class AttachmentsSender(
message: Message,
channelType: String,
channelId: String,
repositoryFacade: RepositoryFacade,
): Result<Message> =
uploadAttachments(message, channelType, channelId, repositoryFacade)
uploadAttachments(message, channelType, channelId)

/**
* Uploads the attachment of this message if there is any pending attachments and return the updated message.
Expand All @@ -106,10 +103,9 @@ internal class AttachmentsSender(
message: Message,
channelType: String,
channelId: String,
repositoryFacade: RepositoryFacade,
): Result<Message> {
return if (clientState.isNetworkAvailable) {
waitForAttachmentsToBeSent(message, channelType, channelId, repositoryFacade)
waitForAttachmentsToBeSent(message, channelType, channelId)
} else {
enqueueAttachmentUpload(message, channelType, channelId)
logger.d { "[uploadAttachments] Chat is offline, not sending message with id ${message.id}" }
Expand All @@ -130,7 +126,6 @@ internal class AttachmentsSender(
newMessage: Message,
channelType: String,
channelId: String,
repositoryFacade: RepositoryFacade,
): Result<Message> {
jobsMap[newMessage.id]?.cancel()
var allAttachmentsUploaded = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ internal class ChatClientDebuggerTest {
val channelId = "general"
val message = Message(text = "test-message")
val isRetrying = false
whenever(attachmentsSender.sendAttachments(any(), any(), any(), any(), any())) doReturn Result.Success(message)
whenever(attachmentsSender.sendAttachments(any(), any(), any(), any())) doReturn Result.Success(message)
whenever(api.sendMessage(any(), any(), any())) doReturn message.asCall()

/* When */
Expand All @@ -177,7 +177,7 @@ internal class ChatClientDebuggerTest {
val channelId = "general"
val message = Message(id = "id_1", text = "test-message")
val isRetrying = false
whenever(attachmentsSender.sendAttachments(any(), any(), any(), any(), any())) doReturn Result.Success(message)
whenever(attachmentsSender.sendAttachments(any(), any(), any(), any())) doReturn Result.Success(message)
whenever(api.sendMessage(any(), any(), any())) doReturn message.asCall()

/* When */
Expand Down

0 comments on commit 7791971

Please sign in to comment.