mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 03:16:02 +03:00
Extract condition to reduce code complexity
This commit is contained in:
parent
cbf9dbf290
commit
128ff0d6ec
1 changed files with 4 additions and 2 deletions
|
@ -46,8 +46,7 @@ internal class DefaultSendEventTask @Inject constructor(
|
|||
|
||||
override suspend fun execute(params: SendEventTask.Params): String {
|
||||
try {
|
||||
if (RoomLocalEcho.isLocalEchoId(params.event.roomId.orEmpty())) {
|
||||
// Room is local, so create a real one and send the event to this new room
|
||||
if (params.event.isLocalRoomEvent) {
|
||||
return createRoomAndSendEvent(params)
|
||||
}
|
||||
|
||||
|
@ -105,4 +104,7 @@ internal class DefaultSendEventTask @Inject constructor(
|
|||
}
|
||||
return params.event
|
||||
}
|
||||
|
||||
private val Event.isLocalRoomEvent
|
||||
get() = RoomLocalEcho.isLocalEchoId(roomId.orEmpty())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue