Skip to content

Commit

Permalink
chore: renaming of access update event handler
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandreferris committed Aug 30, 2024
1 parent d2d0480 commit 809d79c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ import com.wire.kalium.logic.sync.receiver.UserPropertiesEventReceiver
import com.wire.kalium.logic.sync.receiver.UserPropertiesEventReceiverImpl
import com.wire.kalium.logic.sync.receiver.asset.AssetMessageHandler
import com.wire.kalium.logic.sync.receiver.asset.AssetMessageHandlerImpl
import com.wire.kalium.logic.sync.receiver.conversation.AccessUpdateHandler
import com.wire.kalium.logic.sync.receiver.conversation.AccessUpdateEventHandler
import com.wire.kalium.logic.sync.receiver.conversation.ConversationMessageTimerEventHandler
import com.wire.kalium.logic.sync.receiver.conversation.ConversationMessageTimerEventHandlerImpl
import com.wire.kalium.logic.sync.receiver.conversation.DeletedConversationEventHandler
Expand Down Expand Up @@ -1467,8 +1467,8 @@ class UserSessionScope internal constructor(
callRepository = callRepository
)

private val conversationAccessUpdateHandler: AccessUpdateHandler
get() = AccessUpdateHandler(
private val conversationAccessUpdateEventHandler: AccessUpdateEventHandler
get() = AccessUpdateEventHandler(
conversationDAO = userStorage.database.conversationDAO,
selfUserId = userId
)
Expand All @@ -1489,7 +1489,7 @@ class UserSessionScope internal constructor(
conversationCodeDeletedHandler,
typingIndicatorHandler,
protocolUpdateEventHandler,
conversationAccessUpdateHandler
conversationAccessUpdateEventHandler
)
}
override val coroutineContext: CoroutineContext = SupervisorJob()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import com.wire.kalium.logic.CoreFailure
import com.wire.kalium.logic.data.event.Event
import com.wire.kalium.logic.data.event.EventDeliveryInfo
import com.wire.kalium.logic.functional.Either
import com.wire.kalium.logic.sync.receiver.conversation.AccessUpdateHandler
import com.wire.kalium.logic.sync.receiver.conversation.AccessUpdateEventHandler
import com.wire.kalium.logic.sync.receiver.conversation.ConversationMessageTimerEventHandler
import com.wire.kalium.logic.sync.receiver.conversation.DeletedConversationEventHandler
import com.wire.kalium.logic.sync.receiver.conversation.MLSWelcomeEventHandler
Expand Down Expand Up @@ -58,7 +58,7 @@ internal class ConversationEventReceiverImpl(
private val codeDeletedHandler: CodeDeletedHandler,
private val typingIndicatorHandler: TypingIndicatorHandler,
private val protocolUpdateEventHandler: ProtocolUpdateEventHandler,
private val accessUpdateHandler: AccessUpdateHandler
private val accessUpdateEventHandler: AccessUpdateEventHandler
) : ConversationEventReceiver {
override suspend fun onEvent(event: Event.Conversation, deliveryInfo: EventDeliveryInfo): Either<CoreFailure, Unit> {
// TODO: Make sure errors are accounted for by each handler.
Expand Down Expand Up @@ -110,7 +110,7 @@ internal class ConversationEventReceiverImpl(
Either.Right(Unit)
}

is Event.Conversation.AccessUpdate -> accessUpdateHandler.handle(event)
is Event.Conversation.AccessUpdate -> accessUpdateEventHandler.handle(event)
is Event.Conversation.ConversationMessageTimer -> conversationMessageTimerEventHandler.handle(event)
is Event.Conversation.CodeDeleted -> codeDeletedHandler.handle(event)
is Event.Conversation.CodeUpdated -> codeUpdatedHandler.handle(event)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ import com.wire.kalium.logic.functional.Either
import com.wire.kalium.logic.wrapStorageRequest
import com.wire.kalium.persistence.dao.conversation.ConversationDAO

interface AccessUpdateHandler {
interface AccessUpdateEventHandler {
suspend fun handle(event: Event.Conversation.AccessUpdate): Either<StorageFailure, Unit>
}

@Suppress("FunctionNaming")
fun AccessUpdateHandler(
fun AccessUpdateEventHandler(
selfUserId: UserId,
conversationDAO: ConversationDAO,
conversationMapper: ConversationMapper = MapperProvider.conversationMapper(selfUserId)
) = object : AccessUpdateHandler {
) = object : AccessUpdateEventHandler {

override suspend fun handle(event: Event.Conversation.AccessUpdate): Either<StorageFailure, Unit> =
wrapStorageRequest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import com.wire.kalium.logic.data.conversation.Conversation
import com.wire.kalium.logic.framework.TestEvent
import com.wire.kalium.logic.framework.TestUser
import com.wire.kalium.logic.functional.Either
import com.wire.kalium.logic.sync.receiver.conversation.AccessUpdateHandler
import com.wire.kalium.logic.sync.receiver.conversation.AccessUpdateEventHandler
import com.wire.kalium.logic.sync.receiver.conversation.ConversationMessageTimerEventHandler
import com.wire.kalium.logic.sync.receiver.conversation.DeletedConversationEventHandler
import com.wire.kalium.logic.sync.receiver.conversation.MLSWelcomeEventHandler
Expand Down Expand Up @@ -412,7 +412,7 @@ class ConversationEventReceiverTest {
val protocolUpdateEventHandler = mock(ProtocolUpdateEventHandler::class)

@Mock
val accessUpdateEventHandler = mock(AccessUpdateHandler::class)
val accessUpdateEventHandler = mock(AccessUpdateEventHandler::class)

private val conversationEventReceiver: ConversationEventReceiver = ConversationEventReceiverImpl(
newMessageHandler = newMessageEventHandler,
Expand All @@ -429,7 +429,7 @@ class ConversationEventReceiverTest {
codeDeletedHandler = codeDeletedHandler,
typingIndicatorHandler = typingIndicatorHandler,
protocolUpdateEventHandler = protocolUpdateEventHandler,
accessUpdateHandler = accessUpdateEventHandler
accessUpdateEventHandler = accessUpdateEventHandler
)

fun arrange(block: suspend Arrangement.() -> Unit = {}) = run {
Expand Down

0 comments on commit 809d79c

Please sign in to comment.