From 83c03cdb27787c51d3618ad0776bc553bab45338 Mon Sep 17 00:00:00 2001 From: KwonDae Date: Wed, 3 Aug 2022 16:00:59 +0900 Subject: [PATCH 01/15] =?UTF-8?q?feat=20:=20=EC=95=BD=EC=86=8D=EC=9D=91?= =?UTF-8?q?=EB=8B=B5=20=EC=95=B1=EB=B0=94=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/PlanzIconAndTextAppBar.kt | 56 +++++++++++++------ .../presentation/component/PlanzMenuAppBar.kt | 2 +- 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzIconAndTextAppBar.kt b/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzIconAndTextAppBar.kt index 3b9ad78f..f5186465 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzIconAndTextAppBar.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzIconAndTextAppBar.kt @@ -11,6 +11,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource import androidx.compose.ui.text.style.TextAlign @@ -29,17 +30,21 @@ fun PlanzBackAndClearAppBar( modifier: Modifier = Modifier, title: String, onClickBackIcon: () -> Unit, + onClickUserIcon: () -> Unit, textIconTitle: String, textIconColor: Color, - onClickClearIcon: () -> Unit, + onClickClearText: () -> Unit, + clickable: Boolean, ) { PlanzIconAndTextAppBar( title = title, menu = PlanzAppBarMenu.BACK, - onClickIcon = onClickBackIcon, + onClickNavigationIcon = onClickBackIcon, + actionMenu = PlanzAppBarMenu.USER, + onClickActionIcon = onClickUserIcon, textIconTitle = textIconTitle, - textIconColor = textIconColor, - onclickTextIcon = onClickClearIcon + textIconColor = if (clickable) MainPurple900 else textIconColor, + onClickText = onClickClearText ) } @@ -48,10 +53,12 @@ private fun PlanzIconAndTextAppBar( modifier: Modifier = Modifier, title: String, menu: PlanzAppBarMenu, - onClickIcon: () -> Unit, + onClickNavigationIcon: () -> Unit, + actionMenu: PlanzAppBarMenu, + onClickActionIcon: () -> Unit, textIconTitle: String, textIconColor: Color, - onclickTextIcon: () -> Unit + onClickText: () -> Unit ) { Box( modifier = modifier @@ -67,7 +74,7 @@ private fun PlanzIconAndTextAppBar( modifier = Modifier .padding(start = menu.horizontalPadding) .clip(RoundedCornerShape(30.dp)) - .clickable { onClickIcon() } + .clickable { onClickNavigationIcon() } .align(Alignment.CenterStart), ) @@ -84,15 +91,30 @@ private fun PlanzIconAndTextAppBar( overflow = TextOverflow.Ellipsis ) - Text( - text = textIconTitle, - style = PlanzTypography.caption, - color = textIconColor, + Row( modifier = Modifier - .padding(end = 20.dp) .align(Alignment.CenterEnd) - .clickable { onclickTextIcon() } - ) + .padding(end = 20.dp), + horizontalArrangement = Arrangement.spacedBy(8.dp) + ) { + + Icon( + modifier = Modifier.clickable { onClickActionIcon() }, + painter = painterResource(actionMenu.icon), + tint = Color.Unspecified, + contentDescription = stringResource(menu.contentDescription), + ) + + Text( + modifier = Modifier + .align(Alignment.CenterVertically) + .clickable { onClickText() }, + text = textIconTitle, + style = PlanzTypography.caption, + color = textIconColor, + textAlign = TextAlign.Center, + ) + } } } @@ -102,9 +124,11 @@ fun PlanzIconAndTextAppBarPreview() { PlanzIconAndTextAppBar( title = "약속응답", menu = PlanzAppBarMenu.BACK, - onClickIcon = {}, + onClickNavigationIcon = {}, + onClickActionIcon = {}, + actionMenu = PlanzAppBarMenu.USER, textIconTitle = stringResource(id = R.string.respond_plan_clear_select_text), textIconColor = MainPurple900, - onclickTextIcon = {} + onClickText = {} ) } diff --git a/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzMenuAppBar.kt b/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzMenuAppBar.kt index 81ed2f9f..69f4ea59 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzMenuAppBar.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzMenuAppBar.kt @@ -82,7 +82,7 @@ fun PlanzMenuAppBar( Row( modifier = Modifier.align(Alignment.CenterEnd), - horizontalArrangement = Arrangement.spacedBy(6.dp) + horizontalArrangement = Arrangement.spacedBy(8.dp) ) { actionMenus.forEachIndexed { index, menu -> Icon( From 587e0f9e5ec3c4c20881f070cfc591f96ed4dabd Mon Sep 17 00:00:00 2001 From: KwonDae Date: Wed, 3 Aug 2022 16:05:25 +0900 Subject: [PATCH 02/15] =?UTF-8?q?feat=20:=20=EC=95=BD=EC=86=8D=20=EC=9D=91?= =?UTF-8?q?=EB=8B=B5=20=ED=99=94=EB=A9=B4=EC=97=90=EC=84=9C=20=EA=B3=B5?= =?UTF-8?q?=EC=9C=A0=ED=95=98=EA=B8=B0=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/main/respond/RespondPlanContract.kt | 1 + .../ui/main/respond/RespondPlanScreen.kt | 16 ++++++++++++++-- .../ui/main/respond/RespondPlanViewModel.kt | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanContract.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanContract.kt index 7d4eb9c4..b75c0a4f 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanContract.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanContract.kt @@ -28,6 +28,7 @@ class RespondPlanContract { Category(0,"",""), ), val clickCount: Int = 0, + val planId: Long = -1, ) : ViewState sealed class RespondPlanSideEffect : ViewSideEffect { diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanScreen.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanScreen.kt index 5bd2283d..24d08fd8 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanScreen.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanScreen.kt @@ -11,17 +11,20 @@ import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.constraintlayout.compose.ConstraintLayout import androidx.constraintlayout.compose.Dimension import androidx.hilt.navigation.compose.hiltViewModel import com.yapp.growth.base.LoadState +import com.yapp.growth.presentation.BuildConfig import com.yapp.growth.presentation.R import com.yapp.growth.presentation.component.* +import com.yapp.growth.presentation.firebase.SchemeType +import com.yapp.growth.presentation.firebase.onDynamicLinkClick import com.yapp.growth.presentation.theme.Gray300 import com.yapp.growth.presentation.theme.Gray500 -import com.yapp.growth.presentation.theme.MainPurple900 import com.yapp.growth.presentation.ui.main.respond.RespondPlanContract.RespondPlanEvent import com.yapp.growth.presentation.ui.main.respond.RespondPlanContract.RespondPlanSideEffect @@ -34,15 +37,24 @@ fun RespondPlanScreen( ) { val uiState by viewModel.viewState.collectAsState() val timeCheckedOfDays by viewModel.timeCheckedOfDays.collectAsState() + val context = LocalContext.current Scaffold( topBar = { PlanzBackAndClearAppBar( title = if (uiState.loadState == LoadState.SUCCESS) uiState.timeTable.promisingName else stringResource(R.string.respond_plan_title), onClickBackIcon = { viewModel.setEvent(RespondPlanEvent.OnClickBackButton) }, + onClickUserIcon = { onDynamicLinkClick( + context, SchemeType.RESPOND, + uiState.planId.toString(), + thumbNailTitle = context.getString(R.string.share_thumbnail_title), + thumbNailDescription = context.getString(R.string.share_thumbnail_description), + thumbNailImageUrl = BuildConfig.BASE_URL + context.getString(R.string.share_plan_share_feed_template_image_url) + ) }, textIconTitle = stringResource(id = R.string.respond_plan_clear_select_text), textIconColor = Gray500, - onClickClearIcon = { viewModel.setEvent(RespondPlanEvent.OnClickClearButton) } + onClickClearText = { viewModel.setEvent(RespondPlanEvent.OnClickClearButton) }, + clickable = uiState.clickCount > 0, ) } ) { padding -> diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanViewModel.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanViewModel.kt index d78976c4..31e96117 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanViewModel.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanViewModel.kt @@ -44,6 +44,7 @@ class RespondPlanViewModel @Inject constructor( init { loadRespondUsers(planId) + updateState { copy(planId = this@RespondPlanViewModel.planId) } } private fun loadRespondUsers(planId: Long) { From 484bb133a13e2460eae8e679661db2319c40bd54 Mon Sep 17 00:00:00 2001 From: KwonDae Date: Wed, 3 Aug 2022 16:39:37 +0900 Subject: [PATCH 03/15] =?UTF-8?q?feat=20:=20=ED=85=8D=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?+=20=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=9C=A0=EB=8F=99?= =?UTF-8?q?=EC=A0=81=EC=9D=B4=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/component/PlanzAppBar.kt | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzAppBar.kt b/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzAppBar.kt index d181a2ab..422c5af1 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzAppBar.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzAppBar.kt @@ -56,14 +56,15 @@ fun PlanzExitAppBar( fun PlanzColorTextWithExitAppBar( modifier: Modifier = Modifier, title: String, - onExitClick: () -> Unit, + onClickExitIcon: () -> Unit, + onClickShareIcon: () -> Unit, isLoading: Boolean, ) { PlanzColorTextAppBar( modifier = modifier, title = title, - menu = PlanzAppBarMenu.EXIT, - onMenuClick = onExitClick, + actionMenus = listOf(PlanzAppBarMenu.SHARE, PlanzAppBarMenu.EXIT), + onClickActionIcons = listOf(onClickShareIcon, onClickExitIcon), isLoading = isLoading ) } @@ -139,8 +140,8 @@ private fun PlanzAppBar( private fun PlanzColorTextAppBar( modifier: Modifier = Modifier, title: String, - menu: PlanzAppBarMenu? = null, - onMenuClick: () -> Unit, + actionMenus: List, + onClickActionIcons: List<() -> Unit>, isLoading: Boolean = false, ) { if (isLoading) { @@ -176,16 +177,20 @@ private fun PlanzColorTextAppBar( maxLines = 1, ) - if (menu != null) { - Icon( - imageVector = ImageVector.vectorResource(id = menu.icon), - tint = Color.Unspecified, - contentDescription = stringResource(id = menu.contentDescription), - modifier = Modifier - .clip(RoundedCornerShape(30.dp)) - .clickable { onMenuClick() } - .align(Alignment.CenterEnd), - ) + Row( + modifier = Modifier.align(Alignment.CenterEnd), + horizontalArrangement = Arrangement.spacedBy(8.dp) + ) { + actionMenus.forEachIndexed { index, menu -> + Icon( + modifier = Modifier + .clip(RoundedCornerShape(30.dp)) + .clickable { onClickActionIcons[index]() }, + imageVector = ImageVector.vectorResource(menu.icon), + tint = Color.Unspecified, + contentDescription = stringResource(menu.contentDescription) + ) + } } } } @@ -214,7 +219,8 @@ fun PlanzExitAppBarPreview() { fun PreviewPlanzColorTextWithExitAppBar() { PlanzColorTextWithExitAppBar( title = "식사", - onExitClick = { }, - isLoading = true + onClickShareIcon = {}, + onClickExitIcon = {}, + isLoading = false ) } From 5d92631553679dd3d9dd3fdc19a4766e3b350167 Mon Sep 17 00:00:00 2001 From: KwonDae Date: Wed, 3 Aug 2022 16:40:21 +0900 Subject: [PATCH 04/15] =?UTF-8?q?feat=20:=20=EC=95=BD=EC=86=8D=EC=9D=91?= =?UTF-8?q?=EB=8B=B5=20=EC=95=B1=EB=B0=94(=EC=95=84=EC=9D=B4=EC=BD=98=20+?= =?UTF-8?q?=20=ED=85=8D=EC=8A=A4=ED=8A=B8=20+=20=EC=95=84=EC=9D=B4?= =?UTF-8?q?=EC=BD=98,=20=ED=85=8D=EC=8A=A4=ED=8A=B8)=20=EB=94=94=EC=9E=90?= =?UTF-8?q?=EC=9D=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/PlanzTextMenuAppBar.kt | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 presentation/src/main/java/com/yapp/growth/presentation/component/PlanzTextMenuAppBar.kt diff --git a/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzTextMenuAppBar.kt b/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzTextMenuAppBar.kt new file mode 100644 index 00000000..e0889487 --- /dev/null +++ b/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzTextMenuAppBar.kt @@ -0,0 +1,136 @@ +package com.yapp.growth.presentation.component + +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.Icon +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.yapp.growth.presentation.R +import com.yapp.growth.presentation.component.type.PlanzAppBarMenu +import com.yapp.growth.presentation.theme.Gray900 +import com.yapp.growth.presentation.theme.MainPurple900 +import com.yapp.growth.presentation.theme.PlanzTypography + + +@Composable +fun PlanzBackAndClearAppBar( + modifier: Modifier = Modifier, + title: String, + onClickBackIcon: () -> Unit, + onClickUserIcon: () -> Unit, + textIconTitle: String, + textIconColor: Color, + onClickClearText: () -> Unit, + clickable: Boolean, +) { + PlanzIconAndTextAppBar( + title = title, + menu = PlanzAppBarMenu.BACK, + onClickNavigationIcon = onClickBackIcon, + actionMenu = PlanzAppBarMenu.SHARE, + onClickActionIcon = onClickUserIcon, + textIconTitle = textIconTitle, + textIconColor = if (clickable) MainPurple900 else textIconColor, + onClickText = onClickClearText + ) +} + +@Composable +private fun PlanzIconAndTextAppBar( + modifier: Modifier = Modifier, + title: String, + menu: PlanzAppBarMenu, + onClickNavigationIcon: () -> Unit, + actionMenu: PlanzAppBarMenu, + onClickActionIcon: () -> Unit, + textIconTitle: String, + textIconColor: Color, + onClickText: () -> Unit +) { + Box( + modifier = modifier + .fillMaxWidth() + .wrapContentHeight() + .padding(top = 20.dp, bottom = 16.dp) + ) { + + Icon( + imageVector = ImageVector.vectorResource(id = menu.icon), + tint = Color.Unspecified, + contentDescription = stringResource(id = menu.contentDescription), + modifier = Modifier + .padding(start = menu.horizontalPadding) + .clip(RoundedCornerShape(30.dp)) + .clickable { onClickNavigationIcon() } + .align(Alignment.CenterStart), + ) + + Text( + text = title, + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = menu.horizontalPadding) + .align(Alignment.Center), + textAlign = TextAlign.Center, + style = PlanzTypography.h3, + color = Gray900, + maxLines = 1, + overflow = TextOverflow.Ellipsis + ) + + Row( + modifier = Modifier + .align(Alignment.CenterEnd) + .padding(end = 20.dp), + horizontalArrangement = Arrangement.spacedBy(8.dp) + ) { + + Icon( + modifier = Modifier + .clip(RoundedCornerShape(30.dp)) + .clickable { onClickActionIcon() }, + imageVector = ImageVector.vectorResource(actionMenu.icon), + tint = Color.Unspecified, + contentDescription = stringResource(menu.contentDescription), + ) + + Text( + modifier = Modifier + .align(Alignment.CenterVertically) + .clickable { onClickText() }, + text = textIconTitle, + style = PlanzTypography.caption, + color = textIconColor, + textAlign = TextAlign.Center, + ) + } + } +} + +@Preview(showBackground = true) +@Composable +fun PlanzIconAndTextAppBarPreview() { + PlanzIconAndTextAppBar( + title = "약속응답", + menu = PlanzAppBarMenu.BACK, + onClickNavigationIcon = {}, + onClickActionIcon = {}, + actionMenu = PlanzAppBarMenu.USER, + textIconTitle = stringResource(id = R.string.respond_plan_clear_select_text), + textIconColor = MainPurple900, + onClickText = {} + ) +} From d81001b0ab0e3bc074b70485a85808b2635e439d Mon Sep 17 00:00:00 2001 From: KwonDae Date: Wed, 3 Aug 2022 16:40:46 +0900 Subject: [PATCH 05/15] =?UTF-8?q?fix=20:=20=EB=8B=A4=EC=9D=B4=EB=82=98?= =?UTF-8?q?=EB=AF=B9=20=EB=A7=81=ED=81=AC=20=ED=8C=8C=EB=9D=BC=EB=AF=B8?= =?UTF-8?q?=ED=84=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/PlanzIconAndTextAppBar.kt | 134 ------------------ .../presentation/firebase/DynamicLink.kt | 9 +- 2 files changed, 5 insertions(+), 138 deletions(-) delete mode 100644 presentation/src/main/java/com/yapp/growth/presentation/component/PlanzIconAndTextAppBar.kt diff --git a/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzIconAndTextAppBar.kt b/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzIconAndTextAppBar.kt deleted file mode 100644 index f5186465..00000000 --- a/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzIconAndTextAppBar.kt +++ /dev/null @@ -1,134 +0,0 @@ -package com.yapp.growth.presentation.component - -import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.* -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material.Icon -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.res.painterResource -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.res.vectorResource -import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.text.style.TextOverflow -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import com.yapp.growth.presentation.R -import com.yapp.growth.presentation.component.type.PlanzAppBarMenu -import com.yapp.growth.presentation.theme.Gray900 -import com.yapp.growth.presentation.theme.MainPurple900 -import com.yapp.growth.presentation.theme.PlanzTypography - - -@Composable -fun PlanzBackAndClearAppBar( - modifier: Modifier = Modifier, - title: String, - onClickBackIcon: () -> Unit, - onClickUserIcon: () -> Unit, - textIconTitle: String, - textIconColor: Color, - onClickClearText: () -> Unit, - clickable: Boolean, -) { - PlanzIconAndTextAppBar( - title = title, - menu = PlanzAppBarMenu.BACK, - onClickNavigationIcon = onClickBackIcon, - actionMenu = PlanzAppBarMenu.USER, - onClickActionIcon = onClickUserIcon, - textIconTitle = textIconTitle, - textIconColor = if (clickable) MainPurple900 else textIconColor, - onClickText = onClickClearText - ) -} - -@Composable -private fun PlanzIconAndTextAppBar( - modifier: Modifier = Modifier, - title: String, - menu: PlanzAppBarMenu, - onClickNavigationIcon: () -> Unit, - actionMenu: PlanzAppBarMenu, - onClickActionIcon: () -> Unit, - textIconTitle: String, - textIconColor: Color, - onClickText: () -> Unit -) { - Box( - modifier = modifier - .fillMaxWidth() - .wrapContentHeight() - .padding(top = 20.dp, bottom = 16.dp) - ) { - - Icon( - imageVector = ImageVector.vectorResource(id = menu.icon), - tint = Color.Unspecified, - contentDescription = stringResource(id = menu.contentDescription), - modifier = Modifier - .padding(start = menu.horizontalPadding) - .clip(RoundedCornerShape(30.dp)) - .clickable { onClickNavigationIcon() } - .align(Alignment.CenterStart), - ) - - Text( - text = title, - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = menu.horizontalPadding) - .align(Alignment.Center), - textAlign = TextAlign.Center, - style = PlanzTypography.h3, - color = Gray900, - maxLines = 1, - overflow = TextOverflow.Ellipsis - ) - - Row( - modifier = Modifier - .align(Alignment.CenterEnd) - .padding(end = 20.dp), - horizontalArrangement = Arrangement.spacedBy(8.dp) - ) { - - Icon( - modifier = Modifier.clickable { onClickActionIcon() }, - painter = painterResource(actionMenu.icon), - tint = Color.Unspecified, - contentDescription = stringResource(menu.contentDescription), - ) - - Text( - modifier = Modifier - .align(Alignment.CenterVertically) - .clickable { onClickText() }, - text = textIconTitle, - style = PlanzTypography.caption, - color = textIconColor, - textAlign = TextAlign.Center, - ) - } - } -} - -@Preview(showBackground = true) -@Composable -fun PlanzIconAndTextAppBarPreview() { - PlanzIconAndTextAppBar( - title = "약속응답", - menu = PlanzAppBarMenu.BACK, - onClickNavigationIcon = {}, - onClickActionIcon = {}, - actionMenu = PlanzAppBarMenu.USER, - textIconTitle = stringResource(id = R.string.respond_plan_clear_select_text), - textIconColor = MainPurple900, - onClickText = {} - ) -} diff --git a/presentation/src/main/java/com/yapp/growth/presentation/firebase/DynamicLink.kt b/presentation/src/main/java/com/yapp/growth/presentation/firebase/DynamicLink.kt index 0a1c09f6..2cc46063 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/firebase/DynamicLink.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/firebase/DynamicLink.kt @@ -7,6 +7,7 @@ import android.net.Uri import com.google.firebase.dynamiclinks.ktx.* import com.google.firebase.ktx.Firebase import com.yapp.growth.presentation.BuildConfig +import com.yapp.growth.presentation.R const val DYNAMIC_LINK_PARAM = "dynamic_link_param" const val PLAN_ID_KEY_NAME = "planId" @@ -21,11 +22,11 @@ fun getDeepLink(scheme: String, key: String?, id: String?): Uri { fun onDynamicLinkClick( context: Context, - scheme: SchemeType, + scheme: SchemeType = SchemeType.RESPOND, id: String? = null, - thumbNailTitle: String, - thumbNailDescription: String, - thumbNailImageUrl: String, + thumbNailTitle: String = context.getString(R.string.share_thumbnail_title), + thumbNailDescription: String = context.getString(R.string.share_thumbnail_description), + thumbNailImageUrl: String = BuildConfig.BASE_URL + context.getString(R.string.share_plan_share_feed_template_image_url), ) { Firebase.dynamicLinks.shortLinkAsync { link = getDeepLink(scheme.name, scheme.key, id) From f2991c343dc4c190cfa58890369bc6118c149109 Mon Sep 17 00:00:00 2001 From: KwonDae Date: Wed, 3 Aug 2022 16:41:01 +0900 Subject: [PATCH 06/15] =?UTF-8?q?fix=20:=20=EC=95=BD=EC=86=8D=20=ED=99=95?= =?UTF-8?q?=EC=A0=95=EC=97=90=EC=84=9C=20=EB=8B=A4=EC=9D=B4=EB=82=98?= =?UTF-8?q?=EB=AF=B9=20=EB=A7=81=ED=81=AC=20=ED=8C=8C=EB=9D=BC=EB=AF=B8?= =?UTF-8?q?=ED=84=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yapp/growth/presentation/ui/main/fix/FixPlanScreen.kt | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanScreen.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanScreen.kt index f8200739..07009ed2 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanScreen.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanScreen.kt @@ -71,13 +71,7 @@ fun FixPlanScreen( onClickBackIcon = { viewModel.setEvent(FixPlanEvent.OnClickBackButton) }, onClickUserIcon = { viewModel.setEvent(FixPlanEvent.OnClickUserIcon)}, onClickShareIcon = { - onDynamicLinkClick( - context, SchemeType.RESPOND, - uiState.planId.toString(), - thumbNailTitle = context.getString(R.string.share_thumbnail_title), - thumbNailDescription = context.getString(R.string.share_thumbnail_description), - thumbNailImageUrl = BuildConfig.BASE_URL + context.getString(R.string.share_plan_share_feed_template_image_url) - ) + onDynamicLinkClick(context = context, id = uiState.planId.toString()) } ) } From 3596127c266b81b065c60321f8a5e64febfc06f2 Mon Sep 17 00:00:00 2001 From: KwonDae Date: Wed, 3 Aug 2022 16:42:03 +0900 Subject: [PATCH 07/15] =?UTF-8?q?feat=20:=20=EC=95=BD=EC=86=8D=20=ED=98=84?= =?UTF-8?q?=ED=99=A9=EC=97=90=EC=84=9C=20=EA=B3=B5=EC=9C=A0=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/ui/main/monitor/MonitorPlanContract.kt | 1 + .../presentation/ui/main/monitor/MonitorPlanScreen.kt | 7 +++++-- .../presentation/ui/main/monitor/MonitorPlanViewModel.kt | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanContract.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanContract.kt index 80c59857..1bb005ed 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanContract.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanContract.kt @@ -32,6 +32,7 @@ class MonitorPlanContract { ), val currentClickTimeIndex: Pair = -1 to -1, val currentClickUserData: List = emptyList(), + val planId: Long = -1, ) : ViewState { enum class BottomSheet { HIDE, diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanScreen.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanScreen.kt index 7aa0110a..50cd1670 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanScreen.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanScreen.kt @@ -11,6 +11,7 @@ import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp @@ -22,11 +23,11 @@ import com.yapp.growth.domain.entity.TimeTable import com.yapp.growth.domain.entity.User import com.yapp.growth.presentation.R import com.yapp.growth.presentation.component.* +import com.yapp.growth.presentation.firebase.onDynamicLinkClick import com.yapp.growth.presentation.theme.Gray800 import com.yapp.growth.presentation.theme.Gray900 import com.yapp.growth.presentation.theme.MainPurple900 import com.yapp.growth.presentation.theme.PlanzTypography -import com.yapp.growth.presentation.ui.main.fix.FixPlanContract import com.yapp.growth.presentation.ui.main.monitor.MonitorPlanContract.MonitorPlanEvent import com.yapp.growth.presentation.ui.main.monitor.MonitorPlanContract.MonitorPlanSideEffect import kotlinx.coroutines.launch @@ -38,6 +39,7 @@ fun MonitorPlanScreen( ) { val coroutineScope = rememberCoroutineScope() val uiState by viewModel.viewState.collectAsState() + val context = LocalContext.current val sheetState = rememberBottomSheetState( initialValue = BottomSheetValue.Collapsed ) @@ -66,7 +68,8 @@ fun MonitorPlanScreen( title = if (uiState.loadState == LoadState.SUCCESS) uiState.timeTable.promisingName else stringResource( R.string.monitor_plan_title ), - onExitClick = { viewModel.setEvent(MonitorPlanEvent.OnClickBackButton) }, + onClickShareIcon = { onDynamicLinkClick(context = context, id = uiState.planId.toString()) }, + onClickExitIcon = { viewModel.setEvent(MonitorPlanEvent.OnClickBackButton) }, isLoading = uiState.loadState == LoadState.LOADING ) } diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanViewModel.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanViewModel.kt index 42b22df8..b8a687ce 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanViewModel.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanViewModel.kt @@ -45,6 +45,7 @@ class MonitorPlanViewModel @Inject constructor( init { loadRespondUsers(planId) + updateState { copy(planId = this@MonitorPlanViewModel.planId) } } private fun loadRespondUsers(planId: Long) { From d21ebdfe8c5c829f70f19d2e366bc68d1e56d85e Mon Sep 17 00:00:00 2001 From: KwonDae Date: Wed, 3 Aug 2022 16:44:58 +0900 Subject: [PATCH 08/15] =?UTF-8?q?fix=20:=20=EC=9D=91=EB=8B=B5=ED=99=94?= =?UTF-8?q?=EB=A9=B4=20=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/component/PlanzTextMenuAppBar.kt | 5 ++--- .../presentation/ui/main/respond/RespondPlanScreen.kt | 10 +--------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzTextMenuAppBar.kt b/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzTextMenuAppBar.kt index e0889487..7071e4a0 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzTextMenuAppBar.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzTextMenuAppBar.kt @@ -11,7 +11,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource import androidx.compose.ui.text.style.TextAlign @@ -30,7 +29,7 @@ fun PlanzBackAndClearAppBar( modifier: Modifier = Modifier, title: String, onClickBackIcon: () -> Unit, - onClickUserIcon: () -> Unit, + onClickShareIcon: () -> Unit, textIconTitle: String, textIconColor: Color, onClickClearText: () -> Unit, @@ -41,7 +40,7 @@ fun PlanzBackAndClearAppBar( menu = PlanzAppBarMenu.BACK, onClickNavigationIcon = onClickBackIcon, actionMenu = PlanzAppBarMenu.SHARE, - onClickActionIcon = onClickUserIcon, + onClickActionIcon = onClickShareIcon, textIconTitle = textIconTitle, textIconColor = if (clickable) MainPurple900 else textIconColor, onClickText = onClickClearText diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanScreen.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanScreen.kt index 24d08fd8..c85a5057 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanScreen.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanScreen.kt @@ -18,10 +18,8 @@ import androidx.constraintlayout.compose.ConstraintLayout import androidx.constraintlayout.compose.Dimension import androidx.hilt.navigation.compose.hiltViewModel import com.yapp.growth.base.LoadState -import com.yapp.growth.presentation.BuildConfig import com.yapp.growth.presentation.R import com.yapp.growth.presentation.component.* -import com.yapp.growth.presentation.firebase.SchemeType import com.yapp.growth.presentation.firebase.onDynamicLinkClick import com.yapp.growth.presentation.theme.Gray300 import com.yapp.growth.presentation.theme.Gray500 @@ -44,13 +42,7 @@ fun RespondPlanScreen( PlanzBackAndClearAppBar( title = if (uiState.loadState == LoadState.SUCCESS) uiState.timeTable.promisingName else stringResource(R.string.respond_plan_title), onClickBackIcon = { viewModel.setEvent(RespondPlanEvent.OnClickBackButton) }, - onClickUserIcon = { onDynamicLinkClick( - context, SchemeType.RESPOND, - uiState.planId.toString(), - thumbNailTitle = context.getString(R.string.share_thumbnail_title), - thumbNailDescription = context.getString(R.string.share_thumbnail_description), - thumbNailImageUrl = BuildConfig.BASE_URL + context.getString(R.string.share_plan_share_feed_template_image_url) - ) }, + onClickShareIcon = { onDynamicLinkClick(context = context, id = uiState.planId.toString()) }, textIconTitle = stringResource(id = R.string.respond_plan_clear_select_text), textIconColor = Gray500, onClickClearText = { viewModel.setEvent(RespondPlanEvent.OnClickClearButton) }, From fbcf3b50a98d857eea34b4342159b610870896b7 Mon Sep 17 00:00:00 2001 From: KwonDae Date: Wed, 3 Aug 2022 17:56:11 +0900 Subject: [PATCH 09/15] =?UTF-8?q?design=20:=20=EB=82=A0=EC=A7=9C=20?= =?UTF-8?q?=EC=9D=B8=EB=94=94=EC=BC=80=EC=9D=B4=ED=84=B0=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../res/drawable/ic_indicator_left_24.xml | 22 +++++++++++++++++++ .../drawable/ic_indicator_left_disable_24.xml | 22 +++++++++++++++++++ .../res/drawable/ic_indicator_right_24.xml | 22 +++++++++++++++++++ .../ic_indicator_right_disable_24.xml | 22 +++++++++++++++++++ 4 files changed, 88 insertions(+) create mode 100644 presentation/src/main/res/drawable/ic_indicator_left_24.xml create mode 100644 presentation/src/main/res/drawable/ic_indicator_left_disable_24.xml create mode 100644 presentation/src/main/res/drawable/ic_indicator_right_24.xml create mode 100644 presentation/src/main/res/drawable/ic_indicator_right_disable_24.xml diff --git a/presentation/src/main/res/drawable/ic_indicator_left_24.xml b/presentation/src/main/res/drawable/ic_indicator_left_24.xml new file mode 100644 index 00000000..114e048d --- /dev/null +++ b/presentation/src/main/res/drawable/ic_indicator_left_24.xml @@ -0,0 +1,22 @@ + + + + + diff --git a/presentation/src/main/res/drawable/ic_indicator_left_disable_24.xml b/presentation/src/main/res/drawable/ic_indicator_left_disable_24.xml new file mode 100644 index 00000000..1da1e7d8 --- /dev/null +++ b/presentation/src/main/res/drawable/ic_indicator_left_disable_24.xml @@ -0,0 +1,22 @@ + + + + + diff --git a/presentation/src/main/res/drawable/ic_indicator_right_24.xml b/presentation/src/main/res/drawable/ic_indicator_right_24.xml new file mode 100644 index 00000000..e2e04c48 --- /dev/null +++ b/presentation/src/main/res/drawable/ic_indicator_right_24.xml @@ -0,0 +1,22 @@ + + + + + diff --git a/presentation/src/main/res/drawable/ic_indicator_right_disable_24.xml b/presentation/src/main/res/drawable/ic_indicator_right_disable_24.xml new file mode 100644 index 00000000..b6e7d661 --- /dev/null +++ b/presentation/src/main/res/drawable/ic_indicator_right_disable_24.xml @@ -0,0 +1,22 @@ + + + + + From 663216fff2bb047296e362d2552e901cb70f76de Mon Sep 17 00:00:00 2001 From: KwonDae Date: Wed, 3 Aug 2022 17:57:18 +0900 Subject: [PATCH 10/15] =?UTF-8?q?feat=20:=20=EB=82=A0=EC=A7=9C=20=EC=9D=B8?= =?UTF-8?q?=EB=94=94=EC=BC=80=EC=9D=B4=ED=84=B0=20=EC=83=81=ED=83=9C=20?= =?UTF-8?q?=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/component/PlanzIndicator.kt | 59 ++++++++++++------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzIndicator.kt b/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzIndicator.kt index 2c4e5749..2fb08feb 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzIndicator.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/component/PlanzIndicator.kt @@ -17,8 +17,9 @@ import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.RectangleShape -import androidx.compose.ui.res.painterResource +import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.stringResource +import androidx.compose.ui.res.vectorResource import androidx.compose.ui.unit.dp import androidx.constraintlayout.compose.ConstraintLayout import androidx.constraintlayout.compose.Dimension @@ -34,7 +35,9 @@ fun PlanzPlanDateIndicator( modifier: Modifier = Modifier, timeTable: TimeTable, onClickNextDayButton: () -> Unit, - onClickPreviousDayButton: () -> Unit + onClickPreviousDayButton: () -> Unit, + enablePrev: Boolean, + enableNext: Boolean, ) { Box( @@ -59,9 +62,11 @@ fun PlanzPlanDateIndicator( bottom.linkTo(parent.bottom) }) { - PlanzPlanPreviousDayButton(onClick = { - onClickPreviousDayButton() - }) + PlanzPlanPreviousDayButton( + enablePrev = enablePrev, + onClick = { + onClickPreviousDayButton() + }) } LazyRow( @@ -90,9 +95,11 @@ fun PlanzPlanDateIndicator( bottom.linkTo(parent.bottom) }) { - PlanzPlanNextDayButton(onClick = { - onClickNextDayButton() - }) + PlanzPlanNextDayButton( + enableNext = enableNext, + onClick = { + onClickNextDayButton() + }) } } } @@ -104,7 +111,9 @@ fun CreateTimeTableDateIndicator( modifier: Modifier = Modifier, createTimeTable: CreateTimeTable, onClickNextDayButton: () -> Unit, - onClickPreviousDayButton: () -> Unit + onClickPreviousDayButton: () -> Unit, + enablePrev: Boolean, + enableNext: Boolean, ) { val borderSize = 1.dp val borderColor = Gray300 @@ -136,9 +145,11 @@ fun CreateTimeTableDateIndicator( bottom.linkTo(parent.bottom) }) { - PlanzPlanPreviousDayButton(onClick = { - onClickPreviousDayButton() - }) + PlanzPlanPreviousDayButton( + enablePrev = enablePrev, + onClick = { + onClickPreviousDayButton() + }) } LazyRow( @@ -167,9 +178,11 @@ fun CreateTimeTableDateIndicator( bottom.linkTo(parent.bottom) }) { - PlanzPlanNextDayButton(onClick = { - onClickNextDayButton() - }) + PlanzPlanNextDayButton( + enableNext = enableNext, + onClick = { + onClickNextDayButton() + }) } } } @@ -177,9 +190,9 @@ fun CreateTimeTableDateIndicator( } @Composable -fun PlanzPlanPreviousDayButton(onClick: () -> Unit) { +fun PlanzPlanPreviousDayButton(enablePrev: Boolean, onClick: () -> Unit) { Icon( - painter = painterResource(id = R.drawable.ic_arrow_box_left_24), + imageVector = if (enablePrev) ImageVector.vectorResource(R.drawable.ic_indicator_left_24) else ImageVector.vectorResource(R.drawable.ic_indicator_left_disable_24), contentDescription = stringResource(id = R.string.icon_arrow_box_left_24_content_description), tint = Color.Unspecified, modifier = Modifier.clickable { @@ -189,9 +202,9 @@ fun PlanzPlanPreviousDayButton(onClick: () -> Unit) { } @Composable -fun PlanzPlanNextDayButton(onClick: () -> Unit) { +fun PlanzPlanNextDayButton(enableNext: Boolean, onClick: () -> Unit) { Icon( - painter = painterResource(id = R.drawable.ic_arrow_box_right_24), + imageVector = if (enableNext) ImageVector.vectorResource(R.drawable.ic_indicator_right_24) else ImageVector.vectorResource(R.drawable.ic_indicator_right_disable_24), contentDescription = stringResource(id = R.string.icon_arrow_box_right_24_content_description), tint = Color.Unspecified, modifier = Modifier.clickable { @@ -236,14 +249,18 @@ fun CreateTimeTableDayText(date: String) { text = date.toDayOfWeek(), color = Gray800, style = PlanzTypography.caption, - modifier = Modifier.wrapContentSize().align(Alignment.CenterHorizontally) + modifier = Modifier + .wrapContentSize() + .align(Alignment.CenterHorizontally) ) Text( text = date.toDay(), color = MainPurple900, style = PlanzTypography.body2, - modifier = Modifier.wrapContentSize().align(Alignment.CenterHorizontally) + modifier = Modifier + .wrapContentSize() + .align(Alignment.CenterHorizontally) ) } } From 5120e0d44c76fe6d3fe18bcf431c52d8c5bc5534 Mon Sep 17 00:00:00 2001 From: KwonDae Date: Wed, 3 Aug 2022 17:57:37 +0900 Subject: [PATCH 11/15] =?UTF-8?q?feat=20:=20=EC=95=BD=EC=86=8D=20=ED=99=95?= =?UTF-8?q?=EC=A0=95=20=EB=82=A0=EC=A7=9C=20=EC=9D=B8=EB=94=94=EC=BC=80?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=83=81=ED=83=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../growth/presentation/ui/main/fix/FixPlanContract.kt | 2 ++ .../growth/presentation/ui/main/fix/FixPlanScreen.kt | 4 +++- .../growth/presentation/ui/main/fix/FixPlanViewModel.kt | 9 ++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanContract.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanContract.kt index e7e7b2d6..f126a6b7 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanContract.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanContract.kt @@ -31,6 +31,8 @@ class FixPlanContract { ), val currentClickTimeIndex: Pair = -1 to -1, val currentClickUserData: List = emptyList(), + val enablePrev: Boolean = false, + val enableNext: Boolean = true, val planId: Long = -1, ) : ViewState { enum class BottomSheet { diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanScreen.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanScreen.kt index 07009ed2..6eba26cf 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanScreen.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanScreen.kt @@ -108,7 +108,9 @@ fun FixPlanScreen( PlanzPlanDateIndicator( timeTable = uiState.timeTable, onClickPreviousDayButton = { viewModel.setEvent(FixPlanEvent.OnClickPreviousDayButton) }, - onClickNextDayButton = { viewModel.setEvent(FixPlanEvent.OnClickNextDayButton) } + onClickNextDayButton = { viewModel.setEvent(FixPlanEvent.OnClickNextDayButton) }, + enablePrev = uiState.enablePrev, + enableNext = uiState.enableNext, ) FixPlanTimeTable( diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanViewModel.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanViewModel.kt index ac1f2b36..231b7c93 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanViewModel.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanViewModel.kt @@ -53,6 +53,8 @@ class FixPlanViewModel @Inject constructor( respondents = it.users, loadState = LoadState.SUCCESS, timeTable = sliceTimeTable, + enablePrev = false, + enableNext = originalTable.availableDates.size > 4 ) } } @@ -81,6 +83,7 @@ class FixPlanViewModel @Inject constructor( val fromIndex = currentIndex.times(4) if (fromIndex >= originalTable.availableDates.size) { currentIndex -= 1 + updateState { copy(enableNext = false) } return@launch } @@ -96,7 +99,7 @@ class FixPlanViewModel @Inject constructor( ) ) updateState { - copy(timeTable = sliceCreateTimeTable) + copy(enablePrev = true, enableNext = toIndex < originalTable.availableDates.size, timeTable = sliceCreateTimeTable) } } @@ -106,14 +109,14 @@ class FixPlanViewModel @Inject constructor( val fromIndex = currentIndex.times(4) val toIndex = fromIndex.plus(4) - val temp: TimeTable = originalTable.copy( + val sliceCreateTimeTable: TimeTable = originalTable.copy( availableDates = originalTable.availableDates.subList( fromIndex, toIndex ) ) updateState { - copy(timeTable = temp) + copy(enablePrev = currentIndex != 0, enableNext = true, timeTable = sliceCreateTimeTable) } } From 1a7dbb2410edaf3e51dbc62647fbf1473b97e0e7 Mon Sep 17 00:00:00 2001 From: KwonDae Date: Wed, 3 Aug 2022 18:17:31 +0900 Subject: [PATCH 12/15] =?UTF-8?q?fix=20:=20=EC=95=BD=EC=86=8D=20=ED=99=95?= =?UTF-8?q?=EC=A0=95=20=EC=9D=B8=EB=94=94=EC=BC=80=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=ED=81=B4=EB=A6=AD=EC=8B=9C=20=EB=B0=94=ED=85=80=EC=8B=9C?= =?UTF-8?q?=ED=8A=B8=20=EB=82=B4=EB=A0=A4=EA=B0=80=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../growth/presentation/ui/main/fix/FixPlanContract.kt | 2 +- .../growth/presentation/ui/main/fix/FixPlanViewModel.kt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanContract.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanContract.kt index f126a6b7..3566a1b2 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanContract.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanContract.kt @@ -32,7 +32,7 @@ class FixPlanContract { val currentClickTimeIndex: Pair = -1 to -1, val currentClickUserData: List = emptyList(), val enablePrev: Boolean = false, - val enableNext: Boolean = true, + val enableNext: Boolean = false, val planId: Long = -1, ) : ViewState { enum class BottomSheet { diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanViewModel.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanViewModel.kt index 231b7c93..aad30d4f 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanViewModel.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/fix/FixPlanViewModel.kt @@ -5,7 +5,6 @@ import androidx.lifecycle.viewModelScope import com.yapp.growth.base.BaseViewModel import com.yapp.growth.base.LoadState import com.yapp.growth.domain.entity.Category -import com.yapp.growth.domain.entity.TimeCheckedOfDay import com.yapp.growth.domain.entity.TimeTable import com.yapp.growth.domain.entity.User import com.yapp.growth.domain.onError @@ -51,10 +50,10 @@ class FixPlanViewModel @Inject constructor( updateState { copy( respondents = it.users, - loadState = LoadState.SUCCESS, timeTable = sliceTimeTable, enablePrev = false, - enableNext = originalTable.availableDates.size > 4 + enableNext = originalTable.availableDates.size > 4, + loadState = LoadState.SUCCESS, ) } } @@ -83,7 +82,6 @@ class FixPlanViewModel @Inject constructor( val fromIndex = currentIndex.times(4) if (fromIndex >= originalTable.availableDates.size) { currentIndex -= 1 - updateState { copy(enableNext = false) } return@launch } @@ -141,10 +139,12 @@ class FixPlanViewModel @Inject constructor( FixPlanEvent.OnClickNextDayButton -> { initCurrentClickTimeIndex() nextDay() + sendEffect({ FixPlanSideEffect.HideBottomSheet }) } FixPlanEvent.OnClickPreviousDayButton -> { initCurrentClickTimeIndex() previousDay() + sendEffect({ FixPlanSideEffect.HideBottomSheet }) } FixPlanEvent.OnClickBackButton -> { sendEffect({ FixPlanSideEffect.NavigateToPreviousScreen }) } is FixPlanEvent.OnClickFixButton -> { sendFixPlan(event.date) } From 9a45f14869769f0b27642ea75d4183c2d001b7c6 Mon Sep 17 00:00:00 2001 From: KwonDae Date: Wed, 3 Aug 2022 18:18:09 +0900 Subject: [PATCH 13/15] =?UTF-8?q?feat=20:=20=EC=95=BD=EC=86=8D=20=ED=98=84?= =?UTF-8?q?=ED=99=A9=20=EB=82=A0=EC=A7=9C=20=EC=9D=B8=EB=94=94=EC=BC=80?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EB=B9=84=ED=99=9C=EC=84=B1=ED=99=94=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/main/monitor/MonitorPlanContract.kt | 2 ++ .../ui/main/monitor/MonitorPlanScreen.kt | 4 +++- .../ui/main/monitor/MonitorPlanViewModel.kt | 20 ++++++++++++++----- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanContract.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanContract.kt index 1bb005ed..76d367ac 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanContract.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanContract.kt @@ -32,6 +32,8 @@ class MonitorPlanContract { ), val currentClickTimeIndex: Pair = -1 to -1, val currentClickUserData: List = emptyList(), + val enablePrev: Boolean = false, + val enableNext: Boolean = false, val planId: Long = -1, ) : ViewState { enum class BottomSheet { diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanScreen.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanScreen.kt index 50cd1670..a46744b5 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanScreen.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanScreen.kt @@ -110,7 +110,9 @@ fun MonitorPlanScreen( PlanzPlanDateIndicator( timeTable = uiState.timeTable, onClickPreviousDayButton = { viewModel.setEvent(MonitorPlanEvent.OnClickPreviousDayButton) }, - onClickNextDayButton = { viewModel.setEvent(MonitorPlanEvent.OnClickNextDayButton) } + onClickNextDayButton = { viewModel.setEvent(MonitorPlanEvent.OnClickNextDayButton) }, + enablePrev = uiState.enablePrev, + enableNext = uiState.enableNext, ) FixPlanTimeTable( diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanViewModel.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanViewModel.kt index b8a687ce..dce6dc86 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanViewModel.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/monitor/MonitorPlanViewModel.kt @@ -64,6 +64,8 @@ class MonitorPlanViewModel @Inject constructor( updateState { copy( respondents = it.users, timeTable = sliceTimeTable, + enablePrev = false, + enableNext = originalTable.availableDates.size > 4, loadState = LoadState.SUCCESS ) } } @@ -122,7 +124,7 @@ class MonitorPlanViewModel @Inject constructor( ) ) updateState { - copy(timeTable = sliceCreateTimeTable) + copy(enablePrev = true, enableNext = toIndex < originalTable.availableDates.size, timeTable = sliceCreateTimeTable) } } @@ -133,14 +135,14 @@ class MonitorPlanViewModel @Inject constructor( val fromIndex = currentIndex.times(4) val toIndex = fromIndex.plus(4) - val temp: TimeTable = originalTable.copy( + val sliceCreateTimeTable: TimeTable = originalTable.copy( availableDates = originalTable.availableDates.subList( fromIndex, toIndex ) ) updateState { - copy(timeTable = temp) + copy(enablePrev = currentIndex != 0, enableNext = true, timeTable = sliceCreateTimeTable) } } @@ -151,8 +153,16 @@ class MonitorPlanViewModel @Inject constructor( override fun handleEvents(event: MonitorPlanEvent) { when (event) { MonitorPlanEvent.OnClickBackButton -> sendEffect({ MonitorPlanSideEffect.NavigateToPreviousScreen }) - MonitorPlanEvent.OnClickNextDayButton -> nextDay() - MonitorPlanEvent.OnClickPreviousDayButton -> previousDay() + MonitorPlanEvent.OnClickNextDayButton -> { + initCurrentClickTimeIndex() + nextDay() + sendEffect({ MonitorPlanSideEffect.HideBottomSheet }) + } + MonitorPlanEvent.OnClickPreviousDayButton -> { + initCurrentClickTimeIndex() + previousDay() + sendEffect({ MonitorPlanSideEffect.HideBottomSheet }) + } MonitorPlanEvent.OnClickExitIcon -> sendEffect({ MonitorPlanSideEffect.HideBottomSheet }) is MonitorPlanEvent.OnClickTimeTable -> { updateState { copy( From 78adcfd9e2f305519489d2406b67217da2b5fbc5 Mon Sep 17 00:00:00 2001 From: KwonDae Date: Wed, 3 Aug 2022 18:32:24 +0900 Subject: [PATCH 14/15] =?UTF-8?q?feat=20:=20=EC=95=BD=EC=86=8D=EC=9D=91?= =?UTF-8?q?=EB=8B=B5=20=EB=82=A0=EC=A7=9C=20=EC=9D=B8=EB=94=94=EC=BC=80?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EB=B9=84=ED=99=9C=EC=84=B1=ED=99=94=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/main/respond/RespondPlanContract.kt | 2 ++ .../ui/main/respond/RespondPlanScreen.kt | 4 +++- .../ui/main/respond/RespondPlanViewModel.kt | 12 ++++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanContract.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanContract.kt index b75c0a4f..4cf59bdd 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanContract.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanContract.kt @@ -28,6 +28,8 @@ class RespondPlanContract { Category(0,"",""), ), val clickCount: Int = 0, + val enablePrev: Boolean = false, + val enableNext: Boolean = false, val planId: Long = -1, ) : ViewState diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanScreen.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanScreen.kt index c85a5057..c97e21d8 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanScreen.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanScreen.kt @@ -80,7 +80,9 @@ fun RespondPlanScreen( PlanzPlanDateIndicator( timeTable = uiState.timeTable, onClickPreviousDayButton = { viewModel.setEvent(RespondPlanEvent.OnClickPreviousDayButton) }, - onClickNextDayButton = { viewModel.setEvent(RespondPlanEvent.OnClickNextDayButton) } + onClickNextDayButton = { viewModel.setEvent(RespondPlanEvent.OnClickNextDayButton) }, + enablePrev = uiState.enablePrev, + enableNext = uiState.enableNext, ) PlanzPlanTimeTable( diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanViewModel.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanViewModel.kt index 31e96117..ed05e75a 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanViewModel.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/respond/RespondPlanViewModel.kt @@ -62,7 +62,11 @@ class RespondPlanViewModel @Inject constructor( } updateState { - copy(loadState = LoadState.SUCCESS, timeTable = sliceTimeTable) + copy( + timeTable = sliceTimeTable, + enablePrev = false, + enableNext = originalTable.availableDates.size > 4, + loadState = LoadState.SUCCESS,) } } .onError { @@ -86,7 +90,7 @@ class RespondPlanViewModel @Inject constructor( } val sliceCreateTimeTable: TimeTable = originalTable.copy(availableDates = originalTable.availableDates.subList(fromIndex, toIndex)) updateState { - copy(timeTable = sliceCreateTimeTable) + copy(enablePrev = true, enableNext = toIndex < originalTable.availableDates.size, timeTable = sliceCreateTimeTable) } } @@ -96,9 +100,9 @@ class RespondPlanViewModel @Inject constructor( val fromIndex = currentIndex.times(4) val toIndex = fromIndex.plus(4) - val temp: TimeTable = originalTable.copy(availableDates = originalTable.availableDates.subList(fromIndex, toIndex)) + val sliceCreateTimeTable: TimeTable = originalTable.copy(availableDates = originalTable.availableDates.subList(fromIndex, toIndex)) updateState { - copy(timeTable = temp) + copy(enablePrev = currentIndex != 0, enableNext = true, timeTable = sliceCreateTimeTable) } } From 1ada36a2e8e1e7219f1fed0b0b6b16299982c14c Mon Sep 17 00:00:00 2001 From: KwonDae Date: Wed, 3 Aug 2022 18:32:50 +0900 Subject: [PATCH 15/15] =?UTF-8?q?feat=20:=20=EC=95=BD=EC=86=8D=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20-=20=EB=82=A0=EC=A7=9C=20=EC=9D=B8=EB=94=94?= =?UTF-8?q?=EC=BC=80=EC=9D=B4=ED=84=B0=20=EB=B9=84=ED=99=9C=EC=84=B1?= =?UTF-8?q?=ED=99=94=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../createPlan/timetable/CreateTimeTableContract.kt | 2 ++ .../createPlan/timetable/CreateTimeTableScreen.kt | 4 +++- .../timetable/CreateTimeTableViewModel.kt | 13 +++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/timetable/CreateTimeTableContract.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/timetable/CreateTimeTableContract.kt index 038300c7..5708d0c8 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/timetable/CreateTimeTableContract.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/timetable/CreateTimeTableContract.kt @@ -11,6 +11,8 @@ class CreateTimeTableContract { val loadState: LoadState = LoadState.SUCCESS, val createTimeTable: CreateTimeTable = CreateTimeTable(0,"","", emptyList(), emptyList()), val clickCount: Int = 0, + val enablePrev: Boolean = false, + val enableNext: Boolean = false, val isDialogVisible: Boolean = false, ): ViewState diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/timetable/CreateTimeTableScreen.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/timetable/CreateTimeTableScreen.kt index c227ff42..0e75d109 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/timetable/CreateTimeTableScreen.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/timetable/CreateTimeTableScreen.kt @@ -69,7 +69,9 @@ fun CreateTimeTableScreen( CreateTimeTableDateIndicator( createTimeTable = uiState.createTimeTable, onClickPreviousDayButton = { viewModel.setEvent(CreateTimeTableEvent.OnClickPreviousDayButton) }, - onClickNextDayButton = { viewModel.setEvent(CreateTimeTableEvent.OnClickNextDayButton) } + onClickNextDayButton = { viewModel.setEvent(CreateTimeTableEvent.OnClickNextDayButton) }, + enablePrev = uiState.enablePrev, + enableNext = uiState.enableNext, ) CreateTimeTable( diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/timetable/CreateTimeTableViewModel.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/timetable/CreateTimeTableViewModel.kt index d5dd7127..51267e04 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/timetable/CreateTimeTableViewModel.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/timetable/CreateTimeTableViewModel.kt @@ -51,7 +51,12 @@ class CreateTimeTableViewModel @Inject constructor( } updateState { - copy(loadState = LoadState.SUCCESS, createTimeTable = sliceCreateTimeTable) + copy( + createTimeTable = sliceCreateTimeTable, + enablePrev = false, + enableNext = originalTable.availableDates.size > 4, + loadState = LoadState.SUCCESS, + ) } } .onError { @@ -74,7 +79,7 @@ class CreateTimeTableViewModel @Inject constructor( } val sliceCreateTimeTable: CreateTimeTable = originalTable.copy(availableDates = originalTable.availableDates.subList(fromIndex, toIndex)) updateState { - copy(createTimeTable = sliceCreateTimeTable) + copy(enablePrev = true, enableNext = toIndex < originalTable.availableDates.size, createTimeTable = sliceCreateTimeTable) } } @@ -84,9 +89,9 @@ class CreateTimeTableViewModel @Inject constructor( val fromIndex = currentIndex.times(4) val toIndex = fromIndex.plus(4) - val temp: CreateTimeTable = originalTable.copy(availableDates = originalTable.availableDates.subList(fromIndex, toIndex)) + val sliceCreateTimeTable: CreateTimeTable = originalTable.copy(availableDates = originalTable.availableDates.subList(fromIndex, toIndex)) updateState { - copy(createTimeTable = temp) + copy(enablePrev = currentIndex != 0, enableNext = true, createTimeTable = sliceCreateTimeTable) } }