Skip to content

Commit

Permalink
feat: 보내요 봉투 화면에서 봉투 추가 진입 시 친구 정보 전달
Browse files Browse the repository at this point in the history
  • Loading branch information
yangsooplus committed Feb 16, 2024
1 parent db1af7d commit e7d0ec2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.susu.feature.envelope

import com.susu.core.model.EnvelopeSearch
import com.susu.core.model.Friend
import com.susu.core.model.FriendStatistics
import com.susu.core.ui.base.SideEffect
import com.susu.core.ui.base.UiState
Expand All @@ -15,6 +16,7 @@ data class SentEnvelopeState(

sealed interface SentEnvelopeSideEffect : SideEffect {
data class NavigateEnvelopeDetail(val id: Long) : SentEnvelopeSideEffect
data class NavigateEnvelopeAdd(val friend: Friend) : SentEnvelopeSideEffect
data object PopBackStack : SentEnvelopeSideEffect
data class PopBackStackWithDeleteFriendId(val id: Long) : SentEnvelopeSideEffect
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ import com.susu.core.designsystem.component.appbar.icon.BackIcon
import com.susu.core.designsystem.component.badge.BadgeColor
import com.susu.core.designsystem.component.badge.BadgeStyle
import com.susu.core.designsystem.component.badge.SusuBadge
import com.susu.core.designsystem.component.button.SusuFloatingButton
import com.susu.core.designsystem.theme.Gray10
import com.susu.core.designsystem.theme.Gray100
import com.susu.core.designsystem.theme.Gray20
import com.susu.core.designsystem.theme.Gray60
import com.susu.core.designsystem.theme.Gray90
import com.susu.core.designsystem.theme.Orange20
import com.susu.core.designsystem.theme.SusuTheme
import com.susu.core.model.Friend
import com.susu.core.ui.extension.OnBottomReached
import com.susu.core.ui.extension.collectWithLifecycle
import com.susu.core.ui.extension.toMoneyFormat
Expand All @@ -63,6 +65,7 @@ fun SentEnvelopeRoute(
popBackStackWithEditedFriendId: (Long) -> Unit,
editedFriendId: Long?,
navigateSentEnvelopeDetail: (Long) -> Unit,
navigateSentEnvelopeAdd: (Friend) -> Unit,
) {
val uiState = viewModel.uiState.collectAsStateWithLifecycle().value
val historyListState = rememberLazyListState()
Expand All @@ -79,6 +82,7 @@ fun SentEnvelopeRoute(

is SentEnvelopeSideEffect.NavigateEnvelopeDetail -> navigateSentEnvelopeDetail(sideEffect.id)
is SentEnvelopeSideEffect.PopBackStackWithDeleteFriendId -> popBackStackWithDeleteFriendId(sideEffect.id)
is SentEnvelopeSideEffect.NavigateEnvelopeAdd -> navigateSentEnvelopeAdd(sideEffect.friend)
}
}

Expand Down Expand Up @@ -107,6 +111,7 @@ fun SentEnvelopeRoute(
refreshState = refreshState,
onClickBackIcon = viewModel::popBackStack,
onClickEnvelopeDetail = viewModel::navigateSentEnvelopeDetail,
onClickAddEnvelope = viewModel::navigateSentEnvelopeAdd,
)
}

Expand All @@ -119,6 +124,7 @@ fun SentEnvelopeScreen(
historyListState: LazyListState = rememberLazyListState(),
onClickBackIcon: () -> Unit = {},
onClickEnvelopeDetail: (Long) -> Unit = {},
onClickAddEnvelope: () -> Unit = {},
) {
val sent = uiState.envelopeInfo.sentAmounts
val received = uiState.envelopeInfo.receivedAmounts
Expand Down Expand Up @@ -234,6 +240,13 @@ fun SentEnvelopeScreen(
state = refreshState,
containerColor = Gray10,
)

SusuFloatingButton(
modifier = Modifier
.align(Alignment.BottomEnd)
.padding(SusuTheme.spacing.spacing_l),
onClick = onClickAddEnvelope,
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class SentEnvelopeViewModel @Inject constructor(
}
}

fun navigateSentEnvelopeAdd() = postSideEffect(SentEnvelopeSideEffect.NavigateEnvelopeAdd(currentState.envelopeInfo.friend))
fun navigateSentEnvelopeDetail(id: Long) = postSideEffect(SentEnvelopeSideEffect.NavigateEnvelopeDetail(id = id))
fun popBackStack() = postSideEffect(SentEnvelopeSideEffect.PopBackStack)
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fun NavGraphBuilder.sentNavGraph(
navigateSentEnvelope: (Long) -> Unit,
navigateSentEnvelopeDetail: (Long) -> Unit,
navigateSentEnvelopeEdit: (EnvelopeDetail) -> Unit,
navigateSentEnvelopeAdd: () -> Unit,
navigateSentEnvelopeAdd: (Friend?) -> Unit,
navigateSentEnvelopeSearch: () -> Unit,
navigateEnvelopeFilter: (String) -> Unit,
onShowSnackbar: (SnackbarToken) -> Unit,
Expand All @@ -82,7 +82,7 @@ fun NavGraphBuilder.sentNavGraph(
editedFriendId = editedFriendId,
refresh = refresh,
navigateSentEnvelope = navigateSentEnvelope,
navigateSentEnvelopeAdd = navigateSentEnvelopeAdd,
navigateSentEnvelopeAdd = { navigateSentEnvelopeAdd(null) },
navigateSentEnvelopeSearch = navigateSentEnvelopeSearch,
navigateEnvelopeFilter = navigateEnvelopeFilter,
)
Expand All @@ -103,6 +103,7 @@ fun NavGraphBuilder.sentNavGraph(
popBackStackWithEditedFriendId = popBackStackWithEditedFriendId,
navigateSentEnvelopeDetail = navigateSentEnvelopeDetail,
popBackStackWithDeleteFriendId = popBackStackWithDeleteFriendId,
navigateSentEnvelopeAdd = navigateSentEnvelopeAdd,
)
}

Expand Down

0 comments on commit e7d0ec2

Please sign in to comment.