Skip to content

Commit

Permalink
chore: ktlint
Browse files Browse the repository at this point in the history
  • Loading branch information
jinukeu committed Jan 31, 2024
1 parent e759b4c commit 77fa521
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,6 @@ class EnvelopesRepositoryImpl @Inject constructor(
} else {
null
},
)
),
).getOrThrow().toModel()
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ class FriendRepositoryImpl @Inject constructor(
phoneNumber = phoneNumber,
relationshipId = relationshipId,
customRelation = customRelation,
)
),
).getOrThrow()
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import com.susu.core.ui.DialogToken
import com.susu.core.ui.SnackbarToken
import com.susu.core.ui.extension.collectWithLifecycle
import com.susu.core.ui.extension.toMoneyFormat
import com.susu.core.ui.util.to_yyyy_dot_MM_dot_dd
import com.susu.core.ui.util.to_yyyy_korYear_M_korMonth_d_korDay
import com.susu.feature.received.R
import com.susu.feature.received.envelopedetail.component.DetailItem
Expand Down Expand Up @@ -157,9 +156,13 @@ fun ReceivedEnvelopeDetailScreen(
)
DetailItem(
categoryText = stringResource(com.susu.core.ui.R.string.word_is_visited),
contentText = if (uiState.envelope.hasVisited == true) stringResource(id = com.susu.core.ui.R.string.word_yes) else stringResource(
id = com.susu.core.ui.R.string.word_no,
),
contentText = if (uiState.envelope.hasVisited == true) {
stringResource(id = com.susu.core.ui.R.string.word_yes)
} else {
stringResource(
id = com.susu.core.ui.R.string.word_no,
)
},
isEmptyContent = uiState.envelope.hasVisited == null,
)
DetailItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.susu.feature.received.navigation.ReceivedRoute
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import kotlinx.serialization.json.Json
import timber.log.Timber
import javax.inject.Inject

@HiltViewModel
Expand All @@ -35,7 +34,7 @@ class ReceivedEnvelopeDetailViewModel @Inject constructor(
this@ReceivedEnvelopeDetailViewModel.envelope = envelope
intent {
copy(
envelope = envelope
envelope = envelope,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ fun ReceivedEnvelopeEditRoute(
viewModel.initData()
}


ReceivedEnvelopeEditScreen(
uiState = uiState,
focusRequester = focusRequester,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,17 @@ package com.susu.feature.received.envelopeedit
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.viewModelScope
import com.susu.core.model.Envelope
import com.susu.core.model.Friend
import com.susu.core.model.Relationship
import com.susu.core.ui.base.BaseViewModel
import com.susu.core.ui.base.SideEffect
import com.susu.core.ui.extension.decodeFromUri
import com.susu.core.ui.extension.encodeToUri
import com.susu.domain.usecase.envelope.DeleteEnvelopeUseCase
import com.susu.domain.usecase.envelope.EditReceivedEnvelopeUseCase
import com.susu.domain.usecase.envelope.GetEnvelopeUseCase
import com.susu.domain.usecase.envelope.GetRelationShipConfigListUseCase
import com.susu.feature.received.navigation.ReceivedRoute
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.collections.immutable.toPersistentList
import kotlinx.coroutines.launch
import kotlinx.datetime.toKotlinLocalDateTime
import kotlinx.serialization.json.Json
import timber.log.Timber
import java.time.LocalDateTime
import javax.inject.Inject

Expand Down Expand Up @@ -48,8 +42,11 @@ class ReceivedEnvelopeEditViewModel @Inject constructor(
copy(
envelope = envelope,
relationshipConfig = it.map {
if (it.id == envelope.relationship.id) it.copy(customRelation = envelope.relationship.customRelation)
else it
if (it.id == envelope.relationship.id) {
it.copy(customRelation = envelope.relationship.customRelation)
} else {
it
}
}.toPersistentList(),
showCustomRelationButton = it.last().id == envelope.relationship.id,
isRelationSaved = it.last().id == envelope.relationship.id,
Expand All @@ -60,7 +57,7 @@ class ReceivedEnvelopeEditViewModel @Inject constructor(

fun editReceivedEnvelope() = viewModelScope.launch {
editReceivedEnvelopeUseCase(
param = with(currentState) {
param = with(currentState) {
EditReceivedEnvelopeUseCase.Param(
envelopeId = envelope.id,
friendId = envelope.friend.id,
Expand All @@ -75,15 +72,14 @@ class ReceivedEnvelopeEditViewModel @Inject constructor(
handedOverAt = envelope.handedOverAt,
hasVisited = envelope.hasVisited,
)
}
},
).onSuccess {
popBackStack()
}.onFailure {
postSideEffect(ReceivedEnvelopeEditSideEffect.HandleException(it, ::editReceivedEnvelope))
}
}


fun popBackStack() = postSideEffect(ReceivedEnvelopeEditSideEffect.PopBackStack)

fun updateMoney(money: String) = intent {
Expand All @@ -110,7 +106,9 @@ class ReceivedEnvelopeEditViewModel @Inject constructor(
relationshipConfig = relationshipConfig.map {
if (it.id == envelope.relationship.id) {
it.copy(customRelation = customRelation)
} else it
} else {
it
}
}.toPersistentList(),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ class LedgerDetailViewModel @Inject constructor(

copy(
envelopeList = envelopeList.map {
if (it.envelope.id == searchEnvelope.envelope.id) searchEnvelope
else it
if (it.envelope.id == searchEnvelope.envelope.id) {
searchEnvelope
} else {
it
}
}.toPersistentList(),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.GridItemSpan
import androidx.compose.foundation.lazy.grid.LazyGridState
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
Expand Down

0 comments on commit 77fa521

Please sign in to comment.