From e7d0ec26637f817d0d0fcbf1c674786970ba8be2 Mon Sep 17 00:00:00 2001 From: yangsooplus Date: Fri, 16 Feb 2024 13:46:54 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=B3=B4=EB=82=B4=EC=9A=94=20=EB=B4=89?= =?UTF-8?q?=ED=88=AC=20=ED=99=94=EB=A9=B4=EC=97=90=EC=84=9C=20=EB=B4=89?= =?UTF-8?q?=ED=88=AC=20=EC=B6=94=EA=B0=80=20=EC=A7=84=EC=9E=85=20=EC=8B=9C?= =?UTF-8?q?=20=EC=B9=9C=EA=B5=AC=20=EC=A0=95=EB=B3=B4=20=EC=A0=84=EB=8B=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../susu/feature/envelope/SentEnvelopeContract.kt | 2 ++ .../com/susu/feature/envelope/SentEnvelopeScreen.kt | 13 +++++++++++++ .../susu/feature/envelope/SentEnvelopeViewModel.kt | 1 + .../susu/feature/sent/navigation/SentNavigation.kt | 5 +++-- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/feature/sent/src/main/java/com/susu/feature/envelope/SentEnvelopeContract.kt b/feature/sent/src/main/java/com/susu/feature/envelope/SentEnvelopeContract.kt index e6d595c8..a35d2040 100644 --- a/feature/sent/src/main/java/com/susu/feature/envelope/SentEnvelopeContract.kt +++ b/feature/sent/src/main/java/com/susu/feature/envelope/SentEnvelopeContract.kt @@ -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 @@ -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 } diff --git a/feature/sent/src/main/java/com/susu/feature/envelope/SentEnvelopeScreen.kt b/feature/sent/src/main/java/com/susu/feature/envelope/SentEnvelopeScreen.kt index 51034e9b..9738e823 100644 --- a/feature/sent/src/main/java/com/susu/feature/envelope/SentEnvelopeScreen.kt +++ b/feature/sent/src/main/java/com/susu/feature/envelope/SentEnvelopeScreen.kt @@ -39,6 +39,7 @@ 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 @@ -46,6 +47,7 @@ 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 @@ -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() @@ -79,6 +82,7 @@ fun SentEnvelopeRoute( is SentEnvelopeSideEffect.NavigateEnvelopeDetail -> navigateSentEnvelopeDetail(sideEffect.id) is SentEnvelopeSideEffect.PopBackStackWithDeleteFriendId -> popBackStackWithDeleteFriendId(sideEffect.id) + is SentEnvelopeSideEffect.NavigateEnvelopeAdd -> navigateSentEnvelopeAdd(sideEffect.friend) } } @@ -107,6 +111,7 @@ fun SentEnvelopeRoute( refreshState = refreshState, onClickBackIcon = viewModel::popBackStack, onClickEnvelopeDetail = viewModel::navigateSentEnvelopeDetail, + onClickAddEnvelope = viewModel::navigateSentEnvelopeAdd, ) } @@ -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 @@ -234,6 +240,13 @@ fun SentEnvelopeScreen( state = refreshState, containerColor = Gray10, ) + + SusuFloatingButton( + modifier = Modifier + .align(Alignment.BottomEnd) + .padding(SusuTheme.spacing.spacing_l), + onClick = onClickAddEnvelope, + ) } } diff --git a/feature/sent/src/main/java/com/susu/feature/envelope/SentEnvelopeViewModel.kt b/feature/sent/src/main/java/com/susu/feature/envelope/SentEnvelopeViewModel.kt index 22e11f9f..75323f83 100644 --- a/feature/sent/src/main/java/com/susu/feature/envelope/SentEnvelopeViewModel.kt +++ b/feature/sent/src/main/java/com/susu/feature/envelope/SentEnvelopeViewModel.kt @@ -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) } diff --git a/feature/sent/src/main/java/com/susu/feature/sent/navigation/SentNavigation.kt b/feature/sent/src/main/java/com/susu/feature/sent/navigation/SentNavigation.kt index 06a1de0f..c7d2fc3f 100644 --- a/feature/sent/src/main/java/com/susu/feature/sent/navigation/SentNavigation.kt +++ b/feature/sent/src/main/java/com/susu/feature/sent/navigation/SentNavigation.kt @@ -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, @@ -82,7 +82,7 @@ fun NavGraphBuilder.sentNavGraph( editedFriendId = editedFriendId, refresh = refresh, navigateSentEnvelope = navigateSentEnvelope, - navigateSentEnvelopeAdd = navigateSentEnvelopeAdd, + navigateSentEnvelopeAdd = { navigateSentEnvelopeAdd(null) }, navigateSentEnvelopeSearch = navigateSentEnvelopeSearch, navigateEnvelopeFilter = navigateEnvelopeFilter, ) @@ -103,6 +103,7 @@ fun NavGraphBuilder.sentNavGraph( popBackStackWithEditedFriendId = popBackStackWithEditedFriendId, navigateSentEnvelopeDetail = navigateSentEnvelopeDetail, popBackStackWithDeleteFriendId = popBackStackWithDeleteFriendId, + navigateSentEnvelopeAdd = navigateSentEnvelopeAdd, ) }