From 779197165521d8cc1c785196df040add5d426be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jc=20Mi=C3=B1arro?= Date: Mon, 8 Jan 2024 16:23:38 +0100 Subject: [PATCH] Remove unused repositoryFacade param --- .../io/getstream/chat/android/client/ChatClient.kt | 2 +- .../android/client/attachment/AttachmentsSender.kt | 13 ++++--------- .../client/debugger/ChatClientDebuggerTest.kt | 4 ++-- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/stream-chat-android-client/src/main/java/io/getstream/chat/android/client/ChatClient.kt b/stream-chat-android-client/src/main/java/io/getstream/chat/android/client/ChatClient.kt index a19a98b45d8..ced23733347 100644 --- a/stream-chat-android-client/src/main/java/io/getstream/chat/android/client/ChatClient.kt +++ b/stream-chat-android-client/src/main/java/io/getstream/chat/android/client/ChatClient.kt @@ -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) } diff --git a/stream-chat-android-client/src/main/java/io/getstream/chat/android/client/attachment/AttachmentsSender.kt b/stream-chat-android-client/src/main/java/io/getstream/chat/android/client/attachment/AttachmentsSender.kt index e26d10444a2..9e11d049995 100644 --- a/stream-chat-android-client/src/main/java/io/getstream/chat/android/client/attachment/AttachmentsSender.kt +++ b/stream-chat-android-client/src/main/java/io/getstream/chat/android/client/attachment/AttachmentsSender.kt @@ -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 @@ -58,7 +57,6 @@ internal class AttachmentsSender( channelType: String, channelId: String, isRetrying: Boolean, - repositoryFacade: RepositoryFacade, ): Result { val result = if (!isRetrying) { if (message.hasPendingAttachments()) { @@ -66,14 +64,14 @@ internal class AttachmentsSender( "[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) } @@ -91,9 +89,8 @@ internal class AttachmentsSender( message: Message, channelType: String, channelId: String, - repositoryFacade: RepositoryFacade, ): Result = - 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. @@ -106,10 +103,9 @@ internal class AttachmentsSender( message: Message, channelType: String, channelId: String, - repositoryFacade: RepositoryFacade, ): Result { 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}" } @@ -130,7 +126,6 @@ internal class AttachmentsSender( newMessage: Message, channelType: String, channelId: String, - repositoryFacade: RepositoryFacade, ): Result { jobsMap[newMessage.id]?.cancel() var allAttachmentsUploaded = false diff --git a/stream-chat-android-client/src/test/java/io/getstream/chat/android/client/debugger/ChatClientDebuggerTest.kt b/stream-chat-android-client/src/test/java/io/getstream/chat/android/client/debugger/ChatClientDebuggerTest.kt index d5ee66727c7..657b90de7d2 100644 --- a/stream-chat-android-client/src/test/java/io/getstream/chat/android/client/debugger/ChatClientDebuggerTest.kt +++ b/stream-chat-android-client/src/test/java/io/getstream/chat/android/client/debugger/ChatClientDebuggerTest.kt @@ -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 */ @@ -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 */