From 5b9a03c8be45df8e5769f8c0c85f6580db6636a4 Mon Sep 17 00:00:00 2001 From: arinming Date: Mon, 26 Aug 2024 23:24:41 +0900 Subject: [PATCH 01/62] =?UTF-8?q?[Refactor]=20InternState=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/intern/InternRoute.kt | 97 +++++++------------ .../terning/feature/intern/InternViewModel.kt | 11 +-- .../intern/component/ScrapDialogContent.kt | 2 +- .../feature/intern/model/InternState.kt | 28 ++++++ .../feature/intern/model/InternViewState.kt | 16 --- .../intern/navigation/InternNavigation.kt | 6 +- .../com/terning/feature/main/MainScreen.kt | 2 +- 7 files changed, 70 insertions(+), 92 deletions(-) create mode 100644 feature/src/main/java/com/terning/feature/intern/model/InternState.kt delete mode 100644 feature/src/main/java/com/terning/feature/intern/model/InternViewState.kt diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index 2249e3e68..0f015c5b0 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -21,44 +21,41 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.viewinterop.AndroidView import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle -import androidx.navigation.NavHostController import com.terning.core.designsystem.component.dialog.TerningBasicDialog import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningMain +import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.customShadow import com.terning.core.extension.toast -import com.terning.core.state.UiState -import com.terning.domain.entity.response.InternInfoModel import com.terning.feature.R import com.terning.feature.intern.component.InternBottomBar -import com.terning.feature.intern.component.InternCancelDialog import com.terning.feature.intern.component.InternCompanyInfo import com.terning.feature.intern.component.InternInfoRow import com.terning.feature.intern.component.InternPageTitle -import com.terning.feature.intern.component.ScrapDialogContent +import com.terning.feature.intern.model.InternState import java.text.DecimalFormat @Composable fun InternRoute( - navController: NavHostController, announcementId: Long = 0, viewModel: InternViewModel = hiltViewModel(), ) { + val internState by viewModel.state.collectAsStateWithLifecycle() + val context = LocalContext.current val lifecycleOwner = LocalLifecycleOwner.current - val state by viewModel.internState.collectAsStateWithLifecycle(lifecycleOwner = lifecycleOwner) - LaunchedEffect(key1 = true) { viewModel.getInternInfo(announcementId) } @@ -72,39 +69,27 @@ fun InternRoute( } } - when (state.internInfo) { - is UiState.Loading -> {} - is UiState.Empty -> {} - is UiState.Failure -> {} - is UiState.Success -> { - InternScreen( - navController = navController, - internInfoModel = (state.internInfo as UiState.Success).data, - announcementId = announcementId - ) - } - } + InternScreen( + internState = internState + ) } @Composable fun InternScreen( modifier: Modifier = Modifier, - navController: NavHostController, viewModel: InternViewModel = hiltViewModel(), - internInfoModel: InternInfoModel, - announcementId: Long, + internState: InternState, ) { - val internState by viewModel.internState.collectAsStateWithLifecycle() val decimal = DecimalFormat("#,###") val internInfoList = listOf( - stringResource(id = R.string.intern_info_d_day) to internInfoModel.deadline, - stringResource(id = R.string.intern_info_working) to internInfoModel.workingPeriod, - stringResource(id = R.string.intern_info_start_date) to internInfoModel.startDate, + stringResource(id = R.string.intern_info_d_day) to internState.deadline, + stringResource(id = R.string.intern_info_working) to internState.workingPeriod, + stringResource(id = R.string.intern_info_start_date) to internState.startDate, ) - val qualificationList = internInfoModel.qualification.split(",").map { it.trim() } - val jobTypeList = internInfoModel.jobType.split(",").map { it.trim() } + val qualificationList = internState.qualification.split(",").map { it.trim() } + val jobTypeList = internState.jobType.split(",").map { it.trim() } if (internState.showWeb) { AndroidView( @@ -114,7 +99,7 @@ fun InternScreen( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, ) - loadUrl(internInfoModel.url) + loadUrl(internState.url) } }, ) @@ -130,15 +115,14 @@ fun InternScreen( offsetY = 2.dp ), onBackButtonClick = { - navController.navigateUp() }, ) }, bottomBar = { InternBottomBar( modifier = modifier, - scrapCount = decimal.format(internInfoModel.scrapCount), - scrapId = internInfoModel.scrapId, + scrapCount = decimal.format(internState.scrapCount), + scrapId = internState.scrapId, onScrapClick = { viewModel.updateScrapDialogVisible(true) } @@ -171,7 +155,7 @@ fun InternScreen( verticalAlignment = Alignment.CenterVertically ) { Text( - text = internInfoModel.dDay, + text = internState.dDay, style = TerningTheme.typography.title5, color = TerningMain, modifier = Modifier.padding( @@ -182,7 +166,7 @@ fun InternScreen( } Text( - text = internInfoModel.title, + text = internState.title, style = TerningTheme.typography.title2, color = Black, modifier = modifier.padding( @@ -225,7 +209,7 @@ fun InternScreen( color = Grey400 ) Text( - text = "${decimal.format(internInfoModel.viewCount)}회", + text = "${decimal.format(internState.viewCount)}회", style = TerningTheme.typography.button4, color = Grey400, ) @@ -241,9 +225,9 @@ fun InternScreen( ) InternCompanyInfo( modifier = modifier, - companyImage = internInfoModel.companyImage, - company = internInfoModel.company, - companyCategory = internInfoModel.companyCategory + companyImage = internState.companyImage, + company = internState.company, + companyCategory = internState.companyCategory ) InternPageTitle( modifier = modifier, @@ -360,7 +344,7 @@ fun InternScreen( ) ) { Text( - text = internInfoModel.detail.trimIndent(), + text = internState.detail.trimIndent(), style = TerningTheme.typography.detail1, color = Grey400 ) @@ -373,29 +357,18 @@ fun InternScreen( onDismissRequest = { viewModel.updateScrapDialogVisible(false) }, - content = { - when (internInfoModel.scrapId != null) { - true -> InternCancelDialog( - onDismissRequest = { viewModel.updateScrapDialogVisible(false) }, - onClickScrapCancel = { - viewModel.deleteScrap( - internInfoModel.scrapId, - announcementId - ) - } - ) - - else -> ScrapDialogContent( - internInfoList = internInfoList, - dDay = internInfoModel.dDay, - title = internInfoModel.title, - companyImage = internInfoModel.companyImage, - announcementId = announcementId, - type = 0 - ) - } - }, + content = {}, ) } } +} + +@Preview(showBackground = true) +@Composable +fun InternScreenPreview() { + TerningPointTheme { + InternScreen( + internState = InternState(), + ) + } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt b/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt index 13e71a697..3a63ea8f8 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt @@ -9,7 +9,7 @@ import com.terning.domain.repository.InternRepository import com.terning.domain.repository.ScrapRepository import com.terning.feature.R import com.terning.feature.intern.model.InternScrapState -import com.terning.feature.intern.model.InternViewState +import com.terning.feature.intern.model.InternState import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow @@ -25,9 +25,9 @@ class InternViewModel @Inject constructor( private val internRepository: InternRepository, private val scrapRepository: ScrapRepository, ) : ViewModel() { - private val _internState: MutableStateFlow = - MutableStateFlow(InternViewState()) - val internState: StateFlow = _internState.asStateFlow() + private val _internState: MutableStateFlow = + MutableStateFlow(InternState()) + val state: StateFlow = _internState.asStateFlow() private val _scrapState: MutableStateFlow = MutableStateFlow(InternScrapState()) @@ -40,9 +40,6 @@ class InternViewModel @Inject constructor( internRepository.getInternInfo( id ).onSuccess { internInfo -> - _internState.update { - it.copy(internInfo = UiState.Success(internInfo)) - } }.onFailure { _sideEffect.emit( InternViewSideEffect.Toast(R.string.server_failure) diff --git a/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt b/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt index 49f107b0b..17335a3a8 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt @@ -65,7 +65,7 @@ fun ScrapDialogContent( announcementId: Long, type: Int, ) { - val state by viewModel.internState.collectAsStateWithLifecycle() + val state by viewModel.state.collectAsStateWithLifecycle() val colorList = listOf( CalRed, diff --git a/feature/src/main/java/com/terning/feature/intern/model/InternState.kt b/feature/src/main/java/com/terning/feature/intern/model/InternState.kt new file mode 100644 index 000000000..55d2b80c7 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/intern/model/InternState.kt @@ -0,0 +1,28 @@ +package com.terning.feature.intern.model + +import androidx.compose.ui.graphics.Color +import com.terning.core.designsystem.theme.CalRed + +data class InternState( + val dDay: String = "", + val title: String = "", + val deadline: String = "", + val workingPeriod: String = "", + val startDate: String = "", + val scrapCount: Int = 0, + val viewCount: Int = 0, + val company: String = "", + val companyCategory: String = "", + val companyImage: String = "", + val qualification: String = "", + val jobType: String = "", + val detail: String = "", + val url: String = "", + val scrapId: Long? = null, + val isColorChange: Boolean = false, + val isPaletteOpen: Boolean = false, + val selectedColor: Color = CalRed, + val isScrapDialogVisible: Boolean = false, + val isScrappedState: Boolean = false, + val showWeb: Boolean = false, +) \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/intern/model/InternViewState.kt b/feature/src/main/java/com/terning/feature/intern/model/InternViewState.kt deleted file mode 100644 index 499fe2c6f..000000000 --- a/feature/src/main/java/com/terning/feature/intern/model/InternViewState.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.terning.feature.intern.model - -import androidx.compose.ui.graphics.Color -import com.terning.core.designsystem.theme.CalRed -import com.terning.core.state.UiState -import com.terning.domain.entity.response.InternInfoModel - -data class InternViewState( - var internInfo: UiState = UiState.Loading, - val isColorChange: Boolean = false, - val isPaletteOpen: Boolean = false, - val selectedColor: Color = CalRed, - val isScrapDialogVisible: Boolean = false, - val isScrappedState: Boolean = false, - val showWeb: Boolean = false, -) \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt b/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt index 486134573..a9790044b 100644 --- a/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt +++ b/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt @@ -4,7 +4,6 @@ import androidx.compose.animation.EnterTransition import androidx.compose.animation.ExitTransition import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder -import androidx.navigation.NavHostController import androidx.navigation.NavOptions import androidx.navigation.compose.composable import androidx.navigation.toRoute @@ -22,9 +21,7 @@ fun NavController.navigateIntern( ) } -fun NavGraphBuilder.internNavGraph( - navHostController: NavHostController, -) { +fun NavGraphBuilder.internNavGraph() { composable( exitTransition = { ExitTransition.None @@ -41,7 +38,6 @@ fun NavGraphBuilder.internNavGraph( ) { val args = it.toRoute() InternRoute( - navController = navHostController, announcementId = args.announcementId, ) } diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index e5fbb5d02..b1398d38a 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -77,7 +77,7 @@ fun MainScreen( changeFilterNavGraph(navHostController = navigator.navController) startFilteringNavGraph(navHostController = navigator.navController) startHomeNavGraph(navHostController = navigator.navController) - internNavGraph(navHostController = navigator.navController) + internNavGraph() } } } From ff7439373a24d3cd67994d74539caea1dd46929e Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Tue, 27 Aug 2024 17:22:56 +0900 Subject: [PATCH 02/62] =?UTF-8?q?[MOVE/#206]=20=EB=A7=88=EC=9D=B4=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=ED=8C=8C=EC=9D=BC=20=EC=9C=84=EC=B9=98=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/terning/feature/main/MainNavigator.kt | 2 +- feature/src/main/java/com/terning/feature/main/MainScreen.kt | 2 +- feature/src/main/java/com/terning/feature/main/MainTab.kt | 2 +- .../com/terning/feature/mypage/{ => mypage}/MyPageRoute.kt | 4 ++-- .../com/terning/feature/mypage/{ => mypage}/MyPageState.kt | 2 +- .../terning/feature/mypage/{ => mypage}/MyPageViewModel.kt | 2 +- .../feature/mypage/{ => mypage}/component/MyPageItem.kt | 2 +- .../mypage/{ => mypage}/navigation/MyPageNavigation.kt | 4 ++-- .../terning/feature/mypage/profileedit/ProfileEditRoute.kt | 4 ++++ .../mypage/profileedit/navigation/ProfileEditNavigation.kt | 4 ++++ 10 files changed, 18 insertions(+), 10 deletions(-) rename feature/src/main/java/com/terning/feature/mypage/{ => mypage}/MyPageRoute.kt (98%) rename feature/src/main/java/com/terning/feature/mypage/{ => mypage}/MyPageState.kt (90%) rename feature/src/main/java/com/terning/feature/mypage/{ => mypage}/MyPageViewModel.kt (99%) rename feature/src/main/java/com/terning/feature/mypage/{ => mypage}/component/MyPageItem.kt (97%) rename feature/src/main/java/com/terning/feature/mypage/{ => mypage}/navigation/MyPageNavigation.kt (90%) create mode 100644 feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt create mode 100644 feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt diff --git a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt index 901d0fed0..f0598bf1f 100644 --- a/feature/src/main/java/com/terning/feature/main/MainNavigator.kt +++ b/feature/src/main/java/com/terning/feature/main/MainNavigator.kt @@ -11,7 +11,7 @@ import androidx.navigation.compose.rememberNavController import androidx.navigation.navOptions import com.terning.feature.calendar.calendar.navigation.navigateCalendar import com.terning.feature.home.home.navigation.navigateHome -import com.terning.feature.mypage.navigation.navigateMyPage +import com.terning.feature.mypage.mypage.navigation.navigateMyPage import com.terning.feature.onboarding.splash.navigation.Splash import com.terning.feature.search.search.navigation.navigateSearch diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index e5fbb5d02..365a1f096 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -33,7 +33,7 @@ import com.terning.feature.filtering.starthome.navigation.startHomeNavGraph import com.terning.feature.home.changefilter.navigation.changeFilterNavGraph import com.terning.feature.home.home.navigation.homeNavGraph import com.terning.feature.intern.navigation.internNavGraph -import com.terning.feature.mypage.navigation.myPageNavGraph +import com.terning.feature.mypage.mypage.navigation.myPageNavGraph import com.terning.feature.onboarding.signin.navigation.signInNavGraph import com.terning.feature.onboarding.signup.navigation.signUpNavGraph import com.terning.feature.onboarding.splash.navigation.splashNavGraph diff --git a/feature/src/main/java/com/terning/feature/main/MainTab.kt b/feature/src/main/java/com/terning/feature/main/MainTab.kt index 179669c64..993a7c47a 100644 --- a/feature/src/main/java/com/terning/feature/main/MainTab.kt +++ b/feature/src/main/java/com/terning/feature/main/MainTab.kt @@ -8,7 +8,7 @@ import com.terning.core.navigation.Route import com.terning.feature.R import com.terning.feature.calendar.calendar.navigation.Calendar import com.terning.feature.home.home.navigation.Home -import com.terning.feature.mypage.navigation.MyPage +import com.terning.feature.mypage.mypage.navigation.MyPage import com.terning.feature.search.search.navigation.Search enum class MainTab( diff --git a/feature/src/main/java/com/terning/feature/mypage/MyPageRoute.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt similarity index 98% rename from feature/src/main/java/com/terning/feature/mypage/MyPageRoute.kt rename to feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt index c2a0dc1de..66e3dd962 100644 --- a/feature/src/main/java/com/terning/feature/mypage/MyPageRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt @@ -1,4 +1,4 @@ -package com.terning.feature.mypage +package com.terning.feature.mypage.mypage import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement @@ -37,7 +37,7 @@ import com.terning.core.extension.customShadow import com.terning.core.extension.noRippleClickable import com.terning.core.state.UiState import com.terning.feature.R -import com.terning.feature.mypage.component.MyPageItem +import com.terning.feature.mypage.mypage.component.MyPageItem @Composable fun MyPageRoute( diff --git a/feature/src/main/java/com/terning/feature/mypage/MyPageState.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageState.kt similarity index 90% rename from feature/src/main/java/com/terning/feature/mypage/MyPageState.kt rename to feature/src/main/java/com/terning/feature/mypage/mypage/MyPageState.kt index e74a16fe8..fb74cd235 100644 --- a/feature/src/main/java/com/terning/feature/mypage/MyPageState.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageState.kt @@ -1,4 +1,4 @@ -package com.terning.feature.mypage +package com.terning.feature.mypage.mypage import com.terning.core.state.UiState diff --git a/feature/src/main/java/com/terning/feature/mypage/MyPageViewModel.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageViewModel.kt similarity index 99% rename from feature/src/main/java/com/terning/feature/mypage/MyPageViewModel.kt rename to feature/src/main/java/com/terning/feature/mypage/mypage/MyPageViewModel.kt index d5e87497b..d5bc25885 100644 --- a/feature/src/main/java/com/terning/feature/mypage/MyPageViewModel.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageViewModel.kt @@ -1,4 +1,4 @@ -package com.terning.feature.mypage +package com.terning.feature.mypage.mypage import android.content.Context import android.content.Intent diff --git a/feature/src/main/java/com/terning/feature/mypage/component/MyPageItem.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/component/MyPageItem.kt similarity index 97% rename from feature/src/main/java/com/terning/feature/mypage/component/MyPageItem.kt rename to feature/src/main/java/com/terning/feature/mypage/mypage/component/MyPageItem.kt index 277a31c2a..2836c28d1 100644 --- a/feature/src/main/java/com/terning/feature/mypage/component/MyPageItem.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/component/MyPageItem.kt @@ -1,4 +1,4 @@ -package com.terning.feature.mypage.component +package com.terning.feature.mypage.mypage.component import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Row diff --git a/feature/src/main/java/com/terning/feature/mypage/navigation/MyPageNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt similarity index 90% rename from feature/src/main/java/com/terning/feature/mypage/navigation/MyPageNavigation.kt rename to feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt index c028d5967..7e01d35d2 100644 --- a/feature/src/main/java/com/terning/feature/mypage/navigation/MyPageNavigation.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt @@ -1,4 +1,4 @@ -package com.terning.feature.mypage.navigation +package com.terning.feature.mypage.mypage.navigation import androidx.compose.animation.EnterTransition import androidx.compose.animation.ExitTransition @@ -8,7 +8,7 @@ import androidx.navigation.NavHostController import androidx.navigation.NavOptions import androidx.navigation.compose.composable import com.terning.core.navigation.MainTabRoute -import com.terning.feature.mypage.MyPageRoute +import com.terning.feature.mypage.mypage.MyPageRoute import kotlinx.serialization.Serializable fun NavController.navigateMyPage(navOptions: NavOptions? = null) { diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt new file mode 100644 index 000000000..949fa832e --- /dev/null +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -0,0 +1,4 @@ +package com.terning.feature.mypage.profileedit + +class ProfileEditRoute { +} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt new file mode 100644 index 000000000..01d101bce --- /dev/null +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt @@ -0,0 +1,4 @@ +package com.terning.feature.mypage.profileedit.navigation + +class ProfileEditNavigation { +} \ No newline at end of file From acf62e8af9287b478f4de6c8e7737fdbc17e88ff Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Tue, 27 Aug 2024 18:04:28 +0900 Subject: [PATCH 03/62] =?UTF-8?q?[MOVE/#206]=20=EB=A7=88=EC=9D=B4=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=ED=94=84=EB=A1=9C=ED=95=84=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=9C=84=EC=B9=98=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/item/ProfileWithPlusButton.kt | 13 +++-- .../main/res/drawable/ic_sign_up_button.xml | 0 .../mypage/profileedit/ProfileEditRoute.kt | 50 ++++++++++++++++++- .../feature/onboarding/signup/SignUpRoute.kt | 8 +-- feature/src/main/res/values/strings.xml | 3 ++ 5 files changed, 63 insertions(+), 11 deletions(-) rename feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpProfile.kt => core/src/main/java/com/terning/core/designsystem/component/item/ProfileWithPlusButton.kt (84%) rename {feature => core}/src/main/res/drawable/ic_sign_up_button.xml (100%) diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpProfile.kt b/core/src/main/java/com/terning/core/designsystem/component/item/ProfileWithPlusButton.kt similarity index 84% rename from feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpProfile.kt rename to core/src/main/java/com/terning/core/designsystem/component/item/ProfileWithPlusButton.kt index b09d96245..c5f06c1bf 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/component/SignUpProfile.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/item/ProfileWithPlusButton.kt @@ -1,4 +1,4 @@ -package com.terning.feature.onboarding.signup.component +package com.terning.core.designsystem.component.item import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Box @@ -12,14 +12,13 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.painterResource -import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import com.terning.core.R import com.terning.core.designsystem.component.image.TerningImage -import com.terning.feature.R @Composable -fun SignUpProfile( +fun ProfileWithPlusButton( index: Int, modifier: Modifier = Modifier, ) { @@ -37,7 +36,7 @@ fun SignUpProfile( ) { Image( painterResource(id = grade), - contentDescription = stringResource(id = R.string.sign_up_profile_image), + contentDescription = null, modifier = modifier .clip(shape = RoundedCornerShape(76.dp)) .size(80.dp) @@ -54,6 +53,6 @@ fun SignUpProfile( @Preview(showBackground = true) @Composable -fun SignUpProfilePreview() { - SignUpProfile(index = 1) +fun ProfileWithPlusButtonPreview() { + ProfileWithPlusButton(index = 1) } \ No newline at end of file diff --git a/feature/src/main/res/drawable/ic_sign_up_button.xml b/core/src/main/res/drawable/ic_sign_up_button.xml similarity index 100% rename from feature/src/main/res/drawable/ic_sign_up_button.xml rename to core/src/main/res/drawable/ic_sign_up_button.xml diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index 949fa832e..548b1a051 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -1,4 +1,52 @@ package com.terning.feature.mypage.profileedit -class ProfileEditRoute { +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalFocusManager +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview +import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar +import com.terning.core.designsystem.theme.TerningPointTheme +import com.terning.core.extension.addFocusCleaner +import com.terning.feature.R + +@Composable +fun ProfileEditRoute() { + ProfileEditScreen() +} + +@Composable +fun ProfileEditScreen( + modifier: Modifier = Modifier +) { + val focusManager = LocalFocusManager.current + var showBottomSheet by remember { mutableStateOf(false) } + + Column( + modifier = modifier.addFocusCleaner(focusManager) + ) { + BackButtonTopAppBar( + onBackButtonClick = {}, + title = stringResource(id = R.string.profile_edit_title) + ) + Column( + modifier = Modifier.fillMaxSize() + ) { + + } + } +} + +@Preview(showBackground = true) +@Composable +fun ProfileEditScreenPreview() { + TerningPointTheme { + ProfileEditScreen() + } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index 61dce1b1d..95f6ea5ba 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -24,14 +24,15 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle import com.terning.core.designsystem.component.bottomsheet.SignUpBottomSheet import com.terning.core.designsystem.component.button.RectangleButton +import com.terning.core.designsystem.component.item.ProfileWithPlusButton import com.terning.core.designsystem.component.textfield.NameTextField +import com.terning.core.designsystem.theme.Grey500 import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.addFocusCleaner import com.terning.core.extension.noRippleClickable import com.terning.core.extension.toast import com.terning.feature.R -import com.terning.feature.onboarding.signup.component.SignUpProfile @Composable fun SignUpRoute( @@ -115,14 +116,15 @@ fun SignUpScreen( .padding( start = 24.dp, bottom = 20.dp - ) + ), + color = Grey500 ) Column( modifier = modifier .align(Alignment.CenterHorizontally) .padding(bottom = 52.dp) ) { - SignUpProfile( + ProfileWithPlusButton( modifier = modifier.noRippleClickable { showBottomSheet = true }, diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 7d1c5157d..e0876a53e 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -143,5 +143,8 @@ 로그아웃 탈퇴하기 + + 프로필 수정 + From 3a43748be346b5be185be7d74f634dc2df66d94c Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 28 Aug 2024 04:24:06 +0900 Subject: [PATCH 04/62] =?UTF-8?q?[UI/#206]=20=ED=94=84=EB=A1=9C=ED=95=84?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20=EB=B7=B0=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mypage/profileedit/ProfileEditRoute.kt | 116 ++++++++++++++++-- .../profileedit/ProfileEditSideEffect.kt | 4 + .../mypage/profileedit/ProfileEditState.kt | 18 +++ .../profileedit/ProfileEditViewModel.kt | 90 ++++++++++++++ feature/src/main/res/values/strings.xml | 1 + 5 files changed, 219 insertions(+), 10 deletions(-) create mode 100644 feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditSideEffect.kt create mode 100644 feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt create mode 100644 feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index 548b1a051..24150c9f3 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -1,33 +1,73 @@ package com.terning.feature.mypage.profileedit import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle +import com.terning.core.designsystem.component.bottomsheet.SignUpBottomSheet +import com.terning.core.designsystem.component.button.RectangleButton +import com.terning.core.designsystem.component.item.ProfileWithPlusButton +import com.terning.core.designsystem.component.textfield.NameTextField import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar +import com.terning.core.designsystem.theme.Grey500 import com.terning.core.designsystem.theme.TerningPointTheme +import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.addFocusCleaner +import com.terning.core.extension.noRippleClickable import com.terning.feature.R @Composable -fun ProfileEditRoute() { - ProfileEditScreen() +fun ProfileEditRoute( + viewModel: ProfileEditViewModel = hiltViewModel(), +) { + val profileEditState by viewModel.state.collectAsStateWithLifecycle() + var showBottomSheet by remember { mutableStateOf(false) } + + if (profileEditState.showBottomSheet) { + SignUpBottomSheet( + onDismiss = { showBottomSheet = false }, + onSaveClick = { index -> + showBottomSheet = false + viewModel.fetchCharacter(index) + }, + initialSelectedOption = profileEditState.character + ) + } + ProfileEditScreen( + profileEditState = profileEditState, + onProfileEditClick = { isVisible -> + viewModel.showBottomSheet(isVisible) + }, + onInputChange = { name -> + viewModel.isInputValid(name) + }, + onSaveClick = {/*TODO: 수정사항 저장 로직*/ } + ) } @Composable fun ProfileEditScreen( - modifier: Modifier = Modifier + modifier: Modifier = Modifier, + profileEditState: ProfileEditState, + onProfileEditClick: (Boolean) -> Unit, + onInputChange: (String) -> Unit, + onSaveClick: () -> Unit ) { val focusManager = LocalFocusManager.current - var showBottomSheet by remember { mutableStateOf(false) } - Column( modifier = modifier.addFocusCleaner(focusManager) ) { @@ -35,10 +75,61 @@ fun ProfileEditScreen( onBackButtonClick = {}, title = stringResource(id = R.string.profile_edit_title) ) - Column( - modifier = Modifier.fillMaxSize() - ) { - + Column(modifier = modifier.fillMaxSize()) { + Spacer(modifier = modifier.weight(1f)) + Text( + text = stringResource(id = R.string.sign_up_profile_image), + style = TerningTheme.typography.body2, + modifier = modifier + .padding( + start = 24.dp, + bottom = 20.dp + ), + color = Grey500 + ) + Column( + modifier = modifier + .align(Alignment.CenterHorizontally) + .padding(bottom = 48.dp) + ) { + ProfileWithPlusButton( + modifier = modifier.noRippleClickable { + onProfileEditClick(true) + }, + index = profileEditState.character + ) + } + Column( + modifier = modifier + .align(Alignment.CenterHorizontally) + .padding(horizontal = 24.dp) + ) { + Text( + text = stringResource(id = R.string.sign_up_name), + modifier = modifier.padding(bottom = 20.dp), + color = Grey500 + ) + NameTextField( + value = profileEditState.name, + onValueChange = { name -> + onInputChange(name) + }, + hint = stringResource(id = R.string.sign_up_hint), + drawLineColor = profileEditState.drawLineColor, + helperMessage = profileEditState.helper, + helperIcon = profileEditState.helperIcon, + helperColor = profileEditState.helperColor + ) + } + Spacer(modifier = modifier.weight(5f)) + RectangleButton( + style = TerningTheme.typography.button1, + paddingVertical = 20.dp, + text = R.string.profile_edit_save, + onButtonClick = { onSaveClick() }, + modifier = modifier.padding(bottom = 12.dp), + isEnabled = profileEditState.isButtonValid + ) } } } @@ -47,6 +138,11 @@ fun ProfileEditScreen( @Composable fun ProfileEditScreenPreview() { TerningPointTheme { - ProfileEditScreen() + ProfileEditScreen( + profileEditState = ProfileEditState(), + onProfileEditClick = {}, + onInputChange = {}, + onSaveClick = {} + ) } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditSideEffect.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditSideEffect.kt new file mode 100644 index 000000000..e76e2e007 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditSideEffect.kt @@ -0,0 +1,4 @@ +package com.terning.feature.mypage.profileedit + +class ProfileEditSideEffect { +} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt new file mode 100644 index 000000000..ba6759377 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt @@ -0,0 +1,18 @@ +package com.terning.feature.mypage.profileedit + +import androidx.annotation.StringRes +import androidx.compose.ui.graphics.Color +import com.terning.core.designsystem.theme.Grey400 +import com.terning.core.designsystem.theme.Grey500 +import com.terning.feature.R + +data class ProfileEditState( + val name: String = "", + val character: Int = 0, + val drawLineColor: Color = Grey500, + @StringRes val helper: Int = R.string.sign_up_helper, + val helperIcon: Int? = null, + val helperColor: Color = Grey400, + val isButtonValid: Boolean = false, + val showBottomSheet: Boolean = false +) \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt new file mode 100644 index 000000000..a9abd3b60 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt @@ -0,0 +1,90 @@ +package com.terning.feature.mypage.profileedit + +import androidx.lifecycle.ViewModel +import com.terning.core.designsystem.theme.Grey400 +import com.terning.core.designsystem.theme.Grey500 +import com.terning.core.designsystem.theme.TerningMain +import com.terning.core.designsystem.theme.WarningRed +import com.terning.feature.R +import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.SharedFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asSharedFlow +import kotlinx.coroutines.flow.asStateFlow +import javax.inject.Inject + +@HiltViewModel +class ProfileEditViewModel @Inject constructor() : ViewModel() { + + private val _state: MutableStateFlow = MutableStateFlow(ProfileEditState()) + val state: StateFlow get() = _state.asStateFlow() + + private val _sideEffects = MutableSharedFlow() + val sideEffects: SharedFlow get() = _sideEffects.asSharedFlow() + + fun isInputValid(name: String) { + val nameErrorRegex = Regex(NAME_ERROR) + var trimmedName = "" + var outOfBoundName = false + if (name.length > MAX_LENGTH) { + trimmedName = name.substring(0, MAX_LENGTH) + outOfBoundName = true + } else trimmedName = name + + when { + nameErrorRegex.containsMatchIn(trimmedName) -> _state.value = _state.value.copy( + name = trimmedName, + drawLineColor = WarningRed, + helper = R.string.sign_up_helper_error, + helperIcon = R.drawable.ic_sign_up_error, + helperColor = WarningRed, + isButtonValid = false + ) + + trimmedName.isEmpty() || trimmedName.isBlank() -> _state.value = _state.value.copy( + name = trimmedName, + drawLineColor = Grey500, + helper = R.string.sign_up_helper, + helperIcon = null, + helperColor = Grey400, + isButtonValid = false + ) + + outOfBoundName -> _state.value = _state.value.copy( + name = trimmedName, + drawLineColor = WarningRed, + helper = R.string.sign_up_helper_out, + helperIcon = R.drawable.ic_sign_up_error, + helperColor = WarningRed, + isButtonValid = false + ) + + else -> _state.value = _state.value.copy( + name = trimmedName, + drawLineColor = TerningMain, + helper = R.string.sign_up_helper_available, + helperIcon = R.drawable.ic_check, + helperColor = TerningMain, + isButtonValid = true + ) + } + } + + fun showBottomSheet(isVisible: Boolean) { + _state.value = _state.value.copy( + showBottomSheet = isVisible + ) + } + + fun fetchCharacter(character: Int) { + _state.value = _state.value.copy(character = character) + } + + companion object { + const val NAME_ERROR = "[!@#\$%^&*(),.?\":{}|<>\\[\\]\\\\/\\-=+~`\\p{S}\\p{P}]" + private const val MAX_LENGTH = 12 + private const val KAKA0 = "KAKAO" + } +} \ No newline at end of file diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index e0876a53e..4e87d0dcb 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -145,6 +145,7 @@ 프로필 수정 + 저장하기 From d457c3f9544f98eeeafd2080cbc2a08111638bf5 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 28 Aug 2024 04:30:03 +0900 Subject: [PATCH 05/62] =?UTF-8?q?[FEAT/#206]=20=EB=84=A4=EB=B9=84=EA=B2=8C?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/main/MainScreen.kt | 2 ++ .../navigation/ProfileEditNavigation.kt | 29 +++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index 365a1f096..c6d644ae3 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -34,6 +34,7 @@ import com.terning.feature.home.changefilter.navigation.changeFilterNavGraph import com.terning.feature.home.home.navigation.homeNavGraph import com.terning.feature.intern.navigation.internNavGraph import com.terning.feature.mypage.mypage.navigation.myPageNavGraph +import com.terning.feature.mypage.profileedit.navigation.profileEditNavGraph import com.terning.feature.onboarding.signin.navigation.signInNavGraph import com.terning.feature.onboarding.signup.navigation.signUpNavGraph import com.terning.feature.onboarding.splash.navigation.splashNavGraph @@ -78,6 +79,7 @@ fun MainScreen( startFilteringNavGraph(navHostController = navigator.navController) startHomeNavGraph(navHostController = navigator.navController) internNavGraph(navHostController = navigator.navController) + profileEditNavGraph(navHostController = navigator.navController) } } } diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt index 01d101bce..4df9be2fa 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt @@ -1,4 +1,29 @@ package com.terning.feature.mypage.profileedit.navigation -class ProfileEditNavigation { -} \ No newline at end of file +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavHostController +import androidx.navigation.NavOptions +import androidx.navigation.compose.composable +import com.terning.core.navigation.Route +import com.terning.feature.mypage.profileedit.ProfileEditRoute +import kotlinx.serialization.Serializable + +fun NavController.navigateProfileEdit(navOptions: NavOptions? = null) { + navigate( + route = ProfileEdit, + navOptions = navOptions + ) +} + +fun NavGraphBuilder.profileEditNavGraph( + navHostController: NavHostController, +) { + composable( + ) { + ProfileEditRoute() + } +} + +@Serializable +data object ProfileEdit : Route \ No newline at end of file From cbfd195460d6339ffdd824002f60d4b2fc8fe218 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 28 Aug 2024 04:35:16 +0900 Subject: [PATCH 06/62] [FEAT/#206] TODO: FIX --- .../java/com/terning/feature/mypage/mypage/MyPageRoute.kt | 7 ++++++- .../feature/mypage/mypage/navigation/MyPageNavigation.kt | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt index 66e3dd962..88bf4e6b9 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt @@ -24,6 +24,8 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle +import androidx.navigation.NavController +import androidx.navigation.compose.rememberNavController import com.terning.core.designsystem.component.bottomsheet.MyPageLogoutBottomSheet import com.terning.core.designsystem.component.bottomsheet.MyPageQuitBottomSheet import com.terning.core.designsystem.component.image.TerningImage @@ -38,9 +40,12 @@ import com.terning.core.extension.noRippleClickable import com.terning.core.state.UiState import com.terning.feature.R import com.terning.feature.mypage.mypage.component.MyPageItem +import com.terning.feature.mypage.mypage.navigation.navigateMyPage +import com.terning.feature.mypage.profileedit.navigation.navigateProfileEdit @Composable fun MyPageRoute( + navController: NavController, viewModel: MyPageViewModel = hiltViewModel(), ) { val state by viewModel.state.collectAsStateWithLifecycle() @@ -99,7 +104,7 @@ fun MyPageRoute( } MyPageScreen( - onLogoutClick = { viewModel.fetchShowLogoutBottomSheet(true) }, + onLogoutClick = { navController.navigateProfileEdit() }, onQuitClick = { viewModel.fetchShowQuitBottomSheet(true) }, name = name, authType = authType, diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt index 7e01d35d2..034a86cfc 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt @@ -35,7 +35,9 @@ fun NavGraphBuilder.myPageNavGraph( ExitTransition.None } ) { - MyPageRoute() + MyPageRoute( + navHostController + ) } } From 6a3e69d6e5e1a6ed00ab4429fb204c407e72e1ea Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 28 Aug 2024 05:34:23 +0900 Subject: [PATCH 07/62] =?UTF-8?q?[FEAT/#206]=20=EC=97=90=EB=9F=AC=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 --- .../component/textfield/NameTextField.kt | 4 +- .../mypage/profileedit/ProfileEditRoute.kt | 48 ++++++++++++++----- .../mypage/profileedit/ProfileEditState.kt | 4 +- .../profileedit/ProfileEditViewModel.kt | 6 --- .../navigation/ProfileEditNavigation.kt | 4 +- feature/src/main/res/values/strings.xml | 1 + 6 files changed, 43 insertions(+), 24 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt index 7f92022bf..9d78f7162 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt @@ -2,7 +2,6 @@ package com.terning.core.designsystem.component.textfield import androidx.annotation.StringRes import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.SolidColor @@ -23,6 +22,7 @@ fun NameTextField( drawLineColor: Color, @StringRes helperMessage: Int, helperColor: Color, + modifier: Modifier = Modifier, helperIcon: Int? = null, ) { val focusManager = LocalFocusManager.current @@ -31,7 +31,7 @@ fun NameTextField( TerningBasicTextField( value = value, onValueChange = onValueChange, - modifier = Modifier, + modifier = modifier, textStyle = TerningTheme.typography.detail1, textColor = Black, drawLineColor = drawLineColor, diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index 24150c9f3..9e668b6ae 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -33,11 +33,14 @@ import com.terning.feature.R @Composable fun ProfileEditRoute( viewModel: ProfileEditViewModel = hiltViewModel(), + initialName: String = "남지우", + navigateUp: () -> Unit ) { val profileEditState by viewModel.state.collectAsStateWithLifecycle() var showBottomSheet by remember { mutableStateOf(false) } + var name by remember { mutableStateOf(initialName) } - if (profileEditState.showBottomSheet) { + if (showBottomSheet) { SignUpBottomSheet( onDismiss = { showBottomSheet = false }, onSaveClick = { index -> @@ -50,12 +53,15 @@ fun ProfileEditRoute( ProfileEditScreen( profileEditState = profileEditState, onProfileEditClick = { isVisible -> - viewModel.showBottomSheet(isVisible) + showBottomSheet = isVisible }, - onInputChange = { name -> - viewModel.isInputValid(name) + onInputChange = { editName -> + name = editName + viewModel.isInputValid(editName) }, - onSaveClick = {/*TODO: 수정사항 저장 로직*/ } + onSaveClick = {/*TODO: 수정사항 저장 로직*/ }, + name = name, + onBackButtonClick = { navigateUp() } ) } @@ -65,17 +71,21 @@ fun ProfileEditScreen( profileEditState: ProfileEditState, onProfileEditClick: (Boolean) -> Unit, onInputChange: (String) -> Unit, - onSaveClick: () -> Unit + onSaveClick: () -> Unit, + name: String, + onBackButtonClick: () -> Unit ) { val focusManager = LocalFocusManager.current Column( - modifier = modifier.addFocusCleaner(focusManager) + modifier = modifier + .fillMaxSize() + .addFocusCleaner(focusManager) ) { BackButtonTopAppBar( - onBackButtonClick = {}, + onBackButtonClick = { onBackButtonClick() }, title = stringResource(id = R.string.profile_edit_title) ) - Column(modifier = modifier.fillMaxSize()) { + Column { Spacer(modifier = modifier.weight(1f)) Text( text = stringResource(id = R.string.sign_up_profile_image), @@ -110,9 +120,9 @@ fun ProfileEditScreen( color = Grey500 ) NameTextField( - value = profileEditState.name, - onValueChange = { name -> - onInputChange(name) + value = name, + onValueChange = { editName -> + onInputChange(editName) }, hint = stringResource(id = R.string.sign_up_hint), drawLineColor = profileEditState.drawLineColor, @@ -120,6 +130,16 @@ fun ProfileEditScreen( helperIcon = profileEditState.helperIcon, helperColor = profileEditState.helperColor ) + Text( + text = stringResource(id = R.string.profile_edit_auth_type), + style = TerningTheme.typography.body2, + color = Grey500, + modifier = Modifier.padding(bottom = 11.dp, top = 48.dp) + ) + Text( + text = profileEditState.authType, + style = TerningTheme.typography.detail0 + ) } Spacer(modifier = modifier.weight(5f)) RectangleButton( @@ -142,7 +162,9 @@ fun ProfileEditScreenPreview() { profileEditState = ProfileEditState(), onProfileEditClick = {}, onInputChange = {}, - onSaveClick = {} + onSaveClick = {}, + name = "터닝이", + onBackButtonClick = {} ) } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt index ba6759377..60faea025 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt @@ -13,6 +13,6 @@ data class ProfileEditState( @StringRes val helper: Int = R.string.sign_up_helper, val helperIcon: Int? = null, val helperColor: Color = Grey400, - val isButtonValid: Boolean = false, - val showBottomSheet: Boolean = false + val isButtonValid: Boolean = true, + val authType: String = "카카오 로그인" ) \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt index a9abd3b60..6b5adbe40 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt @@ -72,12 +72,6 @@ class ProfileEditViewModel @Inject constructor() : ViewModel() { } } - fun showBottomSheet(isVisible: Boolean) { - _state.value = _state.value.copy( - showBottomSheet = isVisible - ) - } - fun fetchCharacter(character: Int) { _state.value = _state.value.copy(character = character) } diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt index 4df9be2fa..46515feac 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt @@ -21,7 +21,9 @@ fun NavGraphBuilder.profileEditNavGraph( ) { composable( ) { - ProfileEditRoute() + ProfileEditRoute( + navigateUp = { navHostController.navigateUp() } + ) } } diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 4e87d0dcb..a113f7657 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -146,6 +146,7 @@ 프로필 수정 저장하기 + 연동 계정 From a3bd94eb0eb78d70da3ca9bb372b030ac0f22dde Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 28 Aug 2024 05:42:25 +0900 Subject: [PATCH 08/62] =?UTF-8?q?[FEAT/#206]=20=ED=94=84=EB=A1=9C=ED=95=84?= =?UTF-8?q?=20=EC=88=98=EC=A0=95,=20=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85?= =?UTF-8?q?=20=EB=A6=AC=ED=8C=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/mypage/mypage/MyPageRoute.kt | 7 +--- .../mypage/navigation/MyPageNavigation.kt | 4 +-- .../mypage/profileedit/ProfileEditRoute.kt | 10 +++--- .../mypage/profileedit/ProfileEditState.kt | 2 +- .../feature/onboarding/signup/SignUpRoute.kt | 34 ++++++++++--------- 5 files changed, 27 insertions(+), 30 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt index 88bf4e6b9..66e3dd962 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt @@ -24,8 +24,6 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle -import androidx.navigation.NavController -import androidx.navigation.compose.rememberNavController import com.terning.core.designsystem.component.bottomsheet.MyPageLogoutBottomSheet import com.terning.core.designsystem.component.bottomsheet.MyPageQuitBottomSheet import com.terning.core.designsystem.component.image.TerningImage @@ -40,12 +38,9 @@ import com.terning.core.extension.noRippleClickable import com.terning.core.state.UiState import com.terning.feature.R import com.terning.feature.mypage.mypage.component.MyPageItem -import com.terning.feature.mypage.mypage.navigation.navigateMyPage -import com.terning.feature.mypage.profileedit.navigation.navigateProfileEdit @Composable fun MyPageRoute( - navController: NavController, viewModel: MyPageViewModel = hiltViewModel(), ) { val state by viewModel.state.collectAsStateWithLifecycle() @@ -104,7 +99,7 @@ fun MyPageRoute( } MyPageScreen( - onLogoutClick = { navController.navigateProfileEdit() }, + onLogoutClick = { viewModel.fetchShowLogoutBottomSheet(true) }, onQuitClick = { viewModel.fetchShowQuitBottomSheet(true) }, name = name, authType = authType, diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt index 034a86cfc..7e01d35d2 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt @@ -35,9 +35,7 @@ fun NavGraphBuilder.myPageNavGraph( ExitTransition.None } ) { - MyPageRoute( - navHostController - ) + MyPageRoute() } } diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index 9e668b6ae..41f32ebc4 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -32,9 +32,9 @@ import com.terning.feature.R @Composable fun ProfileEditRoute( + navigateUp: () -> Unit, viewModel: ProfileEditViewModel = hiltViewModel(), - initialName: String = "남지우", - navigateUp: () -> Unit + initialName: String = "", ) { val profileEditState by viewModel.state.collectAsStateWithLifecycle() var showBottomSheet by remember { mutableStateOf(false) } @@ -50,6 +50,7 @@ fun ProfileEditRoute( initialSelectedOption = profileEditState.character ) } + ProfileEditScreen( profileEditState = profileEditState, onProfileEditClick = { isVisible -> @@ -67,15 +68,16 @@ fun ProfileEditRoute( @Composable fun ProfileEditScreen( - modifier: Modifier = Modifier, profileEditState: ProfileEditState, onProfileEditClick: (Boolean) -> Unit, onInputChange: (String) -> Unit, onSaveClick: () -> Unit, name: String, - onBackButtonClick: () -> Unit + onBackButtonClick: () -> Unit, + modifier: Modifier = Modifier, ) { val focusManager = LocalFocusManager.current + Column( modifier = modifier .fillMaxSize() diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt index 60faea025..2a4934adb 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt @@ -14,5 +14,5 @@ data class ProfileEditState( val helperIcon: Int? = null, val helperColor: Color = Grey400, val isButtonValid: Boolean = true, - val authType: String = "카카오 로그인" + val authType: String = "" ) \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index 95f6ea5ba..74860611c 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -45,6 +45,8 @@ fun SignUpRoute( val context = LocalContext.current val lifecycleOwner = LocalLifecycleOwner.current + var showBottomSheet by remember { mutableStateOf(false) } + LaunchedEffect(key1 = true) { viewModel.fetchAuthId(authId) } @@ -60,6 +62,17 @@ fun SignUpRoute( } } + if (showBottomSheet) { + SignUpBottomSheet( + onDismiss = { showBottomSheet = false }, + onSaveClick = { index -> + showBottomSheet = false + viewModel.fetchCharacter(index) + }, + initialSelectedOption = signUpState.character + ) + } + SignUpScreen( signUpState = signUpState, onSignUpClick = { @@ -68,8 +81,8 @@ fun SignUpRoute( onInputChange = { name -> viewModel.isInputValid(name) }, - onFetchCharacter = { index -> - viewModel.fetchCharacter(index) + onProfileEditClick = { isVisible -> + showBottomSheet = isVisible } ) } @@ -79,11 +92,10 @@ fun SignUpScreen( signUpState: SignUpState, onSignUpClick: () -> Unit, onInputChange: (String) -> Unit, - onFetchCharacter: (Int) -> Unit, + onProfileEditClick: (Boolean) -> Unit, modifier: Modifier = Modifier, ) { val focusManager = LocalFocusManager.current - var showBottomSheet by remember { mutableStateOf(false) } Column( modifier = modifier @@ -99,16 +111,6 @@ fun SignUpScreen( start = 24.dp ) ) - if (showBottomSheet) { - SignUpBottomSheet( - onDismiss = { showBottomSheet = false }, - onSaveClick = { index -> - showBottomSheet = false - onFetchCharacter(index) - }, - initialSelectedOption = signUpState.character - ) - } Text( text = stringResource(id = R.string.sign_up_profile_image), style = TerningTheme.typography.body2, @@ -126,7 +128,7 @@ fun SignUpScreen( ) { ProfileWithPlusButton( modifier = modifier.noRippleClickable { - showBottomSheet = true + onProfileEditClick(true) }, index = signUpState.character ) @@ -172,7 +174,7 @@ fun SignUpScreenPreview() { signUpState = SignUpState(), onSignUpClick = {}, onInputChange = {}, - onFetchCharacter = {} + onProfileEditClick = {} ) } } \ No newline at end of file From 474399c9ebd21f0a822e46ed46ca5dbc48f91720 Mon Sep 17 00:00:00 2001 From: arinming Date: Wed, 28 Aug 2024 18:32:27 +0900 Subject: [PATCH 09/62] =?UTF-8?q?[Refactor]=20=EA=B3=B5=EA=B3=A0=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20Navigation=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/feature/intern/navigation/InternNavigation.kt | 5 ++++- feature/src/main/java/com/terning/feature/main/MainScreen.kt | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt b/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt index a9790044b..751aa15d2 100644 --- a/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt +++ b/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt @@ -4,6 +4,7 @@ import androidx.compose.animation.EnterTransition import androidx.compose.animation.ExitTransition import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavHostController import androidx.navigation.NavOptions import androidx.navigation.compose.composable import androidx.navigation.toRoute @@ -21,7 +22,9 @@ fun NavController.navigateIntern( ) } -fun NavGraphBuilder.internNavGraph() { +fun NavGraphBuilder.internNavGraph( + navHostController: NavHostController, +) { composable( exitTransition = { ExitTransition.None diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index b1398d38a..e5fbb5d02 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -77,7 +77,7 @@ fun MainScreen( changeFilterNavGraph(navHostController = navigator.navController) startFilteringNavGraph(navHostController = navigator.navController) startHomeNavGraph(navHostController = navigator.navController) - internNavGraph() + internNavGraph(navHostController = navigator.navController) } } } From a5f3caab245a65120a08480004137004a166f52e Mon Sep 17 00:00:00 2001 From: arinming Date: Wed, 28 Aug 2024 23:26:26 +0900 Subject: [PATCH 10/62] =?UTF-8?q?[FEAT/#191]=20=EA=B3=B5=EA=B3=A0=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=EA=B8=B0=EC=97=85=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/intern/InternRoute.kt | 44 +++---- .../intern/component/InternCompanyInfo.kt | 112 ++++++++---------- 2 files changed, 65 insertions(+), 91 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index 0f015c5b0..adc3a3a18 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -8,7 +8,9 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Icon import androidx.compose.material3.Scaffold @@ -18,6 +20,8 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource @@ -28,9 +32,12 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle +import coil.compose.AsyncImage +import coil.request.ImageRequest import com.terning.core.designsystem.component.dialog.TerningBasicDialog import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar import com.terning.core.designsystem.theme.Black +import com.terning.core.designsystem.theme.Grey150 import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningMain @@ -141,30 +148,12 @@ fun InternScreen( end = 24.dp ) ) { - Row( - modifier = modifier - .border( - width = 1.dp, - color = TerningMain, - shape = RoundedCornerShape(size = 12.dp) - ), - horizontalArrangement = Arrangement.spacedBy( - 0.dp, - Alignment.CenterHorizontally - ), - verticalAlignment = Alignment.CenterVertically - ) { - Text( - text = internState.dDay, - style = TerningTheme.typography.title5, - color = TerningMain, - modifier = Modifier.padding( - horizontal = 12.dp, - vertical = 2.dp - ) - ) - } - + InternCompanyInfo( + modifier = modifier, + companyImage = internState.companyImage, + company = internState.company, + companyCategory = internState.companyCategory + ) Text( text = internState.title, style = TerningTheme.typography.title2, @@ -223,12 +212,7 @@ fun InternScreen( modifier = modifier, text = stringResource(id = R.string.intern_sub_title_intern_info) ) - InternCompanyInfo( - modifier = modifier, - companyImage = internState.companyImage, - company = internState.company, - companyCategory = internState.companyCategory - ) + InternPageTitle( modifier = modifier, text = stringResource(id = R.string.intern_sub_title_intern_summary) diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt b/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt index afee51466..0ab151077 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt @@ -22,8 +22,8 @@ import androidx.compose.ui.unit.dp import coil.compose.AsyncImage import coil.request.ImageRequest import com.terning.core.designsystem.theme.Black -import com.terning.core.designsystem.theme.Grey300 -import com.terning.core.designsystem.theme.TerningMain +import com.terning.core.designsystem.theme.Grey150 +import com.terning.core.designsystem.theme.Grey350 import com.terning.core.designsystem.theme.TerningTheme import com.terning.feature.R @@ -36,70 +36,60 @@ fun InternCompanyInfo( company: String, companyCategory: String, ) { - Row( - modifier = modifier.padding( - start = 20.dp, - ) + Column( + modifier = Modifier + .fillMaxWidth(), + verticalArrangement = Arrangement.Top, + horizontalAlignment = Alignment.CenterHorizontally, ) { Row( verticalAlignment = Alignment.CenterVertically, - ) { - Column( - verticalArrangement = Arrangement.spacedBy( - 2.dp, - Alignment.CenterVertically - ), - horizontalAlignment = Alignment.Start, - ) { - Row( - verticalAlignment = Alignment.CenterVertically, - modifier = Modifier - .size(60.dp) - .border( - width = 1.dp, - color = TerningMain, - shape = RoundedCornerShape(size = 30.dp) - ) - ) { - AsyncImage( - model = ImageRequest.Builder(LocalContext.current) - .data(companyImage) - .crossfade(true) - .build(), - contentDescription = stringResource(id = R.string.search_image), - contentScale = ContentScale.Fit, - modifier = modifier - .fillMaxWidth() - .clip(CircleShape), - ) - } - } - Column( - verticalArrangement = Arrangement.spacedBy( - 3.dp, - Alignment.Bottom - ), - horizontalAlignment = Alignment.Start, - modifier = modifier - .padding( - horizontal = 12.dp - ) - ) { - Text( - text = company, - style = TerningTheme.typography.title4, - color = Black, - modifier = modifier.padding(top = 11.dp), - maxLines = MAX_LINES, - overflow = TextOverflow.Ellipsis + modifier = Modifier + .size(128.dp) + .border( + width = 1.dp, + color = Grey150, + shape = RoundedCornerShape(size = 20.dp) ) - Text( - text = companyCategory, - style = TerningTheme.typography.body4, - color = Grey300, - modifier = modifier.padding(bottom = 6.dp) + .padding(top = 12.dp) + ) { + AsyncImage( + model = ImageRequest.Builder(LocalContext.current) + .crossfade(true) + .data(companyImage) + .build(), + contentDescription = stringResource(id = R.string.search_image), + contentScale = ContentScale.Fit, + modifier = Modifier + .fillMaxWidth() + .clip(CircleShape), + ) + } + Column( + verticalArrangement = Arrangement.spacedBy( + 4.dp, + Alignment.Bottom + ), + horizontalAlignment = Alignment.CenterHorizontally, + modifier = modifier + .padding( + vertical = 20.dp ) - } + ) { + Text( + text = company, + style = TerningTheme.typography.title4, + color = Black, + modifier = modifier.padding(top = 20.dp), + maxLines = MAX_LINES, + overflow = TextOverflow.Ellipsis + ) + Text( + text = companyCategory, + style = TerningTheme.typography.body4, + color = Grey350, + modifier = modifier.padding(bottom = 8.dp) + ) } } } \ No newline at end of file From e03fc45607958836012ae1fee8b3f525d1297752 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 28 Aug 2024 23:45:47 +0900 Subject: [PATCH 11/62] =?UTF-8?q?[FEAT/#206]=20=ED=94=84=EB=A1=9C=ED=95=84?= =?UTF-8?q?=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/item/ProfileWithPlusButton.kt | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/item/ProfileWithPlusButton.kt b/core/src/main/java/com/terning/core/designsystem/component/item/ProfileWithPlusButton.kt index c5f06c1bf..659f27b03 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/item/ProfileWithPlusButton.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/item/ProfileWithPlusButton.kt @@ -2,10 +2,9 @@ package com.terning.core.designsystem.component.item import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.wrapContentWidth -import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.shape.CircleShape import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -15,7 +14,6 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.terning.core.R -import com.terning.core.designsystem.component.image.TerningImage @Composable fun ProfileWithPlusButton( @@ -36,18 +34,17 @@ fun ProfileWithPlusButton( ) { Image( painterResource(id = grade), - contentDescription = null, + contentDescription = "profile image", modifier = modifier - .clip(shape = RoundedCornerShape(76.dp)) - .size(80.dp) - .aspectRatio(1f), + .clip(shape = CircleShape) + .size(80.dp), contentScale = ContentScale.Crop ) - Box( - modifier = modifier.align(Alignment.BottomEnd) - ) { - TerningImage(painter = R.drawable.ic_sign_up_button) - } + Image( + painter = painterResource(id = R.drawable.ic_sign_up_button), + contentDescription = "plus button", + modifier = Modifier.align(Alignment.BottomEnd) + ) } } From 690e933c78d384c00fbf8caeaf832fd3bcb11ff9 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 28 Aug 2024 23:55:09 +0900 Subject: [PATCH 12/62] =?UTF-8?q?[FEAT/#206]=20=ED=94=84=EB=A1=9C=ED=95=84?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20=EB=B7=B0=20UI=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mypage/profileedit/ProfileEditRoute.kt | 107 ++++++++---------- 1 file changed, 50 insertions(+), 57 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index 41f32ebc4..c5ddd247b 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -3,6 +3,7 @@ package com.terning.feature.mypage.profileedit import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -87,72 +88,64 @@ fun ProfileEditScreen( onBackButtonClick = { onBackButtonClick() }, title = stringResource(id = R.string.profile_edit_title) ) - Column { - Spacer(modifier = modifier.weight(1f)) + Spacer(modifier = modifier.weight(1f)) + Column( + modifier = modifier + .align(Alignment.CenterHorizontally) + .padding(horizontal = 24.dp) + ) { Text( text = stringResource(id = R.string.sign_up_profile_image), style = TerningTheme.typography.body2, - modifier = modifier - .padding( - start = 24.dp, - bottom = 20.dp - ), color = Grey500 ) - Column( + Spacer(modifier = Modifier.height(20.dp)) + ProfileWithPlusButton( modifier = modifier - .align(Alignment.CenterHorizontally) - .padding(bottom = 48.dp) - ) { - ProfileWithPlusButton( - modifier = modifier.noRippleClickable { + .noRippleClickable { onProfileEditClick(true) - }, - index = profileEditState.character - ) - } - Column( - modifier = modifier - .align(Alignment.CenterHorizontally) - .padding(horizontal = 24.dp) - ) { - Text( - text = stringResource(id = R.string.sign_up_name), - modifier = modifier.padding(bottom = 20.dp), - color = Grey500 - ) - NameTextField( - value = name, - onValueChange = { editName -> - onInputChange(editName) - }, - hint = stringResource(id = R.string.sign_up_hint), - drawLineColor = profileEditState.drawLineColor, - helperMessage = profileEditState.helper, - helperIcon = profileEditState.helperIcon, - helperColor = profileEditState.helperColor - ) - Text( - text = stringResource(id = R.string.profile_edit_auth_type), - style = TerningTheme.typography.body2, - color = Grey500, - modifier = Modifier.padding(bottom = 11.dp, top = 48.dp) - ) - Text( - text = profileEditState.authType, - style = TerningTheme.typography.detail0 - ) - } - Spacer(modifier = modifier.weight(5f)) - RectangleButton( - style = TerningTheme.typography.button1, - paddingVertical = 20.dp, - text = R.string.profile_edit_save, - onButtonClick = { onSaveClick() }, - modifier = modifier.padding(bottom = 12.dp), - isEnabled = profileEditState.isButtonValid + } + .align(Alignment.CenterHorizontally), + index = profileEditState.character + ) + Spacer(modifier = Modifier.height(48.dp)) + Text( + text = stringResource(id = R.string.sign_up_name), + color = Grey500 + ) + Spacer(modifier = Modifier.height(20.dp)) + NameTextField( + value = name, + onValueChange = { editName -> + onInputChange(editName) + }, + hint = stringResource(id = R.string.sign_up_hint), + drawLineColor = profileEditState.drawLineColor, + helperMessage = profileEditState.helper, + helperIcon = profileEditState.helperIcon, + helperColor = profileEditState.helperColor + ) + Spacer(modifier = Modifier.height(48.dp)) + Text( + text = stringResource(id = R.string.profile_edit_auth_type), + style = TerningTheme.typography.body2, + color = Grey500, + ) + Spacer(modifier = Modifier.height(11.dp)) + Text( + text = profileEditState.authType, + style = TerningTheme.typography.detail0 ) } + Spacer(modifier = modifier.weight(5f)) + RectangleButton( + style = TerningTheme.typography.button1, + paddingVertical = 20.dp, + text = R.string.profile_edit_save, + onButtonClick = { onSaveClick() }, + isEnabled = profileEditState.isButtonValid + ) + Spacer(modifier = Modifier.height(12.dp)) } } From 7bbc7f9d055aa4e497bd6e68549a1668e0f0ef13 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 29 Aug 2024 06:44:20 +0900 Subject: [PATCH 13/62] =?UTF-8?q?[FEAT/#206]=20navigateUp=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mypage/profileedit/ProfileEditRoute.kt | 15 ++++++++++++++- .../mypage/profileedit/ProfileEditSideEffect.kt | 3 ++- .../mypage/profileedit/ProfileEditViewModel.kt | 4 ++++ .../signup/navigation/SignUpNavigation.kt | 1 - 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index c5ddd247b..224d02827 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -18,7 +19,9 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle +import androidx.lifecycle.flowWithLifecycle import com.terning.core.designsystem.component.bottomsheet.SignUpBottomSheet import com.terning.core.designsystem.component.button.RectangleButton import com.terning.core.designsystem.component.item.ProfileWithPlusButton @@ -41,6 +44,7 @@ fun ProfileEditRoute( var showBottomSheet by remember { mutableStateOf(false) } var name by remember { mutableStateOf(initialName) } + val lifecycleOwner = LocalLifecycleOwner.current if (showBottomSheet) { SignUpBottomSheet( onDismiss = { showBottomSheet = false }, @@ -52,6 +56,15 @@ fun ProfileEditRoute( ) } + LaunchedEffect(viewModel.sideEffects, lifecycleOwner) { + viewModel.sideEffects.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle) + .collect { sideEffect -> + when (sideEffect) { + is ProfileEditSideEffect.NavigateUp -> navigateUp() + } + } + } + ProfileEditScreen( profileEditState = profileEditState, onProfileEditClick = { isVisible -> @@ -63,7 +76,7 @@ fun ProfileEditRoute( }, onSaveClick = {/*TODO: 수정사항 저장 로직*/ }, name = name, - onBackButtonClick = { navigateUp() } + onBackButtonClick = { viewModel.navigateUp() } ) } diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditSideEffect.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditSideEffect.kt index e76e2e007..6fd2f3668 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditSideEffect.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditSideEffect.kt @@ -1,4 +1,5 @@ package com.terning.feature.mypage.profileedit -class ProfileEditSideEffect { +sealed class ProfileEditSideEffect { + data object NavigateUp : ProfileEditSideEffect() } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt index 6b5adbe40..6ec0f0183 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt @@ -1,6 +1,7 @@ package com.terning.feature.mypage.profileedit import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.Grey500 import com.terning.core.designsystem.theme.TerningMain @@ -13,6 +14,7 @@ import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asSharedFlow import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.launch import javax.inject.Inject @HiltViewModel @@ -76,6 +78,8 @@ class ProfileEditViewModel @Inject constructor() : ViewModel() { _state.value = _state.value.copy(character = character) } + fun navigateUp() = viewModelScope.launch { _sideEffects.emit(ProfileEditSideEffect.NavigateUp) } + companion object { const val NAME_ERROR = "[!@#\$%^&*(),.?\":{}|<>\\[\\]\\\\/\\-=+~`\\p{S}\\p{P}]" private const val MAX_LENGTH = 12 diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/navigation/SignUpNavigation.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/navigation/SignUpNavigation.kt index 479e02eda..20ba7bf6f 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/navigation/SignUpNavigation.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/navigation/SignUpNavigation.kt @@ -29,7 +29,6 @@ fun NavGraphBuilder.signUpNavGraph( SignUpRoute( authId = args.authId, navigateToStartFiltering = { name -> navHostController.navigateFilteringOne(name) } - ) } } From eb8f82b11d34d8766ab5f0340596e2e1dcfd6f68 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 29 Aug 2024 06:51:28 +0900 Subject: [PATCH 14/62] =?UTF-8?q?[FIX/#206]=20state=20=EA=B4=80=EB=A6=AC?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mypage/profileedit/ProfileEditRoute.kt | 18 ++++++------------ .../mypage/profileedit/ProfileEditState.kt | 3 ++- .../mypage/profileedit/ProfileEditViewModel.kt | 10 +++++++++- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index 224d02827..e48ecd21a 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -9,9 +9,6 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalFocusManager @@ -41,16 +38,14 @@ fun ProfileEditRoute( initialName: String = "", ) { val profileEditState by viewModel.state.collectAsStateWithLifecycle() - var showBottomSheet by remember { mutableStateOf(false) } - var name by remember { mutableStateOf(initialName) } val lifecycleOwner = LocalLifecycleOwner.current - if (showBottomSheet) { + if (profileEditState.showBottomSheet) { SignUpBottomSheet( - onDismiss = { showBottomSheet = false }, + onDismiss = { viewModel.updateBottomSheet(false) }, onSaveClick = { index -> - showBottomSheet = false - viewModel.fetchCharacter(index) + viewModel.updateBottomSheet(false) + viewModel.updateCharacter(index) }, initialSelectedOption = profileEditState.character ) @@ -68,14 +63,13 @@ fun ProfileEditRoute( ProfileEditScreen( profileEditState = profileEditState, onProfileEditClick = { isVisible -> - showBottomSheet = isVisible + viewModel.updateBottomSheet(isVisible) }, onInputChange = { editName -> - name = editName viewModel.isInputValid(editName) }, onSaveClick = {/*TODO: 수정사항 저장 로직*/ }, - name = name, + name = initialName, onBackButtonClick = { viewModel.navigateUp() } ) } diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt index 2a4934adb..3dcecf141 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt @@ -14,5 +14,6 @@ data class ProfileEditState( val helperIcon: Int? = null, val helperColor: Color = Grey400, val isButtonValid: Boolean = true, - val authType: String = "" + val authType: String = "", + val showBottomSheet: Boolean = false ) \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt index 6ec0f0183..e4e955266 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt @@ -74,12 +74,20 @@ class ProfileEditViewModel @Inject constructor() : ViewModel() { } } - fun fetchCharacter(character: Int) { + fun updateCharacter(character: Int) { _state.value = _state.value.copy(character = character) } fun navigateUp() = viewModelScope.launch { _sideEffects.emit(ProfileEditSideEffect.NavigateUp) } + fun updateBottomSheet(isVisible: Boolean) { + _state.value = _state.value.copy(showBottomSheet = isVisible) + } + + fun updateName(name: String){ + _state.value = _state.value.copy(name = name) + } + companion object { const val NAME_ERROR = "[!@#\$%^&*(),.?\":{}|<>\\[\\]\\\\/\\-=+~`\\p{S}\\p{P}]" private const val MAX_LENGTH = 12 From bfbd58ab3dfd416e0b7839bd449fc3d84fe0d904 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 29 Aug 2024 07:02:24 +0900 Subject: [PATCH 15/62] =?UTF-8?q?[FIX/#206]=20state=20=EA=B4=80=EB=A6=AC?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/feature/mypage/profileedit/ProfileEditRoute.kt | 7 ++++++- .../feature/mypage/profileedit/ProfileEditViewModel.kt | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index e48ecd21a..98c774e51 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -40,6 +40,11 @@ fun ProfileEditRoute( val profileEditState by viewModel.state.collectAsStateWithLifecycle() val lifecycleOwner = LocalLifecycleOwner.current + + LaunchedEffect(key1 = true) { + viewModel.updateName(initialName) + } + if (profileEditState.showBottomSheet) { SignUpBottomSheet( onDismiss = { viewModel.updateBottomSheet(false) }, @@ -69,7 +74,7 @@ fun ProfileEditRoute( viewModel.isInputValid(editName) }, onSaveClick = {/*TODO: 수정사항 저장 로직*/ }, - name = initialName, + name = profileEditState.name, onBackButtonClick = { viewModel.navigateUp() } ) } diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt index e4e955266..a8fa3c8ff 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt @@ -84,7 +84,7 @@ class ProfileEditViewModel @Inject constructor() : ViewModel() { _state.value = _state.value.copy(showBottomSheet = isVisible) } - fun updateName(name: String){ + fun updateName(name: String) { _state.value = _state.value.copy(name = name) } From 47792226185eba8cadf7295b1190600176c60502 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 29 Aug 2024 07:04:12 +0900 Subject: [PATCH 16/62] =?UTF-8?q?[FIX/#206]=20state=20=EB=B3=80=EC=88=98?= =?UTF-8?q?=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/mypage/profileedit/ProfileEditRoute.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index 98c774e51..0acb8a067 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -37,7 +37,7 @@ fun ProfileEditRoute( viewModel: ProfileEditViewModel = hiltViewModel(), initialName: String = "", ) { - val profileEditState by viewModel.state.collectAsStateWithLifecycle() + val state by viewModel.state.collectAsStateWithLifecycle() val lifecycleOwner = LocalLifecycleOwner.current @@ -45,14 +45,14 @@ fun ProfileEditRoute( viewModel.updateName(initialName) } - if (profileEditState.showBottomSheet) { + if (state.showBottomSheet) { SignUpBottomSheet( onDismiss = { viewModel.updateBottomSheet(false) }, onSaveClick = { index -> viewModel.updateBottomSheet(false) viewModel.updateCharacter(index) }, - initialSelectedOption = profileEditState.character + initialSelectedOption = state.character ) } @@ -66,7 +66,7 @@ fun ProfileEditRoute( } ProfileEditScreen( - profileEditState = profileEditState, + profileEditState = state, onProfileEditClick = { isVisible -> viewModel.updateBottomSheet(isVisible) }, @@ -74,7 +74,7 @@ fun ProfileEditRoute( viewModel.isInputValid(editName) }, onSaveClick = {/*TODO: 수정사항 저장 로직*/ }, - name = profileEditState.name, + name = state.name, onBackButtonClick = { viewModel.navigateUp() } ) } From 6afb48436296d85f3f055051a5801e35a00172ff Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Fri, 30 Aug 2024 01:16:52 +0900 Subject: [PATCH 17/62] =?UTF-8?q?[FEAT/#208]=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=20=EC=84=9C=EB=B2=84=20=EC=A3=BC=EC=86=8C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e01b17572..e53028e48 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -38,7 +38,7 @@ android { buildConfigField( "String", "BASE_URL", - gradleLocalProperties(rootDir, providers).getProperty("base.url") + gradleLocalProperties(rootDir, providers).getProperty("test.base.url") ) } release { From 45d79fbd6d85a12855bc835a07b5ef00ae080e31 Mon Sep 17 00:00:00 2001 From: arinming Date: Fri, 30 Aug 2024 18:36:06 +0900 Subject: [PATCH 18/62] =?UTF-8?q?[FEAT/#191]=20=EA=B3=B5=EA=B3=A0=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=EA=B8=B0=EC=97=85=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=A1=9C=EB=93=9C=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/intern/InternRoute.kt | 76 +++++++++---------- .../terning/feature/intern/InternViewModel.kt | 18 ++--- .../intern/component/InternCompanyInfo.kt | 1 - .../intern/component/ScrapDialogContent.kt | 2 +- .../feature/intern/model/InternState.kt | 28 ------- .../feature/intern/model/InternUiState.kt | 16 ++++ 6 files changed, 59 insertions(+), 82 deletions(-) delete mode 100644 feature/src/main/java/com/terning/feature/intern/model/InternState.kt create mode 100644 feature/src/main/java/com/terning/feature/intern/model/InternUiState.kt diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index adc3a3a18..4719398db 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -8,9 +8,7 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Icon import androidx.compose.material3.Scaffold @@ -20,37 +18,32 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip -import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource -import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.viewinterop.AndroidView import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle -import coil.compose.AsyncImage -import coil.request.ImageRequest import com.terning.core.designsystem.component.dialog.TerningBasicDialog import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar import com.terning.core.designsystem.theme.Black -import com.terning.core.designsystem.theme.Grey150 import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningMain -import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.customShadow import com.terning.core.extension.toast +import com.terning.core.state.UiState +import com.terning.domain.entity.response.InternInfoModel import com.terning.feature.R import com.terning.feature.intern.component.InternBottomBar import com.terning.feature.intern.component.InternCompanyInfo import com.terning.feature.intern.component.InternInfoRow import com.terning.feature.intern.component.InternPageTitle -import com.terning.feature.intern.model.InternState +import com.terning.feature.intern.model.InternUiState import java.text.DecimalFormat @Composable @@ -58,7 +51,7 @@ fun InternRoute( announcementId: Long = 0, viewModel: InternViewModel = hiltViewModel(), ) { - val internState by viewModel.state.collectAsStateWithLifecycle() + val internState by viewModel.internUiState.collectAsStateWithLifecycle() val context = LocalContext.current val lifecycleOwner = LocalLifecycleOwner.current @@ -76,29 +69,38 @@ fun InternRoute( } } - InternScreen( - internState = internState - ) + when (internState.loadState) { + UiState.Loading -> {} + UiState.Empty -> {} + is UiState.Failure -> {} + is UiState.Success -> { + InternScreen( + internUiState = internState, + internInfoModel = (internState.loadState as UiState.Success).data + ) + } + } } @Composable fun InternScreen( modifier: Modifier = Modifier, viewModel: InternViewModel = hiltViewModel(), - internState: InternState, + internUiState: InternUiState, + internInfoModel: InternInfoModel, ) { val decimal = DecimalFormat("#,###") val internInfoList = listOf( - stringResource(id = R.string.intern_info_d_day) to internState.deadline, - stringResource(id = R.string.intern_info_working) to internState.workingPeriod, - stringResource(id = R.string.intern_info_start_date) to internState.startDate, + stringResource(id = R.string.intern_info_d_day) to internInfoModel.deadline, + stringResource(id = R.string.intern_info_working) to internInfoModel.workingPeriod, + stringResource(id = R.string.intern_info_start_date) to internInfoModel.startDate, ) - val qualificationList = internState.qualification.split(",").map { it.trim() } - val jobTypeList = internState.jobType.split(",").map { it.trim() } + val qualificationList = internInfoModel.qualification.split(",").map { it.trim() } + val jobTypeList = internInfoModel.jobType.split(",").map { it.trim() } - if (internState.showWeb) { + if (internUiState.showWeb) { AndroidView( factory = { WebView(it).apply { @@ -106,7 +108,7 @@ fun InternScreen( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, ) - loadUrl(internState.url) + loadUrl(internInfoModel.url) } }, ) @@ -128,8 +130,8 @@ fun InternScreen( bottomBar = { InternBottomBar( modifier = modifier, - scrapCount = decimal.format(internState.scrapCount), - scrapId = internState.scrapId, + scrapCount = decimal.format(internInfoModel.scrapCount), + scrapId = internInfoModel.scrapId, onScrapClick = { viewModel.updateScrapDialogVisible(true) } @@ -150,13 +152,13 @@ fun InternScreen( ) { InternCompanyInfo( modifier = modifier, - companyImage = internState.companyImage, - company = internState.company, - companyCategory = internState.companyCategory + companyImage = internInfoModel.companyImage, + company = internInfoModel.company, + companyCategory = internInfoModel.companyCategory ) Text( - text = internState.title, - style = TerningTheme.typography.title2, + text = internInfoModel.title, + style = TerningTheme.typography.heading2, color = Black, modifier = modifier.padding( top = 4.dp, @@ -198,7 +200,7 @@ fun InternScreen( color = Grey400 ) Text( - text = "${decimal.format(internState.viewCount)}회", + text = "${decimal.format(internInfoModel.viewCount)}회", style = TerningTheme.typography.button4, color = Grey400, ) @@ -328,7 +330,7 @@ fun InternScreen( ) ) { Text( - text = internState.detail.trimIndent(), + text = internInfoModel.detail.trimIndent(), style = TerningTheme.typography.detail1, color = Grey400 ) @@ -336,7 +338,7 @@ fun InternScreen( } } } - if (internState.isScrapDialogVisible) { + if (internUiState.isScrapDialogVisible) { TerningBasicDialog( onDismissRequest = { viewModel.updateScrapDialogVisible(false) @@ -345,14 +347,4 @@ fun InternScreen( ) } } -} - -@Preview(showBackground = true) -@Composable -fun InternScreenPreview() { - TerningPointTheme { - InternScreen( - internState = InternState(), - ) - } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt b/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt index 3a63ea8f8..737c134db 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt @@ -9,11 +9,10 @@ import com.terning.domain.repository.InternRepository import com.terning.domain.repository.ScrapRepository import com.terning.feature.R import com.terning.feature.intern.model.InternScrapState -import com.terning.feature.intern.model.InternState +import com.terning.feature.intern.model.InternUiState import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asSharedFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.update @@ -25,9 +24,8 @@ class InternViewModel @Inject constructor( private val internRepository: InternRepository, private val scrapRepository: ScrapRepository, ) : ViewModel() { - private val _internState: MutableStateFlow = - MutableStateFlow(InternState()) - val state: StateFlow = _internState.asStateFlow() + private val _internUiState = MutableStateFlow(InternUiState()) + val internUiState get() = _internUiState.asStateFlow() private val _scrapState: MutableStateFlow = MutableStateFlow(InternScrapState()) @@ -97,31 +95,31 @@ class InternViewModel @Inject constructor( } fun updateSelectColor(newColor: Color) { - _internState.update { + _internUiState.update { it.copy(selectedColor = newColor) } } fun updateScrapDialogVisible(visible: Boolean) { - _internState.update { + _internUiState.update { it.copy(isScrapDialogVisible = visible) } } fun updatePaletteOpen(open: Boolean) { - _internState.update { + _internUiState.update { it.copy(isPaletteOpen = open) } } fun updateColorChange(change: Boolean) { - _internState.update { + _internUiState.update { it.copy(isColorChange = change) } } fun updateShowWeb(show: Boolean) { - _internState.update { + _internUiState.update { it.copy(showWeb = show) } } diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt b/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt index 0ab151077..093d1e3e1 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt @@ -73,7 +73,6 @@ fun InternCompanyInfo( horizontalAlignment = Alignment.CenterHorizontally, modifier = modifier .padding( - vertical = 20.dp ) ) { Text( diff --git a/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt b/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt index 17335a3a8..3746f5f13 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/ScrapDialogContent.kt @@ -65,7 +65,7 @@ fun ScrapDialogContent( announcementId: Long, type: Int, ) { - val state by viewModel.state.collectAsStateWithLifecycle() + val state by viewModel.internUiState.collectAsStateWithLifecycle() val colorList = listOf( CalRed, diff --git a/feature/src/main/java/com/terning/feature/intern/model/InternState.kt b/feature/src/main/java/com/terning/feature/intern/model/InternState.kt deleted file mode 100644 index 55d2b80c7..000000000 --- a/feature/src/main/java/com/terning/feature/intern/model/InternState.kt +++ /dev/null @@ -1,28 +0,0 @@ -package com.terning.feature.intern.model - -import androidx.compose.ui.graphics.Color -import com.terning.core.designsystem.theme.CalRed - -data class InternState( - val dDay: String = "", - val title: String = "", - val deadline: String = "", - val workingPeriod: String = "", - val startDate: String = "", - val scrapCount: Int = 0, - val viewCount: Int = 0, - val company: String = "", - val companyCategory: String = "", - val companyImage: String = "", - val qualification: String = "", - val jobType: String = "", - val detail: String = "", - val url: String = "", - val scrapId: Long? = null, - val isColorChange: Boolean = false, - val isPaletteOpen: Boolean = false, - val selectedColor: Color = CalRed, - val isScrapDialogVisible: Boolean = false, - val isScrappedState: Boolean = false, - val showWeb: Boolean = false, -) \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/intern/model/InternUiState.kt b/feature/src/main/java/com/terning/feature/intern/model/InternUiState.kt new file mode 100644 index 000000000..16f8afcc3 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/intern/model/InternUiState.kt @@ -0,0 +1,16 @@ +package com.terning.feature.intern.model + +import androidx.compose.ui.graphics.Color +import com.terning.core.designsystem.theme.CalRed +import com.terning.core.state.UiState +import com.terning.domain.entity.response.InternInfoModel + +data class InternUiState( + val loadState: UiState = UiState.Loading, + val isColorChange: Boolean = false, + val isPaletteOpen: Boolean = false, + val selectedColor: Color = CalRed, + val isScrapDialogVisible: Boolean = false, + val isScrappedState: Boolean = false, + val showWeb: Boolean = false, +) \ No newline at end of file From 8e041910b21d857ddbb229ecb35a2d1e71712d02 Mon Sep 17 00:00:00 2001 From: arinming Date: Fri, 30 Aug 2024 18:42:17 +0900 Subject: [PATCH 19/62] =?UTF-8?q?[FEAT/#191]=20=EA=B3=B5=EA=B3=A0=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=EA=B8=B0=EC=97=85=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=B6=88=EB=9F=AC=EC=98=A4?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/feature/intern/InternViewModel.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt b/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt index 737c134db..7322223a9 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt @@ -35,17 +35,19 @@ class InternViewModel @Inject constructor( fun getInternInfo(id: Long) { viewModelScope.launch { - internRepository.getInternInfo( - id - ).onSuccess { internInfo -> - }.onFailure { - _sideEffect.emit( - InternViewSideEffect.Toast(R.string.server_failure) - ) - } + internRepository.getInternInfo(id) + .onSuccess { internInfoModel -> + _internUiState.update { currentState -> + currentState.copy(loadState = UiState.Success(internInfoModel)) + } + } + .onFailure { + _sideEffect.emit(InternViewSideEffect.Toast(R.string.server_failure)) + } } } + fun postScrap( id: Long, color: Int, From 8913d5e9c19d49c81f66ea630e8a9c27654159f2 Mon Sep 17 00:00:00 2001 From: arinming Date: Fri, 30 Aug 2024 18:54:30 +0900 Subject: [PATCH 20/62] =?UTF-8?q?[FEAT/#191]=20D-Day=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/intern/InternRoute.kt | 36 ++++++++++++++++--- .../intern/component/InternCompanyInfo.kt | 3 +- feature/src/main/res/values/strings.xml | 1 - 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index 4719398db..a3408c08c 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -2,10 +2,12 @@ package com.terning.feature.intern import android.view.ViewGroup import android.webkit.WebView +import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn @@ -33,6 +35,7 @@ import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningMain +import com.terning.core.designsystem.theme.TerningSub3 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.customShadow import com.terning.core.extension.toast @@ -150,12 +153,40 @@ fun InternScreen( end = 24.dp ) ) { + Spacer(modifier = modifier.padding(top = 16.dp)) + InternCompanyInfo( modifier = modifier, companyImage = internInfoModel.companyImage, company = internInfoModel.company, companyCategory = internInfoModel.companyCategory ) + + Spacer(modifier = modifier.padding(top = 20.dp)) + + Row( + modifier = modifier + .background( + color = TerningSub3, + shape = RoundedCornerShape(size = 5.dp) + ), + horizontalArrangement = Arrangement.spacedBy( + 0.dp, + Alignment.CenterHorizontally + ), + verticalAlignment = Alignment.CenterVertically + ) { + Text( + text = internInfoModel.dDay, + style = TerningTheme.typography.title3, + color = TerningMain, + modifier = Modifier.padding( + horizontal = 19.5.dp, + vertical = 1.5.dp + ) + ) + } + Text( text = internInfoModel.title, style = TerningTheme.typography.heading2, @@ -194,11 +225,6 @@ fun InternScreen( top = 9.dp, ) ) { - Text( - text = stringResource(id = R.string.intern_view_count), - style = TerningTheme.typography.detail3, - color = Grey400 - ) Text( text = "${decimal.format(internInfoModel.viewCount)}회", style = TerningTheme.typography.button4, diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt b/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt index 093d1e3e1..aa2ce345f 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt @@ -51,7 +51,6 @@ fun InternCompanyInfo( color = Grey150, shape = RoundedCornerShape(size = 20.dp) ) - .padding(top = 12.dp) ) { AsyncImage( model = ImageRequest.Builder(LocalContext.current) @@ -59,7 +58,7 @@ fun InternCompanyInfo( .data(companyImage) .build(), contentDescription = stringResource(id = R.string.search_image), - contentScale = ContentScale.Fit, + contentScale = ContentScale.Crop, modifier = Modifier .fillMaxWidth() .clip(CircleShape), diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 7d1c5157d..8c649e3cb 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -122,7 +122,6 @@ 공유 아이콘 지원 사이트로 이동하기 공고 정보 - 조회수 %s회 서류 마감 근무 기간 From 883a1dc6438311288d9256825eb679cfa7d83935 Mon Sep 17 00:00:00 2001 From: arinming Date: Fri, 30 Aug 2024 19:05:43 +0900 Subject: [PATCH 21/62] =?UTF-8?q?[FEAT/#191]=20InternTitle=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/intern/InternRoute.kt | 54 ++---------- .../feature/intern/component/InternTitle.kt | 85 +++++++++++++++++++ feature/src/main/res/drawable/ic_view_14.xml | 20 +++++ 3 files changed, 111 insertions(+), 48 deletions(-) create mode 100644 feature/src/main/java/com/terning/feature/intern/component/InternTitle.kt create mode 100644 feature/src/main/res/drawable/ic_view_14.xml diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index a3408c08c..339f658c6 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -2,7 +2,6 @@ package com.terning.feature.intern import android.view.ViewGroup import android.webkit.WebView -import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -35,7 +34,6 @@ import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningMain -import com.terning.core.designsystem.theme.TerningSub3 import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.customShadow import com.terning.core.extension.toast @@ -46,6 +44,7 @@ import com.terning.feature.intern.component.InternBottomBar import com.terning.feature.intern.component.InternCompanyInfo import com.terning.feature.intern.component.InternInfoRow import com.terning.feature.intern.component.InternPageTitle +import com.terning.feature.intern.component.InternTitle import com.terning.feature.intern.model.InternUiState import java.text.DecimalFormat @@ -164,37 +163,11 @@ fun InternScreen( Spacer(modifier = modifier.padding(top = 20.dp)) - Row( - modifier = modifier - .background( - color = TerningSub3, - shape = RoundedCornerShape(size = 5.dp) - ), - horizontalArrangement = Arrangement.spacedBy( - 0.dp, - Alignment.CenterHorizontally - ), - verticalAlignment = Alignment.CenterVertically - ) { - Text( - text = internInfoModel.dDay, - style = TerningTheme.typography.title3, - color = TerningMain, - modifier = Modifier.padding( - horizontal = 19.5.dp, - vertical = 1.5.dp - ) - ) - } - - Text( - text = internInfoModel.title, - style = TerningTheme.typography.heading2, - color = Black, - modifier = modifier.padding( - top = 4.dp, - bottom = 16.dp - ) + InternTitle( + modifier = modifier, + dDay = internInfoModel.dDay, + title = internInfoModel.title, + viewCount = decimal.format(internInfoModel.viewCount) ) Column( @@ -216,21 +189,6 @@ fun InternScreen( InternInfoRow(title, value) } } - Row( - horizontalArrangement = Arrangement.spacedBy(3.dp, Alignment.End), - verticalAlignment = Alignment.CenterVertically, - modifier = modifier - .fillMaxWidth() - .padding( - top = 9.dp, - ) - ) { - Text( - text = "${decimal.format(internInfoModel.viewCount)}회", - style = TerningTheme.typography.button4, - color = Grey400, - ) - } } Column( diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternTitle.kt b/feature/src/main/java/com/terning/feature/intern/component/InternTitle.kt new file mode 100644 index 000000000..30acbd9bd --- /dev/null +++ b/feature/src/main/java/com/terning/feature/intern/component/InternTitle.kt @@ -0,0 +1,85 @@ +package com.terning.feature.intern.component + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import com.terning.core.designsystem.component.image.TerningImage +import com.terning.core.designsystem.theme.Black +import com.terning.core.designsystem.theme.Grey400 +import com.terning.core.designsystem.theme.TerningMain +import com.terning.core.designsystem.theme.TerningSub3 +import com.terning.core.designsystem.theme.TerningTheme +import com.terning.feature.R + + +@Composable +fun InternTitle( + modifier: Modifier, + dDay: String, + title: String, + viewCount: String, +) { + Column( + modifier = Modifier + .fillMaxWidth(), + ) { + Row( + modifier = modifier + .background( + color = TerningSub3, + shape = RoundedCornerShape(size = 5.dp) + ), + horizontalArrangement = Arrangement.spacedBy( + 0.dp, + Alignment.CenterHorizontally + ), + verticalAlignment = Alignment.CenterVertically + ) { + Text( + text = dDay, + style = TerningTheme.typography.title3, + color = TerningMain, + modifier = Modifier.padding( + horizontal = 19.5.dp, + vertical = 1.5.dp + ) + ) + } + + Text( + text = title, + style = TerningTheme.typography.heading2, + color = Black, + modifier = modifier.padding( + top = 8.dp, + bottom = 4.dp + ) + ) + + Row( + horizontalArrangement = Arrangement.spacedBy(3.dp, Alignment.Start), + verticalAlignment = Alignment.CenterVertically, + modifier = modifier + .fillMaxWidth() + ) { + TerningImage( + painter = R.drawable.ic_view_14 + ) + Text( + text = stringResource(id = R.string.intern_view_count_detail, viewCount), + style = TerningTheme.typography.button4, + color = Grey400, + ) + } + } +} \ No newline at end of file diff --git a/feature/src/main/res/drawable/ic_view_14.xml b/feature/src/main/res/drawable/ic_view_14.xml new file mode 100644 index 000000000..3f6e68ef5 --- /dev/null +++ b/feature/src/main/res/drawable/ic_view_14.xml @@ -0,0 +1,20 @@ + + + + From f8c1be2d56ec8ec88caec574d5492e43772694d0 Mon Sep 17 00:00:00 2001 From: arinming Date: Fri, 30 Aug 2024 19:11:16 +0900 Subject: [PATCH 22/62] =?UTF-8?q?[FEAT/#191]=20Grey=20375=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EB=B0=8F=20=EC=A1=B0=ED=9A=8C=EC=88=98=20=EB=B0=98?= =?UTF-8?q?=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/terning/core/designsystem/theme/Color.kt | 1 + .../com/terning/feature/intern/component/InternTitle.kt | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/theme/Color.kt b/core/src/main/java/com/terning/core/designsystem/theme/Color.kt index bea5eb805..807bc9813 100644 --- a/core/src/main/java/com/terning/core/designsystem/theme/Color.kt +++ b/core/src/main/java/com/terning/core/designsystem/theme/Color.kt @@ -9,6 +9,7 @@ val Grey150 = Color(0xFFE9E9E9) val Grey200 = Color(0xFFDDDDDD) val Grey300 = Color(0xFFBCBCBC) val Grey350 = Color(0xFFADADAD) +val Grey375 = Color(0xFF898989) val Grey400 = Color(0xFF666666) val Grey500 = Color(0xFF373737) val Black = Color(0xFF171717) diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternTitle.kt b/feature/src/main/java/com/terning/feature/intern/component/InternTitle.kt index 30acbd9bd..1432f41ee 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternTitle.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternTitle.kt @@ -15,7 +15,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.terning.core.designsystem.component.image.TerningImage import com.terning.core.designsystem.theme.Black -import com.terning.core.designsystem.theme.Grey400 +import com.terning.core.designsystem.theme.Grey375 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningSub3 import com.terning.core.designsystem.theme.TerningTheme @@ -77,8 +77,8 @@ fun InternTitle( ) Text( text = stringResource(id = R.string.intern_view_count_detail, viewCount), - style = TerningTheme.typography.button4, - color = Grey400, + style = TerningTheme.typography.detail2, + color = Grey375, ) } } From a4d5191e03f42401ac7259595c298761f3b5e85c Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 31 Aug 2024 18:47:59 +0900 Subject: [PATCH 23/62] [FIX/#206] fix Regex --- .../designsystem/component/textfield/NameTextField.kt | 8 ++++++++ core/src/main/java/com/terning/core/util/Regex.kt | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 core/src/main/java/com/terning/core/util/Regex.kt diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt index 9d78f7162..49a618f89 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt @@ -28,6 +28,14 @@ fun NameTextField( val focusManager = LocalFocusManager.current val keyboardController = LocalSoftwareKeyboardController.current + val nameErrorRegex = Regex(NAME_ERROR) + var trimmedName = "" + var outOfBoundName = false + if (name.length > MAX_LENGTH) { + trimmedName = name.substring(0, MAX_LENGTH) + outOfBoundName = true + } else trimmedName = name + TerningBasicTextField( value = value, onValueChange = onValueChange, diff --git a/core/src/main/java/com/terning/core/util/Regex.kt b/core/src/main/java/com/terning/core/util/Regex.kt new file mode 100644 index 000000000..4fd047690 --- /dev/null +++ b/core/src/main/java/com/terning/core/util/Regex.kt @@ -0,0 +1,8 @@ +package com.terning.core.util + +import java.util.regex.Pattern + +private const val NAME_ERROR_PATTERN = + "[!@#\$%^&*(),.?\":{}|<>\\[\\]\\\\/\\-=+~`\\p{S}\\p{P}]" +val NAME_ERROR_REGEX: Pattern = + Pattern.compile(NAME_ERROR_PATTERN) From 2c990b586b2bfa3bfcd1536b3b983678bf866f8c Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 31 Aug 2024 23:34:23 +0900 Subject: [PATCH 24/62] =?UTF-8?q?[FIX/#208]=20=ED=86=A0=ED=81=B0=20?= =?UTF-8?q?=EC=9E=AC=EB=B0=9C=EA=B8=89=20=EB=A1=9C=EC=A7=81=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/terning/point/di/AuthInterceptor.kt | 8 ++++---- .../java/com/terning/domain/entity/auth/TokenReissue.kt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/terning/point/di/AuthInterceptor.kt b/app/src/main/java/com/terning/point/di/AuthInterceptor.kt index cc8680022..43de4f28b 100644 --- a/app/src/main/java/com/terning/point/di/AuthInterceptor.kt +++ b/app/src/main/java/com/terning/point/di/AuthInterceptor.kt @@ -26,9 +26,9 @@ class AuthInterceptor @Inject constructor( override fun intercept(chain: Interceptor.Chain): Response { val originalRequest = chain.request() - Timber.d("GET REFRESH TOKEN : ${terningDataStore.refreshToken}") + Timber.d("GET ACCESS TOKEN : ${terningDataStore.accessToken}") - val authRequest = if (terningDataStore.refreshToken.isNotBlank()) { + val authRequest = if (terningDataStore.accessToken.isNotBlank()) { originalRequest.newBuilder().newAuthBuilder().build() } else { originalRequest @@ -45,7 +45,7 @@ class AuthInterceptor @Inject constructor( ) }.onSuccess { data -> terningDataStore.apply { - refreshToken = data.refreshToken + accessToken = data.accessToken } response.close() @@ -77,7 +77,7 @@ class AuthInterceptor @Inject constructor( } private fun Request.Builder.newAuthBuilder() = - this.addHeader(AUTHORIZATION, "$BEARER ${terningDataStore.refreshToken}") + this.addHeader(AUTHORIZATION, "$BEARER ${terningDataStore.accessToken}") companion object { private const val CODE_TOKEN_EXPIRED = 401 diff --git a/domain/src/main/java/com/terning/domain/entity/auth/TokenReissue.kt b/domain/src/main/java/com/terning/domain/entity/auth/TokenReissue.kt index 9841acf59..933015dfc 100644 --- a/domain/src/main/java/com/terning/domain/entity/auth/TokenReissue.kt +++ b/domain/src/main/java/com/terning/domain/entity/auth/TokenReissue.kt @@ -1,5 +1,5 @@ package com.terning.domain.entity.auth data class TokenReissue ( - val refreshToken : String + val accessToken : String ) \ No newline at end of file From dd016d79c3c2c57e2fba30c3b679c782c767a15d Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sat, 31 Aug 2024 23:50:35 +0900 Subject: [PATCH 25/62] =?UTF-8?q?[FIX/#208]=20=ED=86=A0=EA=B7=BC=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/data/dto/response/TokenReissueResponseDto.kt | 4 ++-- .../java/com/terning/data/mapper/auth/TokenReissueMapper.kt | 2 +- .../com/terning/feature/onboarding/signup/SignUpRoute.kt | 4 ++-- .../com/terning/feature/onboarding/signup/SignUpState.kt | 2 +- .../terning/feature/onboarding/signup/SignUpViewModel.kt | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/data/src/main/java/com/terning/data/dto/response/TokenReissueResponseDto.kt b/data/src/main/java/com/terning/data/dto/response/TokenReissueResponseDto.kt index 56647b905..91cca0810 100644 --- a/data/src/main/java/com/terning/data/dto/response/TokenReissueResponseDto.kt +++ b/data/src/main/java/com/terning/data/dto/response/TokenReissueResponseDto.kt @@ -5,6 +5,6 @@ import kotlinx.serialization.Serializable @Serializable data class TokenReissueResponseDto( - @SerialName("refreshToken") - val refreshToken: String + @SerialName("accessToken") + val accessToken: String ) \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/mapper/auth/TokenReissueMapper.kt b/data/src/main/java/com/terning/data/mapper/auth/TokenReissueMapper.kt index 90e2e964f..176698aa6 100644 --- a/data/src/main/java/com/terning/data/mapper/auth/TokenReissueMapper.kt +++ b/data/src/main/java/com/terning/data/mapper/auth/TokenReissueMapper.kt @@ -4,4 +4,4 @@ import com.terning.data.dto.response.TokenReissueResponseDto import com.terning.domain.entity.auth.TokenReissue fun TokenReissueResponseDto.toTokenReissue(): TokenReissue = - TokenReissue(refreshToken = refreshToken) + TokenReissue(accessToken = accessToken) diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index 61dce1b1d..f6bdda5f4 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -105,7 +105,7 @@ fun SignUpScreen( showBottomSheet = false onFetchCharacter(index) }, - initialSelectedOption = signUpState.character + initialSelectedOption = signUpState.profileImage ) } Text( @@ -126,7 +126,7 @@ fun SignUpScreen( modifier = modifier.noRippleClickable { showBottomSheet = true }, - index = signUpState.character + index = signUpState.profileImage ) } Column( diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt index 9874f996d..5cc946587 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt @@ -8,7 +8,7 @@ import com.terning.feature.R data class SignUpState( val name: String = "", - val character: Int = 0, + val profileImage: Int = 0, val drawLineColor: Color = Grey500, @StringRes val helper: Int = R.string.sign_up_helper, val helperIcon: Int? = null, diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt index 52f46f86f..3fcb5f02f 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt @@ -80,8 +80,8 @@ class SignUpViewModel @Inject constructor( } } - fun fetchCharacter(character: Int) { - _state.value = _state.value.copy(character = character) + fun fetchCharacter(profileImage: Int) { + _state.value = _state.value.copy(profileImage = profileImage) } fun fetchAuthId(authId: String) { @@ -95,7 +95,7 @@ class SignUpViewModel @Inject constructor( state.value.run { SignUpRequest( name = name, - profileImage = character, + profileImage = profileImage, authType = KAKA0 ) } From 64ff32a940a8c030ad4fddeaed53ef00c833eb96 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sun, 1 Sep 2024 01:08:04 +0900 Subject: [PATCH 26/62] =?UTF-8?q?[FIX/#206]=20NameTextField=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=ED=86=B5=ED=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/textfield/NameTextField.kt | 98 +++++++++++++++---- core/src/main/res/values/strings.xml | 5 + .../mypage/profileedit/ProfileEditRoute.kt | 14 +-- .../mypage/profileedit/ProfileEditState.kt | 10 -- .../profileedit/ProfileEditViewModel.kt | 55 +---------- .../feature/onboarding/signup/SignUpRoute.kt | 14 +-- .../feature/onboarding/signup/SignUpState.kt | 10 -- .../onboarding/signup/SignUpViewModel.kt | 56 +---------- feature/src/main/res/values/strings.xml | 4 - 9 files changed, 107 insertions(+), 159 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt index 0cb6c1554..d3eb69fb3 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt @@ -1,6 +1,5 @@ package com.terning.core.designsystem.component.textfield -import androidx.annotation.StringRes import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -9,48 +8,109 @@ import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.ImeAction +import com.terning.core.R import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.Grey400 +import com.terning.core.designsystem.theme.Grey500 +import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.designsystem.theme.WarningRed +import com.terning.core.util.NAME_ERROR_REGEX + +data class NameFieldState( + val name: String, + val lineColor: Color, + val helperMessage: Int, + val helperIcon: Int?, + val helperColor: Color, + val isValid: Boolean +) @Composable fun NameTextField( value: String, onValueChange: (String) -> Unit, hint: String, - drawLineColor: Color, - @StringRes helperMessage: Int, - helperColor: Color, modifier: Modifier = Modifier, - helperIcon: Int? = null, + onValidationChanged: (Boolean) -> Unit ) { val focusManager = LocalFocusManager.current val keyboardController = LocalSoftwareKeyboardController.current -// val nameErrorRegex = Regex(NAME_ERROR) -// var trimmedName = "" -// var outOfBoundName = false -// if (name.length > MAX_LENGTH) { -// trimmedName = name.substring(0, MAX_LENGTH) -// outOfBoundName = true -// } else trimmedName = name + val nameErrorRegex = NAME_ERROR_REGEX + val trimmedName: String + var outOfBoundName = false + if (value.length > MAX_LENGTH) { + trimmedName = value.substring(0, MAX_LENGTH) + outOfBoundName = true + } else { + trimmedName = value + } + + val state = when { + nameErrorRegex.matcher(trimmedName).find() -> { + NameFieldState( + name = trimmedName, + lineColor = WarningRed, + helperMessage = R.string.sign_up_helper_error, + helperIcon = R.drawable.ic_sign_up_error, + helperColor = WarningRed, + isValid = false + ) + } + + trimmedName.isEmpty() || trimmedName.isBlank() -> { + NameFieldState( + name = trimmedName, + lineColor = Grey500, + helperMessage = R.string.sign_up_helper, + helperIcon = null, + helperColor = Grey400, + isValid = false + ) + } + + outOfBoundName -> { + NameFieldState( + name = trimmedName, + lineColor = WarningRed, + helperMessage = R.string.sign_up_helper_out, + helperIcon = R.drawable.ic_sign_up_error, + helperColor = WarningRed, + isValid = false + ) + } + + else -> { + NameFieldState( + name = trimmedName, + lineColor = TerningMain, + helperMessage = R.string.sign_up_helper_available, + helperIcon = R.drawable.ic_check, + helperColor = TerningMain, + isValid = true + ) + } + } + + onValidationChanged(state.isValid) TerningBasicTextField( - value = value, + value = state.name, onValueChange = onValueChange, modifier = modifier, textStyle = TerningTheme.typography.detail1, textColor = Black, - drawLineColor = drawLineColor, + drawLineColor = state.lineColor, cursorBrush = SolidColor(Grey400), hint = hint, hintColor = Grey300, showTextLength = true, - maxTextLength = 12, - helperMessage = stringResource(id = helperMessage), - helperIcon = helperIcon, - helperColor = helperColor, + maxTextLength = MAX_LENGTH, + helperMessage = stringResource(id = state.helperMessage), + helperIcon = state.helperIcon, + helperColor = state.helperColor, imeAction = ImeAction.Done, onDoneAction = { focusManager.clearFocus() @@ -58,3 +118,5 @@ fun NameTextField( } ) } + +private const val MAX_LENGTH = 12 diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 71380b12d..3d32730ff 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -62,4 +62,9 @@ TerningBasicImage + + 12자리 이내, 문자/숫자 가능, 특수문자/기호 입력불가 + 이름에 특수문자는 입력할 수 없어요 + 사용 가능한 이름이에요 + 이름은 12자리 이내로 설정해 주세요 \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index 0acb8a067..f1900d94e 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -71,11 +71,12 @@ fun ProfileEditRoute( viewModel.updateBottomSheet(isVisible) }, onInputChange = { editName -> - viewModel.isInputValid(editName) + viewModel.updateName(editName) }, onSaveClick = {/*TODO: 수정사항 저장 로직*/ }, name = state.name, - onBackButtonClick = { viewModel.navigateUp() } + onBackButtonClick = { viewModel.navigateUp() }, + onValidationChanged = { isValid -> viewModel.updateButtonValidation(isValid) } ) } @@ -88,6 +89,7 @@ fun ProfileEditScreen( name: String, onBackButtonClick: () -> Unit, modifier: Modifier = Modifier, + onValidationChanged: (Boolean) -> Unit ) { val focusManager = LocalFocusManager.current @@ -132,10 +134,7 @@ fun ProfileEditScreen( onInputChange(editName) }, hint = stringResource(id = R.string.sign_up_hint), - drawLineColor = profileEditState.drawLineColor, - helperMessage = profileEditState.helper, - helperIcon = profileEditState.helperIcon, - helperColor = profileEditState.helperColor + onValidationChanged = { isValid -> onValidationChanged(isValid) } ) Spacer(modifier = Modifier.height(48.dp)) Text( @@ -171,7 +170,8 @@ fun ProfileEditScreenPreview() { onInputChange = {}, onSaveClick = {}, name = "터닝이", - onBackButtonClick = {} + onBackButtonClick = {}, + onValidationChanged = {} ) } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt index 3dcecf141..2c41ac725 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt @@ -1,18 +1,8 @@ package com.terning.feature.mypage.profileedit -import androidx.annotation.StringRes -import androidx.compose.ui.graphics.Color -import com.terning.core.designsystem.theme.Grey400 -import com.terning.core.designsystem.theme.Grey500 -import com.terning.feature.R - data class ProfileEditState( val name: String = "", val character: Int = 0, - val drawLineColor: Color = Grey500, - @StringRes val helper: Int = R.string.sign_up_helper, - val helperIcon: Int? = null, - val helperColor: Color = Grey400, val isButtonValid: Boolean = true, val authType: String = "", val showBottomSheet: Boolean = false diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt index a8fa3c8ff..9260ed618 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt @@ -2,11 +2,6 @@ package com.terning.feature.mypage.profileedit import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.terning.core.designsystem.theme.Grey400 -import com.terning.core.designsystem.theme.Grey500 -import com.terning.core.designsystem.theme.TerningMain -import com.terning.core.designsystem.theme.WarningRed -import com.terning.feature.R import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow @@ -26,52 +21,8 @@ class ProfileEditViewModel @Inject constructor() : ViewModel() { private val _sideEffects = MutableSharedFlow() val sideEffects: SharedFlow get() = _sideEffects.asSharedFlow() - fun isInputValid(name: String) { - val nameErrorRegex = Regex(NAME_ERROR) - var trimmedName = "" - var outOfBoundName = false - if (name.length > MAX_LENGTH) { - trimmedName = name.substring(0, MAX_LENGTH) - outOfBoundName = true - } else trimmedName = name - - when { - nameErrorRegex.containsMatchIn(trimmedName) -> _state.value = _state.value.copy( - name = trimmedName, - drawLineColor = WarningRed, - helper = R.string.sign_up_helper_error, - helperIcon = R.drawable.ic_sign_up_error, - helperColor = WarningRed, - isButtonValid = false - ) - - trimmedName.isEmpty() || trimmedName.isBlank() -> _state.value = _state.value.copy( - name = trimmedName, - drawLineColor = Grey500, - helper = R.string.sign_up_helper, - helperIcon = null, - helperColor = Grey400, - isButtonValid = false - ) - - outOfBoundName -> _state.value = _state.value.copy( - name = trimmedName, - drawLineColor = WarningRed, - helper = R.string.sign_up_helper_out, - helperIcon = R.drawable.ic_sign_up_error, - helperColor = WarningRed, - isButtonValid = false - ) - - else -> _state.value = _state.value.copy( - name = trimmedName, - drawLineColor = TerningMain, - helper = R.string.sign_up_helper_available, - helperIcon = R.drawable.ic_check, - helperColor = TerningMain, - isButtonValid = true - ) - } + fun updateButtonValidation(isValid: Boolean) { + _state.value = _state.value.copy(isButtonValid = isValid) } fun updateCharacter(character: Int) { @@ -89,8 +40,6 @@ class ProfileEditViewModel @Inject constructor() : ViewModel() { } companion object { - const val NAME_ERROR = "[!@#\$%^&*(),.?\":{}|<>\\[\\]\\\\/\\-=+~`\\p{S}\\p{P}]" - private const val MAX_LENGTH = 12 private const val KAKA0 = "KAKAO" } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index 74860611c..710995f6d 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -79,10 +79,13 @@ fun SignUpRoute( viewModel.postSignUpWithServer() }, onInputChange = { name -> - viewModel.isInputValid(name) + viewModel.updateName(name) }, onProfileEditClick = { isVisible -> showBottomSheet = isVisible + }, + onValidationChanged = { isVisible -> + viewModel.updateButtonValidation(isVisible) } ) } @@ -94,6 +97,7 @@ fun SignUpScreen( onInputChange: (String) -> Unit, onProfileEditClick: (Boolean) -> Unit, modifier: Modifier = Modifier, + onValidationChanged: (Boolean) -> Unit ) { val focusManager = LocalFocusManager.current @@ -148,10 +152,7 @@ fun SignUpScreen( onInputChange(name) }, hint = stringResource(id = R.string.sign_up_hint), - drawLineColor = signUpState.drawLineColor, - helperMessage = signUpState.helper, - helperIcon = signUpState.helperIcon, - helperColor = signUpState.helperColor + onValidationChanged = { isValid -> onValidationChanged(isValid) } ) } Spacer(modifier = modifier.weight(5f)) @@ -174,7 +175,8 @@ fun SignUpScreenPreview() { signUpState = SignUpState(), onSignUpClick = {}, onInputChange = {}, - onProfileEditClick = {} + onProfileEditClick = {}, + onValidationChanged = {} ) } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt index 9874f996d..44870b4e2 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpState.kt @@ -1,18 +1,8 @@ package com.terning.feature.onboarding.signup -import androidx.annotation.StringRes -import androidx.compose.ui.graphics.Color -import com.terning.core.designsystem.theme.Grey400 -import com.terning.core.designsystem.theme.Grey500 -import com.terning.feature.R - data class SignUpState( val name: String = "", val character: Int = 0, - val drawLineColor: Color = Grey500, - @StringRes val helper: Int = R.string.sign_up_helper, - val helperIcon: Int? = null, - val helperColor: Color = Grey400, val isButtonValid: Boolean = false, val authId: String = "" ) \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt index 52f46f86f..232f4f49b 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpViewModel.kt @@ -2,10 +2,6 @@ package com.terning.feature.onboarding.signup import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.terning.core.designsystem.theme.Grey400 -import com.terning.core.designsystem.theme.Grey500 -import com.terning.core.designsystem.theme.TerningMain -import com.terning.core.designsystem.theme.WarningRed import com.terning.domain.entity.onboarding.SignUpRequest import com.terning.domain.repository.AuthRepository import com.terning.domain.repository.TokenRepository @@ -32,52 +28,12 @@ class SignUpViewModel @Inject constructor( private val _sideEffects = MutableSharedFlow() val sideEffects: SharedFlow get() = _sideEffects.asSharedFlow() - fun isInputValid(name: String) { - val nameErrorRegex = Regex(NAME_ERROR) - var trimmedName = "" - var outOfBoundName = false - if (name.length > MAX_LENGTH) { - trimmedName = name.substring(0, MAX_LENGTH) - outOfBoundName = true - } else trimmedName = name - - when { - nameErrorRegex.containsMatchIn(trimmedName) -> _state.value = _state.value.copy( - name = trimmedName, - drawLineColor = WarningRed, - helper = R.string.sign_up_helper_error, - helperIcon = R.drawable.ic_sign_up_error, - helperColor = WarningRed, - isButtonValid = false - ) - - trimmedName.isEmpty() || trimmedName.isBlank() -> _state.value = _state.value.copy( - name = trimmedName, - drawLineColor = Grey500, - helper = R.string.sign_up_helper, - helperIcon = null, - helperColor = Grey400, - isButtonValid = false - ) - - outOfBoundName -> _state.value = _state.value.copy( - name = trimmedName, - drawLineColor =WarningRed, - helper = R.string.sign_up_helper_out, - helperIcon = R.drawable.ic_sign_up_error, - helperColor = WarningRed, - isButtonValid = false - ) + fun updateButtonValidation(isValid: Boolean) { + _state.value = _state.value.copy(isButtonValid = isValid) + } - else -> _state.value = _state.value.copy( - name = trimmedName, - drawLineColor = TerningMain, - helper = R.string.sign_up_helper_available, - helperIcon = R.drawable.ic_check, - helperColor = TerningMain, - isButtonValid = true - ) - } + fun updateName(name: String) { + _state.value = _state.value.copy(name = name) } fun fetchCharacter(character: Int) { @@ -114,8 +70,6 @@ class SignUpViewModel @Inject constructor( } companion object { - const val NAME_ERROR = "[!@#\$%^&*(),.?\":{}|<>\\[\\]\\\\/\\-=+~`\\p{S}\\p{P}]" - private const val MAX_LENGTH = 12 private const val KAKA0 = "KAKAO" } } \ No newline at end of file diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 3c5619f7a..bf3482521 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -23,10 +23,6 @@ 이름 이름을 입력해 주세요 다음으로 - 12자리 이내, 문자/숫자 가능, 특수문자/기호 입력불가 - 이름에 특수문자는 입력할 수 없어요 - 사용 가능한 이름이에요 - 이름은 12자리 이내로 설정해 주세요 관심있는 인턴 공고 키워드를 검색해 보세요 From f9f2e1d4019f08f8fcb7fa83c919d3e58247f102 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sun, 1 Sep 2024 01:14:05 +0900 Subject: [PATCH 27/62] =?UTF-8?q?[FIX/#206]=20authType=20->=20profile=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 --- .../component/textfield/NameTextField.kt | 6 +++--- .../feature/mypage/mypage/MyPageRoute.kt | 11 +++++------ .../feature/mypage/mypage/MyPageState.kt | 2 +- .../mypage/mypage/component/MyPageProfile.kt | 12 ++++++------ feature/src/main/res/drawable/ic_check.xml | 18 ------------------ .../src/main/res/drawable/ic_sign_up_error.xml | 18 ------------------ 6 files changed, 15 insertions(+), 52 deletions(-) delete mode 100644 feature/src/main/res/drawable/ic_check.xml delete mode 100644 feature/src/main/res/drawable/ic_sign_up_error.xml diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt index d3eb69fb3..2eff36cd3 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt @@ -54,7 +54,7 @@ fun NameTextField( name = trimmedName, lineColor = WarningRed, helperMessage = R.string.sign_up_helper_error, - helperIcon = R.drawable.ic_sign_up_error, + helperIcon = R.drawable.ic_name_text_field_error, helperColor = WarningRed, isValid = false ) @@ -76,7 +76,7 @@ fun NameTextField( name = trimmedName, lineColor = WarningRed, helperMessage = R.string.sign_up_helper_out, - helperIcon = R.drawable.ic_sign_up_error, + helperIcon = R.drawable.ic_name_text_field_error, helperColor = WarningRed, isValid = false ) @@ -87,7 +87,7 @@ fun NameTextField( name = trimmedName, lineColor = TerningMain, helperMessage = R.string.sign_up_helper_available, - helperIcon = R.drawable.ic_check, + helperIcon = R.drawable.ic_name_text_field_check, helperColor = TerningMain, isValid = true ) diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt index 6c70af34f..ea4301ab1 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt @@ -16,6 +16,7 @@ import androidx.compose.material3.VerticalDivider import androidx.compose.runtime.Composable import androidx.compose.runtime.SideEffect import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue @@ -52,8 +53,7 @@ fun MyPageRoute( val context = LocalContext.current var name by remember { mutableStateOf(state.name) } - // TODO: 프로필로 바꾸기 - var profile by remember { mutableStateOf(state.authType) } + var profile by remember { mutableIntStateOf(state.profile) } val systemUiController = rememberSystemUiController() @@ -94,8 +94,7 @@ fun MyPageRoute( when (state.isGetSuccess) { is UiState.Success -> { name = state.name - // TODO: 프로필로 바꾸기 - profile = state.authType + profile = state.profile } is UiState.Loading -> {} @@ -133,7 +132,7 @@ fun MyPageScreen( onEditClick: () -> Unit, modifier: Modifier = Modifier, name: String = "", - profile: String = "" + profile: Int = 0 ) { Column( modifier = modifier @@ -195,7 +194,7 @@ fun UserProfile( name: String, onEditClick: () -> Unit, modifier: Modifier = Modifier, - profile: String = "PROFILE_00", + profile: Int = 0, ) { Row( modifier = modifier.padding( diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageState.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageState.kt index fb74cd235..6260d8e0a 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageState.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageState.kt @@ -6,7 +6,7 @@ data class MyPageState( val isLogoutAndQuitSuccess: UiState = UiState.Loading, val isGetSuccess: UiState = UiState.Loading, val name: String = "", - val authType: String = "", + val profile: Int = 0, val showNotice: Boolean = false, val showOpinion: Boolean = false, val showLogoutBottomSheet : Boolean = false, diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/component/MyPageProfile.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/component/MyPageProfile.kt index c57969e3c..8bc3860ec 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/component/MyPageProfile.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/component/MyPageProfile.kt @@ -12,7 +12,7 @@ import com.terning.core.designsystem.component.image.TerningImage @Composable fun MyPageProfile( modifier: Modifier = Modifier, - profile: String + profile: Int ) { val options = listOf( R.drawable.ic_terning_profile_00, @@ -24,11 +24,11 @@ fun MyPageProfile( ) val option = when (profile) { - "PROFILE_00" -> options[0] - "PROFILE_01" -> options[1] - "PROFILE_02" -> options[2] - "PROFILE_03" -> options[3] - "PROFILE_04" -> options[4] + 0 -> options[0] + 1 -> options[1] + 2 -> options[2] + 3 -> options[3] + 4 -> options[4] else -> options[5] } diff --git a/feature/src/main/res/drawable/ic_check.xml b/feature/src/main/res/drawable/ic_check.xml deleted file mode 100644 index 6c2547e9d..000000000 --- a/feature/src/main/res/drawable/ic_check.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - \ No newline at end of file diff --git a/feature/src/main/res/drawable/ic_sign_up_error.xml b/feature/src/main/res/drawable/ic_sign_up_error.xml deleted file mode 100644 index 04eb2ddbe..000000000 --- a/feature/src/main/res/drawable/ic_sign_up_error.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - From 1955b81764b85cce53063cf28129b2d1d9612486 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sun, 1 Sep 2024 01:26:46 +0900 Subject: [PATCH 28/62] =?UTF-8?q?[FIX/#206]=20=EB=84=A4=EB=B9=84=EA=B2=8C?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/mypage/mypage/MyPageRoute.kt | 16 +++++++++++- .../feature/mypage/mypage/MyPageSideEffect.kt | 5 ++++ .../feature/mypage/mypage/MyPageState.kt | 1 + .../feature/mypage/mypage/MyPageViewModel.kt | 25 +++++++++++++------ .../mypage/navigation/MyPageNavigation.kt | 5 +++- 5 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 feature/src/main/java/com/terning/feature/mypage/mypage/MyPageSideEffect.kt diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt index ea4301ab1..834995374 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt @@ -14,6 +14,7 @@ import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Text import androidx.compose.material3.VerticalDivider import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.SideEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf @@ -27,7 +28,9 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel +import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle +import androidx.lifecycle.flowWithLifecycle import com.google.accompanist.systemuicontroller.rememberSystemUiController import com.terning.core.designsystem.component.bottomsheet.MyPageLogoutBottomSheet import com.terning.core.designsystem.component.bottomsheet.MyPageQuitBottomSheet @@ -48,9 +51,11 @@ import com.terning.feature.mypage.mypage.component.MyPageItem @Composable fun MyPageRoute( viewModel: MyPageViewModel = hiltViewModel(), + navigateToProfileEdit: () -> Unit ) { val state by viewModel.state.collectAsStateWithLifecycle() val context = LocalContext.current + val lifecycleOwner = LocalLifecycleOwner.current var name by remember { mutableStateOf(state.name) } var profile by remember { mutableIntStateOf(state.profile) } @@ -63,6 +68,15 @@ fun MyPageRoute( ) } + LaunchedEffect(viewModel.sideEffects, lifecycleOwner) { + viewModel.sideEffects.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle) + .collect { sideEffect -> + when (sideEffect) { + is MyPageSideEffect.NavigateToProfileEdit -> navigateToProfileEdit() + } + } + } + if (state.showLogoutBottomSheet) { MyPageLogoutBottomSheet( onDismiss = { viewModel.fetchShowLogoutBottomSheet(false) }, @@ -117,7 +131,7 @@ fun MyPageRoute( onQuitClick = { viewModel.fetchShowQuitBottomSheet(true) }, onNoticeClick = { viewModel.fetchShowNotice(true) }, onOpinionClick = { viewModel.fetchShowOpinion(true) }, - onEditClick = { /*TODO: 프로필 수정으로 이동*/ }, + onEditClick = { viewModel.navigateToProfileEdit() }, name = name, profile = profile ) diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageSideEffect.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageSideEffect.kt new file mode 100644 index 000000000..26d1e5856 --- /dev/null +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageSideEffect.kt @@ -0,0 +1,5 @@ +package com.terning.feature.mypage.mypage + +sealed class MyPageSideEffect { + data object NavigateToProfileEdit : MyPageSideEffect() +} \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageState.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageState.kt index 6260d8e0a..bf072cb13 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageState.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageState.kt @@ -7,6 +7,7 @@ data class MyPageState( val isGetSuccess: UiState = UiState.Loading, val name: String = "", val profile: Int = 0, + val authType : String ="", val showNotice: Boolean = false, val showOpinion: Boolean = false, val showLogoutBottomSheet : Boolean = false, diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageViewModel.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageViewModel.kt index d5bc25885..b4f39bb61 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageViewModel.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageViewModel.kt @@ -15,8 +15,11 @@ import com.terning.domain.repository.MyPageRepository import com.terning.domain.repository.TokenRepository import com.terning.feature.main.MainActivity import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asSharedFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.launch import javax.inject.Inject @@ -34,6 +37,9 @@ class MyPageViewModel @Inject constructor( private val _state: MutableStateFlow = MutableStateFlow(MyPageState()) val state: StateFlow get() = _state.asStateFlow() + private val _sideEffects = MutableSharedFlow() + val sideEffects: SharedFlow get() = _sideEffects.asSharedFlow() + fun logoutKakao() { UserApiClient.instance.logout { error -> if (error == null) { @@ -95,14 +101,14 @@ class MyPageViewModel @Inject constructor( viewModelScope.launch { myPageRepository.getProfile() .onSuccess { response -> - _state.value = _state.value.copy( - isGetSuccess = UiState.Success(true), - name = response.name, - authType = response.authType - ) - }.onFailure { - _state.value = _state.value.copy(isGetSuccess = UiState.Failure(it.toString())) - } + _state.value = _state.value.copy( + isGetSuccess = UiState.Success(true), + name = response.name, + authType = response.authType + ) + }.onFailure { + _state.value = _state.value.copy(isGetSuccess = UiState.Failure(it.toString())) + } } } @@ -134,6 +140,9 @@ class MyPageViewModel @Inject constructor( customTabsIntent.launchUrl(context, url) } + fun navigateToProfileEdit() = + viewModelScope.launch { _sideEffects.emit(MyPageSideEffect.NavigateToProfileEdit) } + companion object { private const val NOTICE_URL = "https://abundant-quiver-13f.notion.site/69109213e7db4873be6b9600f2f5163a" diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt index 7e01d35d2..a18c3aaed 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt @@ -9,6 +9,7 @@ import androidx.navigation.NavOptions import androidx.navigation.compose.composable import com.terning.core.navigation.MainTabRoute import com.terning.feature.mypage.mypage.MyPageRoute +import com.terning.feature.mypage.profileedit.navigation.navigateProfileEdit import kotlinx.serialization.Serializable fun NavController.navigateMyPage(navOptions: NavOptions? = null) { @@ -35,7 +36,9 @@ fun NavGraphBuilder.myPageNavGraph( ExitTransition.None } ) { - MyPageRoute() + MyPageRoute( + navigateToProfileEdit = { navHostController.navigateProfileEdit() } + ) } } From 8cddc31d0141a7b0c30cd33cfaf52a988a224b51 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sun, 1 Sep 2024 01:31:21 +0900 Subject: [PATCH 29/62] =?UTF-8?q?[FIX/#206]=20=EC=83=81=ED=83=9C=EB=B0=94?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/mypage/profileedit/ProfileEditRoute.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index f1900d94e..c3f2af995 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.SideEffect import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -19,6 +20,7 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle +import com.google.accompanist.systemuicontroller.rememberSystemUiController import com.terning.core.designsystem.component.bottomsheet.SignUpBottomSheet import com.terning.core.designsystem.component.button.RectangleButton import com.terning.core.designsystem.component.item.ProfileWithPlusButton @@ -27,6 +29,7 @@ import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar import com.terning.core.designsystem.theme.Grey500 import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.designsystem.theme.White import com.terning.core.extension.addFocusCleaner import com.terning.core.extension.noRippleClickable import com.terning.feature.R @@ -41,6 +44,14 @@ fun ProfileEditRoute( val lifecycleOwner = LocalLifecycleOwner.current + val systemUiController = rememberSystemUiController() + + SideEffect { + systemUiController.setStatusBarColor( + color = White + ) + } + LaunchedEffect(key1 = true) { viewModel.updateName(initialName) } From 478d46eb4e773110f184441bdd0ebccb6cd7e392 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sun, 1 Sep 2024 01:42:31 +0900 Subject: [PATCH 30/62] =?UTF-8?q?[FIX/#206]=20=EC=9C=A0=EC=A0=80=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EC=A0=84=EB=8B=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/mypage/mypage/MyPageRoute.kt | 32 +++++++------------ .../mypage/navigation/MyPageNavigation.kt | 2 +- .../mypage/profileedit/ProfileEditRoute.kt | 2 +- .../navigation/ProfileEditNavigation.kt | 17 +++++++--- 4 files changed, 25 insertions(+), 28 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt index 834995374..643c8fc9b 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt @@ -17,10 +17,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.SideEffect import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableIntStateOf -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext @@ -51,15 +47,12 @@ import com.terning.feature.mypage.mypage.component.MyPageItem @Composable fun MyPageRoute( viewModel: MyPageViewModel = hiltViewModel(), - navigateToProfileEdit: () -> Unit + navigateToProfileEdit: (String) -> Unit ) { val state by viewModel.state.collectAsStateWithLifecycle() val context = LocalContext.current val lifecycleOwner = LocalLifecycleOwner.current - var name by remember { mutableStateOf(state.name) } - var profile by remember { mutableIntStateOf(state.profile) } - val systemUiController = rememberSystemUiController() SideEffect { @@ -72,7 +65,7 @@ fun MyPageRoute( viewModel.sideEffects.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle) .collect { sideEffect -> when (sideEffect) { - is MyPageSideEffect.NavigateToProfileEdit -> navigateToProfileEdit() + is MyPageSideEffect.NavigateToProfileEdit -> navigateToProfileEdit(state.name) } } } @@ -107,8 +100,15 @@ fun MyPageRoute( when (state.isGetSuccess) { is UiState.Success -> { - name = state.name - profile = state.profile + MyPageScreen( + onLogoutClick = { viewModel.fetchShowLogoutBottomSheet(true) }, + onQuitClick = { viewModel.fetchShowQuitBottomSheet(true) }, + onNoticeClick = { viewModel.fetchShowNotice(true) }, + onOpinionClick = { viewModel.fetchShowOpinion(true) }, + onEditClick = { viewModel.navigateToProfileEdit() }, + name = state.name, + profile = state.profile + ) } is UiState.Loading -> {} @@ -125,16 +125,6 @@ fun MyPageRoute( viewModel.navigateToOpinionWebView(context) viewModel.fetchShowOpinion(false) } - - MyPageScreen( - onLogoutClick = { viewModel.fetchShowLogoutBottomSheet(true) }, - onQuitClick = { viewModel.fetchShowQuitBottomSheet(true) }, - onNoticeClick = { viewModel.fetchShowNotice(true) }, - onOpinionClick = { viewModel.fetchShowOpinion(true) }, - onEditClick = { viewModel.navigateToProfileEdit() }, - name = name, - profile = profile - ) } @Composable diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt index a18c3aaed..b82774d87 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt @@ -37,7 +37,7 @@ fun NavGraphBuilder.myPageNavGraph( } ) { MyPageRoute( - navigateToProfileEdit = { navHostController.navigateProfileEdit() } + navigateToProfileEdit = { name -> navHostController.navigateProfileEdit(name) } ) } } diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index c3f2af995..5b2e0876c 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -38,7 +38,7 @@ import com.terning.feature.R fun ProfileEditRoute( navigateUp: () -> Unit, viewModel: ProfileEditViewModel = hiltViewModel(), - initialName: String = "", + initialName: String, ) { val state by viewModel.state.collectAsStateWithLifecycle() diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt index 46515feac..86cf5d50e 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt @@ -5,13 +5,17 @@ import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController import androidx.navigation.NavOptions import androidx.navigation.compose.composable +import androidx.navigation.toRoute import com.terning.core.navigation.Route import com.terning.feature.mypage.profileedit.ProfileEditRoute import kotlinx.serialization.Serializable -fun NavController.navigateProfileEdit(navOptions: NavOptions? = null) { +fun NavController.navigateProfileEdit( + name: String, + navOptions: NavOptions? = null +) { navigate( - route = ProfileEdit, + route = ProfileEdit(name = name), navOptions = navOptions ) } @@ -19,13 +23,16 @@ fun NavController.navigateProfileEdit(navOptions: NavOptions? = null) { fun NavGraphBuilder.profileEditNavGraph( navHostController: NavHostController, ) { - composable( - ) { + composable { + val args = it.toRoute() ProfileEditRoute( + initialName = args.name, navigateUp = { navHostController.navigateUp() } ) } } @Serializable -data object ProfileEdit : Route \ No newline at end of file +data class ProfileEdit( + val name: String +) : Route \ No newline at end of file From 4e6001ce14ba1a0c879485f3bf98fec3d12fc06a Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sun, 1 Sep 2024 01:53:56 +0900 Subject: [PATCH 31/62] =?UTF-8?q?[FIX/#206]=20=EB=B0=94=ED=85=80=EC=8B=9C?= =?UTF-8?q?=ED=8A=B8=20=EC=9D=B4=EB=A6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{SignUpBottomSheet.kt => ProfileBottomSheet.kt} | 6 +++--- core/src/main/res/values/strings.xml | 1 - .../terning/feature/mypage/profileedit/ProfileEditRoute.kt | 4 ++-- .../terning/feature/mypage/profileedit/ProfileEditState.kt | 2 +- .../com/terning/feature/onboarding/signup/SignUpRoute.kt | 4 ++-- 5 files changed, 8 insertions(+), 9 deletions(-) rename core/src/main/java/com/terning/core/designsystem/component/bottomsheet/{SignUpBottomSheet.kt => ProfileBottomSheet.kt} (96%) diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SignUpBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt similarity index 96% rename from core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SignUpBottomSheet.kt rename to core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt index db86a1aba..689acac94 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/SignUpBottomSheet.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt @@ -34,7 +34,7 @@ import com.terning.core.extension.noRippleClickable import kotlinx.coroutines.launch /** - * 회원가입을 할 때 프로필 이미지를 선택할 수 있는 바텀시트입니다. + * 프로필 이미지를 선택할 수 있는 바텀시트입니다. * * @param modifier 바텀시트에 적용할 Modifier입니다. * @param onDismiss 바텀시트가 닫힐 때 호출되는 콜백 함수입니다. @@ -43,7 +43,7 @@ import kotlinx.coroutines.launch */ @OptIn(ExperimentalMaterial3Api::class) @Composable -fun SignUpBottomSheet( +fun ProfileBottomSheet( modifier: Modifier = Modifier, onDismiss: () -> Unit, onSaveClick: (Int) -> Unit, @@ -143,7 +143,7 @@ fun RadioButtonGroup( painter = painterResource( id = option ), - contentDescription = stringResource(id = R.string.sign_up_bottom_sheet_description), + contentDescription = "profile image", modifier = imageModifier .aspectRatio(1f) .noRippleClickable { diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 3d32730ff..f88829a70 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -33,7 +33,6 @@ 프로필 이미지 선택 - 회원가입 바텀시트 저장하기 잠깐만요! 정말 로그아웃 하시겠어요? diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index 5b2e0876c..d21f5b2c3 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -21,7 +21,7 @@ import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle import com.google.accompanist.systemuicontroller.rememberSystemUiController -import com.terning.core.designsystem.component.bottomsheet.SignUpBottomSheet +import com.terning.core.designsystem.component.bottomsheet.ProfileBottomSheet import com.terning.core.designsystem.component.button.RectangleButton import com.terning.core.designsystem.component.item.ProfileWithPlusButton import com.terning.core.designsystem.component.textfield.NameTextField @@ -57,7 +57,7 @@ fun ProfileEditRoute( } if (state.showBottomSheet) { - SignUpBottomSheet( + ProfileBottomSheet( onDismiss = { viewModel.updateBottomSheet(false) }, onSaveClick = { index -> viewModel.updateBottomSheet(false) diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt index 2c41ac725..a4f3079cb 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt @@ -3,7 +3,7 @@ package com.terning.feature.mypage.profileedit data class ProfileEditState( val name: String = "", val character: Int = 0, - val isButtonValid: Boolean = true, + val isButtonValid: Boolean = false, val authType: String = "", val showBottomSheet: Boolean = false ) \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index 710995f6d..6f30f8675 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -22,7 +22,7 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle -import com.terning.core.designsystem.component.bottomsheet.SignUpBottomSheet +import com.terning.core.designsystem.component.bottomsheet.ProfileBottomSheet import com.terning.core.designsystem.component.button.RectangleButton import com.terning.core.designsystem.component.item.ProfileWithPlusButton import com.terning.core.designsystem.component.textfield.NameTextField @@ -63,7 +63,7 @@ fun SignUpRoute( } if (showBottomSheet) { - SignUpBottomSheet( + ProfileBottomSheet( onDismiss = { showBottomSheet = false }, onSaveClick = { index -> showBottomSheet = false From fa02460e8ea7b210fee315a79b86a62bbfba1403 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sun, 1 Sep 2024 02:01:56 +0900 Subject: [PATCH 32/62] =?UTF-8?q?[FIX/#206]=20=EB=B0=94=ED=85=80=EC=8B=9C?= =?UTF-8?q?=ED=8A=B8=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bottomsheet/ProfileBottomSheet.kt | 21 +++---------------- .../mypage/profileedit/ProfileEditRoute.kt | 8 +++++-- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt index 689acac94..a51c82eab 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt @@ -17,7 +17,6 @@ import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf -import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue @@ -27,7 +26,6 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.terning.core.R -import com.terning.core.designsystem.component.button.RoundButton import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.noRippleClickable @@ -52,8 +50,6 @@ fun ProfileBottomSheet( val scope = rememberCoroutineScope() val sheetState = rememberModalBottomSheetState() - var selectedImageIndex by remember { mutableIntStateOf(initialSelectedOption) } - TerningBasicBottomSheet( content = { Column { @@ -68,27 +64,16 @@ fun ProfileBottomSheet( ) RadioButtonGroup( onOptionSelected = { index -> - selectedImageIndex = index - }, - initialSelectedOption = initialSelectedOption - ) - Spacer(modifier = modifier.padding(bottom = 24.dp)) - RoundButton( - style = TerningTheme.typography.button0, - paddingVertical = 19.dp, - cornerRadius = 10.dp, - text = R.string.sign_up_dialog_start, - onButtonClick = { scope.launch { sheetState.hide() } .invokeOnCompletion { if (!sheetState.isVisible) { - onSaveClick(selectedImageIndex) + onSaveClick(index) } } }, - modifier = modifier.padding(horizontal = 24.dp) + initialSelectedOption = initialSelectedOption ) - Spacer(modifier = modifier.padding(bottom = 15.dp)) + Spacer(modifier = modifier.padding(bottom = 26.dp)) } }, onDismissRequest = { onDismiss() }, diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index d21f5b2c3..085611578 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -87,7 +87,9 @@ fun ProfileEditRoute( onSaveClick = {/*TODO: 수정사항 저장 로직*/ }, name = state.name, onBackButtonClick = { viewModel.navigateUp() }, - onValidationChanged = { isValid -> viewModel.updateButtonValidation(isValid) } + onValidationChanged = { isValid -> + viewModel.updateButtonValidation(isValid) + } ) } @@ -145,7 +147,9 @@ fun ProfileEditScreen( onInputChange(editName) }, hint = stringResource(id = R.string.sign_up_hint), - onValidationChanged = { isValid -> onValidationChanged(isValid) } + onValidationChanged = { isValid -> + onValidationChanged(isValid) + } ) Spacer(modifier = Modifier.height(48.dp)) Text( From 21dfe0889d2a63213e7c472b3567d4fe27cb44ac Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sun, 1 Sep 2024 02:40:54 +0900 Subject: [PATCH 33/62] =?UTF-8?q?[FIX/#206]=20=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=EC=A0=84=ED=99=98=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bottomsheet/ProfileBottomSheet.kt | 1 - feature/build.gradle.kts | 1 - .../mypage/navigation/MyPageNavigation.kt | 2 +- .../mypage/profileedit/ProfileEditRoute.kt | 4 +++- .../navigation/ProfileEditNavigation.kt | 19 ++++++++++++++++++- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt index a51c82eab..bbf58c980 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt @@ -130,7 +130,6 @@ fun RadioButtonGroup( ), contentDescription = "profile image", modifier = imageModifier - .aspectRatio(1f) .noRippleClickable { onOptionSelected(index) selectedOption = option diff --git a/feature/build.gradle.kts b/feature/build.gradle.kts index 6b56a6904..781cf168f 100644 --- a/feature/build.gradle.kts +++ b/feature/build.gradle.kts @@ -100,5 +100,4 @@ dependencies { // KakaoDependencies implementation(libs.kakao.user) - } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt index b82774d87..b40531ee6 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt @@ -34,7 +34,7 @@ fun NavGraphBuilder.myPageNavGraph( }, popExitTransition = { ExitTransition.None - } + }, ) { MyPageRoute( navigateToProfileEdit = { name -> navHostController.navigateProfileEdit(name) } diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index 085611578..43fe4c9fa 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -1,5 +1,6 @@ package com.terning.feature.mypage.profileedit +import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize @@ -84,7 +85,7 @@ fun ProfileEditRoute( onInputChange = { editName -> viewModel.updateName(editName) }, - onSaveClick = {/*TODO: 수정사항 저장 로직*/ }, + onSaveClick = { viewModel.navigateUp() }, name = state.name, onBackButtonClick = { viewModel.navigateUp() }, onValidationChanged = { isValid -> @@ -110,6 +111,7 @@ fun ProfileEditScreen( modifier = modifier .fillMaxSize() .addFocusCleaner(focusManager) + .background(White) ) { BackButtonTopAppBar( onBackButtonClick = { onBackButtonClick() }, diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt index 86cf5d50e..44df8ac07 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt @@ -1,5 +1,9 @@ package com.terning.feature.mypage.profileedit.navigation +import androidx.compose.animation.core.LinearOutSlowInEasing +import androidx.compose.animation.core.tween +import androidx.compose.animation.slideInHorizontally +import androidx.compose.animation.slideOutHorizontally import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController @@ -23,7 +27,20 @@ fun NavController.navigateProfileEdit( fun NavGraphBuilder.profileEditNavGraph( navHostController: NavHostController, ) { - composable { + composable( + enterTransition = { + slideInHorizontally( + initialOffsetX = { it }, + animationSpec = tween(durationMillis = 700, easing = LinearOutSlowInEasing) + ) + }, + popExitTransition = { + slideOutHorizontally( + targetOffsetX = { it }, + animationSpec = tween(durationMillis = 700, easing = LinearOutSlowInEasing) + ) + }, + ) { val args = it.toRoute() ProfileEditRoute( initialName = args.name, From 2e95e399e6ee8f74f3df95e905a82a87448ff3b9 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sun, 1 Sep 2024 05:47:36 +0900 Subject: [PATCH 34/62] =?UTF-8?q?[REFACTOR/#206]=20=EB=84=A4=EB=B9=84?= =?UTF-8?q?=EA=B2=8C=EC=9D=B4=EC=85=98=20=EC=A0=84=EB=A9=B4=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/feature/home/home/HomeRoute.kt | 6 ++ .../home/home/navigation/HometNavigation.kt | 9 ++- .../com/terning/feature/main/MainScreen.kt | 57 +++++++++++++------ .../feature/mypage/mypage/MyPageRoute.kt | 5 ++ .../mypage/navigation/MyPageNavigation.kt | 18 ++---- .../mypage/profileedit/ProfileEditRoute.kt | 15 +++-- .../navigation/ProfileEditNavigation.kt | 3 + .../feature/onboarding/splash/SplashRoute.kt | 7 ++- .../splash/navigation/SplashNavigation.kt | 3 + 9 files changed, 83 insertions(+), 40 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt index cc92f3bdf..2e9793e17 100644 --- a/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt @@ -75,6 +75,7 @@ const val NAME_END_LENGTH = 12 @Composable fun HomeRoute( + paddingValues: PaddingValues, navController: NavHostController, viewModel: HomeViewModel = hiltViewModel(), ) { @@ -109,6 +110,7 @@ fun HomeRoute( } HomeScreen( + paddingValues = paddingValues, homeDialogState = homeDialogState, onChangeFilterClick = { navController.navigateChangeFilter() }, navigateToIntern = { navController.navigateIntern(announcementId = it) }, @@ -119,6 +121,7 @@ fun HomeRoute( @OptIn(ExperimentalFoundationApi::class) @Composable fun HomeScreen( + paddingValues: PaddingValues, homeDialogState: HomeDialogState, onChangeFilterClick: () -> Unit, navigateToIntern: (Long) -> Unit, @@ -162,6 +165,9 @@ fun HomeScreen( Column( horizontalAlignment = Alignment.Start, + modifier = Modifier + .background(White) + .padding(paddingValues) ) { TerningImage( painter = R.drawable.ic_terning_logo_typo, diff --git a/feature/src/main/java/com/terning/feature/home/home/navigation/HometNavigation.kt b/feature/src/main/java/com/terning/feature/home/home/navigation/HometNavigation.kt index 6343c1df4..307d4ed93 100644 --- a/feature/src/main/java/com/terning/feature/home/home/navigation/HometNavigation.kt +++ b/feature/src/main/java/com/terning/feature/home/home/navigation/HometNavigation.kt @@ -5,6 +5,7 @@ import androidx.compose.animation.ExitTransition import androidx.compose.animation.core.LinearOutSlowInEasing import androidx.compose.animation.core.tween import androidx.compose.animation.slideIn +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.ui.unit.IntOffset import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder @@ -22,7 +23,9 @@ fun NavController.navigateHome(navOptions: NavOptions? = null) { ) } -fun NavGraphBuilder.homeNavGraph(navHostController: NavHostController) { +fun NavGraphBuilder.homeNavGraph( + paddingValues : PaddingValues, + navHostController: NavHostController) { composable( exitTransition = { ExitTransition.None @@ -37,7 +40,9 @@ fun NavGraphBuilder.homeNavGraph(navHostController: NavHostController) { ExitTransition.None } ) { - HomeRoute(navController = navHostController) + HomeRoute( + paddingValues= paddingValues, + navController = navHostController) } } diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index c6d644ae3..89164540c 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -1,23 +1,24 @@ package com.terning.feature.main import androidx.compose.animation.AnimatedVisibility -import androidx.compose.animation.core.tween -import androidx.compose.animation.expandVertically -import androidx.compose.animation.shrinkVertically -import androidx.compose.foundation.layout.Arrangement +import androidx.compose.animation.EnterTransition +import androidx.compose.animation.ExitTransition +import androidx.compose.animation.fadeIn +import androidx.compose.animation.fadeOut +import androidx.compose.animation.slideIn +import androidx.compose.animation.slideOut import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material3.Icon import androidx.compose.material3.NavigationBar import androidx.compose.material3.NavigationBarItem import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource -import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.sp import androidx.navigation.compose.NavHost import com.terning.core.designsystem.theme.Grey300 @@ -56,19 +57,38 @@ fun MainScreen( }, ) { innerPadding -> Column( - modifier = Modifier - .padding(innerPadding), - verticalArrangement = Arrangement.spacedBy(16.dp), + modifier = Modifier.fillMaxSize(), ) { NavHost( + enterTransition = { + EnterTransition.None + }, + exitTransition = { + ExitTransition.None + }, + popEnterTransition = { + EnterTransition.None + }, + popExitTransition = { + ExitTransition.None + }, navController = navigator.navController, startDestination = navigator.startDestination ) { - splashNavGraph(navHostController = navigator.navController) - homeNavGraph(navHostController = navigator.navController) + splashNavGraph( + paddingValues = innerPadding, + navHostController = navigator.navController + ) + homeNavGraph( + paddingValues = innerPadding, + navHostController = navigator.navController + ) calendarNavGraph(navHostController = navigator.navController) searchNavGraph(navHostController = navigator.navController) - myPageNavGraph(navHostController = navigator.navController) + myPageNavGraph( + paddingValues = innerPadding, + navHostController = navigator.navController + ) signInNavGraph(navHostController = navigator.navController) signUpNavGraph(navHostController = navigator.navController) filteringOneNavGraph(navHostController = navigator.navController) @@ -79,7 +99,10 @@ fun MainScreen( startFilteringNavGraph(navHostController = navigator.navController) startHomeNavGraph(navHostController = navigator.navController) internNavGraph(navHostController = navigator.navController) - profileEditNavGraph(navHostController = navigator.navController) + profileEditNavGraph( + paddingValues = innerPadding, + navHostController = navigator.navController + ) } } } @@ -94,10 +117,8 @@ private fun MainBottomBar( ) { AnimatedVisibility( visible = isVisible, - enter = expandVertically(expandFrom = Alignment.Top) { 20 }, - exit = shrinkVertically(animationSpec = tween()) { fullHeight -> - fullHeight / 2 - }, + enter = fadeIn() + slideIn { IntOffset(0, 0) }, + exit = fadeOut() + slideOut { IntOffset(0, 0) } ) { NavigationBar(containerColor = White) { tabs.forEach { itemType -> diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt index 643c8fc9b..b340756fb 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt @@ -4,6 +4,7 @@ import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.IntrinsicSize +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -46,6 +47,7 @@ import com.terning.feature.mypage.mypage.component.MyPageItem @Composable fun MyPageRoute( + paddingValues: PaddingValues, viewModel: MyPageViewModel = hiltViewModel(), navigateToProfileEdit: (String) -> Unit ) { @@ -101,6 +103,7 @@ fun MyPageRoute( when (state.isGetSuccess) { is UiState.Success -> { MyPageScreen( + paddingValues = paddingValues, onLogoutClick = { viewModel.fetchShowLogoutBottomSheet(true) }, onQuitClick = { viewModel.fetchShowQuitBottomSheet(true) }, onNoticeClick = { viewModel.fetchShowNotice(true) }, @@ -129,6 +132,7 @@ fun MyPageRoute( @Composable fun MyPageScreen( + paddingValues: PaddingValues = PaddingValues(), onLogoutClick: () -> Unit, onQuitClick: () -> Unit, onNoticeClick: () -> Unit, @@ -142,6 +146,7 @@ fun MyPageScreen( modifier = modifier .fillMaxSize() .background(Back) + .padding(paddingValues) ) { UserProfile( name = name, diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt index b40531ee6..79a5d497d 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt @@ -2,6 +2,7 @@ package com.terning.feature.mypage.mypage.navigation import androidx.compose.animation.EnterTransition import androidx.compose.animation.ExitTransition +import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController @@ -20,23 +21,12 @@ fun NavController.navigateMyPage(navOptions: NavOptions? = null) { } fun NavGraphBuilder.myPageNavGraph( + paddingValues: PaddingValues, navHostController: NavHostController, ) { - composable( - exitTransition = { - ExitTransition.None - }, - popEnterTransition = { - EnterTransition.None - }, - enterTransition = { - EnterTransition.None - }, - popExitTransition = { - ExitTransition.None - }, - ) { + composable{ MyPageRoute( + paddingValues = paddingValues, navigateToProfileEdit = { name -> navHostController.navigateProfileEdit(name) } ) } diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index 43fe4c9fa..7691cd088 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -1,7 +1,9 @@ package com.terning.feature.mypage.profileedit import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.height @@ -37,6 +39,7 @@ import com.terning.feature.R @Composable fun ProfileEditRoute( + paddingValues: PaddingValues, navigateUp: () -> Unit, viewModel: ProfileEditViewModel = hiltViewModel(), initialName: String, @@ -78,6 +81,7 @@ fun ProfileEditRoute( } ProfileEditScreen( + paddingValues = paddingValues, profileEditState = state, onProfileEditClick = { isVisible -> viewModel.updateBottomSheet(isVisible) @@ -96,6 +100,7 @@ fun ProfileEditRoute( @Composable fun ProfileEditScreen( + paddingValues: PaddingValues = PaddingValues(), profileEditState: ProfileEditState, onProfileEditClick: (Boolean) -> Unit, onInputChange: (String) -> Unit, @@ -112,15 +117,15 @@ fun ProfileEditScreen( .fillMaxSize() .addFocusCleaner(focusManager) .background(White) + .padding(paddingValues) ) { BackButtonTopAppBar( onBackButtonClick = { onBackButtonClick() }, title = stringResource(id = R.string.profile_edit_title) ) - Spacer(modifier = modifier.weight(1f)) + Spacer(modifier = modifier.height(24.dp)) Column( modifier = modifier - .align(Alignment.CenterHorizontally) .padding(horizontal = 24.dp) ) { Text( @@ -165,15 +170,15 @@ fun ProfileEditScreen( style = TerningTheme.typography.detail0 ) } - Spacer(modifier = modifier.weight(5f)) + RectangleButton( style = TerningTheme.typography.button1, paddingVertical = 20.dp, text = R.string.profile_edit_save, onButtonClick = { onSaveClick() }, - isEnabled = profileEditState.isButtonValid + isEnabled = profileEditState.isButtonValid, ) - Spacer(modifier = Modifier.height(12.dp)) + Spacer(modifier = Modifier.height(12.dp)) } } diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt index 44df8ac07..6e8797825 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt @@ -4,6 +4,7 @@ import androidx.compose.animation.core.LinearOutSlowInEasing import androidx.compose.animation.core.tween import androidx.compose.animation.slideInHorizontally import androidx.compose.animation.slideOutHorizontally +import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController @@ -25,6 +26,7 @@ fun NavController.navigateProfileEdit( } fun NavGraphBuilder.profileEditNavGraph( + paddingValues: PaddingValues, navHostController: NavHostController, ) { composable( @@ -43,6 +45,7 @@ fun NavGraphBuilder.profileEditNavGraph( ) { val args = it.toRoute() ProfileEditRoute( + paddingValues = paddingValues, initialName = args.name, navigateUp = { navHostController.navigateUp() } ) diff --git a/feature/src/main/java/com/terning/feature/onboarding/splash/SplashRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/splash/SplashRoute.kt index da523a392..3de111c73 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/splash/SplashRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/splash/SplashRoute.kt @@ -2,7 +2,9 @@ package com.terning.feature.onboarding.splash import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.SideEffect @@ -19,6 +21,7 @@ import com.terning.feature.R @Composable fun SplashRoute( + paddingValues: PaddingValues, navigateToHome: () -> Unit, navigateToSignIn: () -> Unit, viewModel: SplashViewModel = hiltViewModel(), @@ -52,15 +55,17 @@ fun SplashRoute( } } - SplashScreen() + SplashScreen(paddingValues = paddingValues) } @Composable fun SplashScreen( + paddingValues: PaddingValues = PaddingValues(), modifier: Modifier = Modifier, ) { Column( modifier = modifier + .padding(paddingValues) .fillMaxSize() .background(TerningMain), ) { diff --git a/feature/src/main/java/com/terning/feature/onboarding/splash/navigation/SplashNavigation.kt b/feature/src/main/java/com/terning/feature/onboarding/splash/navigation/SplashNavigation.kt index fa1610589..255acab86 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/splash/navigation/SplashNavigation.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/splash/navigation/SplashNavigation.kt @@ -2,6 +2,7 @@ package com.terning.feature.onboarding.splash.navigation import androidx.compose.animation.EnterTransition import androidx.compose.animation.ExitTransition +import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController @@ -21,6 +22,7 @@ fun NavController.navigateSplash(navOptions: NavOptions? = null) { } fun NavGraphBuilder.splashNavGraph( + paddingValues : PaddingValues, navHostController: NavHostController, ) { composable( @@ -38,6 +40,7 @@ fun NavGraphBuilder.splashNavGraph( } ) { SplashRoute( + paddingValues = paddingValues, navigateToHome = { navHostController.navigateHome( navOptions = NavOptions.Builder().setPopUpTo( From abbb0044a8d58491f60d73c98e2cd4c33d4295ac Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sun, 1 Sep 2024 06:58:17 +0900 Subject: [PATCH 35/62] =?UTF-8?q?[REFACTOR/#206]=20=EB=84=A4=EB=B9=84?= =?UTF-8?q?=EA=B2=8C=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/changefilter/ChangeFilterRoute.kt | 7 ++++- .../com/terning/feature/main/MainScreen.kt | 8 +++--- .../mypage/profileedit/ProfileEditRoute.kt | 26 +++++++++---------- .../navigation/ProfileEditNavigation.kt | 2 -- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/home/changefilter/ChangeFilterRoute.kt b/feature/src/main/java/com/terning/feature/home/changefilter/ChangeFilterRoute.kt index ec13a8e4e..dfc3a938a 100644 --- a/feature/src/main/java/com/terning/feature/home/changefilter/ChangeFilterRoute.kt +++ b/feature/src/main/java/com/terning/feature/home/changefilter/ChangeFilterRoute.kt @@ -2,7 +2,9 @@ package com.terning.feature.home.changefilter import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.material3.Scaffold import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -100,7 +102,10 @@ fun ChangeFilterScreen( modifier = Modifier .shadow(elevation = 2.dp) ) - } + }, + modifier = Modifier + .statusBarsPadding() + .navigationBarsPadding() ) { paddingValues -> Column( modifier = Modifier diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index 89164540c..ca90e4a54 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -9,6 +9,7 @@ import androidx.compose.animation.slideIn import androidx.compose.animation.slideOut import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding import androidx.compose.material3.Icon import androidx.compose.material3.NavigationBar import androidx.compose.material3.NavigationBarItem @@ -57,7 +58,7 @@ fun MainScreen( }, ) { innerPadding -> Column( - modifier = Modifier.fillMaxSize(), + modifier = Modifier.fillMaxSize() ) { NavHost( enterTransition = { @@ -99,10 +100,7 @@ fun MainScreen( startFilteringNavGraph(navHostController = navigator.navController) startHomeNavGraph(navHostController = navigator.navController) internNavGraph(navHostController = navigator.navController) - profileEditNavGraph( - paddingValues = innerPadding, - navHostController = navigator.navController - ) + profileEditNavGraph(navHostController = navigator.navController) } } } diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index 7691cd088..66a03cab9 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -1,13 +1,13 @@ package com.terning.feature.mypage.profileedit import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -39,7 +39,6 @@ import com.terning.feature.R @Composable fun ProfileEditRoute( - paddingValues: PaddingValues, navigateUp: () -> Unit, viewModel: ProfileEditViewModel = hiltViewModel(), initialName: String, @@ -81,7 +80,6 @@ fun ProfileEditRoute( } ProfileEditScreen( - paddingValues = paddingValues, profileEditState = state, onProfileEditClick = { isVisible -> viewModel.updateBottomSheet(isVisible) @@ -100,7 +98,6 @@ fun ProfileEditRoute( @Composable fun ProfileEditScreen( - paddingValues: PaddingValues = PaddingValues(), profileEditState: ProfileEditState, onProfileEditClick: (Boolean) -> Unit, onInputChange: (String) -> Unit, @@ -114,14 +111,15 @@ fun ProfileEditScreen( Column( modifier = modifier + .statusBarsPadding() + .navigationBarsPadding() .fillMaxSize() .addFocusCleaner(focusManager) .background(White) - .padding(paddingValues) ) { BackButtonTopAppBar( onBackButtonClick = { onBackButtonClick() }, - title = stringResource(id = R.string.profile_edit_title) + title = stringResource(id = R.string.profile_edit_title), ) Spacer(modifier = modifier.height(24.dp)) Column( @@ -133,7 +131,7 @@ fun ProfileEditScreen( style = TerningTheme.typography.body2, color = Grey500 ) - Spacer(modifier = Modifier.height(20.dp)) + Spacer(modifier = modifier.height(20.dp)) ProfileWithPlusButton( modifier = modifier .noRippleClickable { @@ -142,12 +140,12 @@ fun ProfileEditScreen( .align(Alignment.CenterHorizontally), index = profileEditState.character ) - Spacer(modifier = Modifier.height(48.dp)) + Spacer(modifier = modifier.height(48.dp)) Text( text = stringResource(id = R.string.sign_up_name), color = Grey500 ) - Spacer(modifier = Modifier.height(20.dp)) + Spacer(modifier = modifier.height(20.dp)) NameTextField( value = name, onValueChange = { editName -> @@ -158,19 +156,19 @@ fun ProfileEditScreen( onValidationChanged(isValid) } ) - Spacer(modifier = Modifier.height(48.dp)) + Spacer(modifier = modifier.height(48.dp)) Text( text = stringResource(id = R.string.profile_edit_auth_type), style = TerningTheme.typography.body2, color = Grey500, ) - Spacer(modifier = Modifier.height(11.dp)) + Spacer(modifier = modifier.height(11.dp)) Text( text = profileEditState.authType, style = TerningTheme.typography.detail0 ) } - + Spacer(modifier = modifier.weight(1f)) RectangleButton( style = TerningTheme.typography.button1, paddingVertical = 20.dp, @@ -178,7 +176,7 @@ fun ProfileEditScreen( onButtonClick = { onSaveClick() }, isEnabled = profileEditState.isButtonValid, ) - Spacer(modifier = Modifier.height(12.dp)) + Spacer(modifier = modifier.height(12.dp)) } } diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt index 6e8797825..9b6c58268 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt @@ -26,7 +26,6 @@ fun NavController.navigateProfileEdit( } fun NavGraphBuilder.profileEditNavGraph( - paddingValues: PaddingValues, navHostController: NavHostController, ) { composable( @@ -45,7 +44,6 @@ fun NavGraphBuilder.profileEditNavGraph( ) { val args = it.toRoute() ProfileEditRoute( - paddingValues = paddingValues, initialName = args.name, navigateUp = { navHostController.navigateUp() } ) From 1c87f3f46db03fc551859ea8751e5e1aded82021 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Mon, 2 Sep 2024 02:38:03 +0900 Subject: [PATCH 36/62] =?UTF-8?q?[CHORE/#206]=20=EB=B0=94=ED=85=80?= =?UTF-8?q?=EC=8B=9C=ED=8A=B8=20=EB=84=88=EB=B9=84=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bottomsheet/ProfileBottomSheet.kt | 25 ++++++++----------- .../feature/mypage/mypage/MyPageRoute.kt | 4 +-- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt index bbf58c980..87de9fa95 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt @@ -5,7 +5,6 @@ import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.LazyVerticalGrid @@ -52,14 +51,14 @@ fun ProfileBottomSheet( TerningBasicBottomSheet( content = { - Column { + Column(modifier = modifier) { Text( text = stringResource(id = R.string.sign_up_bottom_sheet_title), style = TerningTheme.typography.title2, - modifier = modifier + modifier = Modifier .padding( start = 28.dp, - bottom = 25.dp + bottom = 20.dp ), ) RadioButtonGroup( @@ -107,19 +106,17 @@ fun RadioButtonGroup( LazyVerticalGrid( columns = GridCells.Fixed(3), - verticalArrangement = Arrangement.spacedBy(20.dp), - horizontalArrangement = Arrangement.spacedBy(24.dp), - modifier = modifier - .padding(horizontal = 42.dp) + verticalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(20.dp), + modifier = modifier.padding(horizontal = 34.dp) ) { itemsIndexed(options) { index, option -> val imageModifier = if (selectedOption == options[index]) { - modifier - .border( - color = TerningMain, - width = 2.dp, - shape = CircleShape - ) + modifier.border( + color = TerningMain, + width = 2.dp, + shape = CircleShape + ) } else { modifier } diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt index b340756fb..48b8761a5 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt @@ -132,13 +132,13 @@ fun MyPageRoute( @Composable fun MyPageScreen( - paddingValues: PaddingValues = PaddingValues(), + modifier: Modifier = Modifier, onLogoutClick: () -> Unit, onQuitClick: () -> Unit, onNoticeClick: () -> Unit, onOpinionClick: () -> Unit, onEditClick: () -> Unit, - modifier: Modifier = Modifier, + paddingValues: PaddingValues = PaddingValues(), name: String = "", profile: Int = 0 ) { From 0906e9cfd4a9caaa42fcb73a68c493b00319a672 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Mon, 2 Sep 2024 02:54:04 +0900 Subject: [PATCH 37/62] =?UTF-8?q?[CHORE/#206]=20=EB=B0=94=ED=85=80?= =?UTF-8?q?=EC=8B=9C=ED=8A=B8=20=EB=84=88=EB=B9=84=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bottomsheet/MyPageLogoutBottomSheet.kt | 13 ++++++++----- .../bottomsheet/MyPageQuitBottomSheet.kt | 17 ++++++++++------- .../feature/mypage/mypage/MyPageRoute.kt | 2 +- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/MyPageLogoutBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/MyPageLogoutBottomSheet.kt index ff3268983..9d7e9d318 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/MyPageLogoutBottomSheet.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/MyPageLogoutBottomSheet.kt @@ -1,6 +1,8 @@ package com.terning.core.designsystem.component.bottomsheet import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text @@ -41,18 +43,20 @@ fun MyPageLogoutBottomSheet( content = { Column( horizontalAlignment = Alignment.CenterHorizontally, + modifier = modifier ) { + Spacer(modifier = modifier.height(10.dp)) Text( text = stringResource(id = R.string.my_page_bottom_sheet_title), style = TerningTheme.typography.heading1, - modifier = modifier.padding(top = 35.dp) ) + Spacer(modifier = modifier.height(60.dp)) Text( text = stringResource(id = R.string.my_page_logout_sub), style = TerningTheme.typography.body4, color = Grey400, - modifier = modifier.padding(top = 54.dp) ) + Spacer(modifier = modifier.height(64.dp)) RoundButton( style = TerningTheme.typography.button2, paddingVertical = 15.dp, @@ -63,10 +67,10 @@ fun MyPageLogoutBottomSheet( }, modifier = modifier.padding( start = 24.dp, - top = 72.dp, end = 24.dp ), ) + Spacer(modifier = modifier.height(8.dp)) DeleteRoundButton( style = TerningTheme.typography.button2, paddingVertical = 15.dp, @@ -82,11 +86,10 @@ fun MyPageLogoutBottomSheet( }, modifier = modifier.padding( start = 24.dp, - top = 8.dp, end = 24.dp, - bottom = 100.dp ) ) + Spacer(modifier = modifier.height(32.dp)) } }, onDismissRequest = { onDismiss() }, diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/MyPageQuitBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/MyPageQuitBottomSheet.kt index 42c1d597b..dd8717115 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/MyPageQuitBottomSheet.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/MyPageQuitBottomSheet.kt @@ -1,6 +1,8 @@ package com.terning.core.designsystem.component.bottomsheet import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text @@ -42,19 +44,21 @@ fun MyPageQuitBottomSheet( content = { Column( horizontalAlignment = Alignment.CenterHorizontally, + modifier = modifier ) { + Spacer(modifier = modifier.height(10.dp)) Text( text = stringResource(id = R.string.my_page_bottom_sheet_title), style = TerningTheme.typography.heading1, - modifier = modifier.padding(top = 14.dp) ) + Spacer(modifier = modifier.height(28.dp)) Text( text = stringResource(id = R.string.my_page_quit_sub), style = TerningTheme.typography.body3, - modifier = modifier.padding(top = 54.dp), textAlign = TextAlign.Center, color = Grey400 ) + Spacer(modifier = modifier.height(36.dp)) RoundButton( style = TerningTheme.typography.button2, paddingVertical = 15.dp, @@ -63,12 +67,12 @@ fun MyPageQuitBottomSheet( onButtonClick = { onQuitClick() }, - modifier = modifier.padding( + modifier = Modifier.padding( start = 24.dp, - top = 41.dp, end = 24.dp ) ) + Spacer(modifier = modifier.height(8.dp)) DeleteRoundButton( style = TerningTheme.typography.button2, paddingVertical = 15.dp, @@ -82,13 +86,12 @@ fun MyPageQuitBottomSheet( } } }, - modifier = modifier.padding( + modifier = Modifier.padding( start = 24.dp, - top = 8.dp, end = 24.dp, - bottom = 100.dp ) ) + Spacer(modifier = modifier.height(32.dp)) } }, onDismissRequest = { onDismiss() }, diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt index 48b8761a5..a4407094f 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt @@ -132,12 +132,12 @@ fun MyPageRoute( @Composable fun MyPageScreen( - modifier: Modifier = Modifier, onLogoutClick: () -> Unit, onQuitClick: () -> Unit, onNoticeClick: () -> Unit, onOpinionClick: () -> Unit, onEditClick: () -> Unit, + modifier: Modifier = Modifier, paddingValues: PaddingValues = PaddingValues(), name: String = "", profile: Int = 0 From 23bf23b421223fea75c60f71fae0a9d41dfb043f Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Mon, 2 Sep 2024 03:33:57 +0900 Subject: [PATCH 38/62] =?UTF-8?q?[FEAT/#206]=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EC=9C=A0=ED=9A=A8=EC=84=B1=20=EA=B2=80?= =?UTF-8?q?=EC=82=AC=20=EB=A1=9C=EC=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/mypage/mypage/MyPageRoute.kt | 7 +++-- .../mypage/navigation/MyPageNavigation.kt | 2 +- .../mypage/profileedit/ProfileEditRoute.kt | 18 +++++++------ .../mypage/profileedit/ProfileEditState.kt | 5 +++- .../profileedit/ProfileEditViewModel.kt | 27 ++++++++++++++----- .../navigation/ProfileEditNavigation.kt | 8 +++--- 6 files changed, 46 insertions(+), 21 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt index a4407094f..3cd54e59a 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt @@ -49,7 +49,7 @@ import com.terning.feature.mypage.mypage.component.MyPageItem fun MyPageRoute( paddingValues: PaddingValues, viewModel: MyPageViewModel = hiltViewModel(), - navigateToProfileEdit: (String) -> Unit + navigateToProfileEdit: (String, Int) -> Unit ) { val state by viewModel.state.collectAsStateWithLifecycle() val context = LocalContext.current @@ -67,7 +67,10 @@ fun MyPageRoute( viewModel.sideEffects.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle) .collect { sideEffect -> when (sideEffect) { - is MyPageSideEffect.NavigateToProfileEdit -> navigateToProfileEdit(state.name) + is MyPageSideEffect.NavigateToProfileEdit -> navigateToProfileEdit( + state.name, + state.profile + ) } } } diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt index 79a5d497d..1940effbd 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt @@ -27,7 +27,7 @@ fun NavGraphBuilder.myPageNavGraph( composable{ MyPageRoute( paddingValues = paddingValues, - navigateToProfileEdit = { name -> navHostController.navigateProfileEdit(name) } + navigateToProfileEdit = { name, profile -> navHostController.navigateProfileEdit(name, profile) } ) } } diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index 66a03cab9..b7842cd7d 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -42,6 +42,7 @@ fun ProfileEditRoute( navigateUp: () -> Unit, viewModel: ProfileEditViewModel = hiltViewModel(), initialName: String, + initialProfile: Int ) { val state by viewModel.state.collectAsStateWithLifecycle() @@ -56,7 +57,7 @@ fun ProfileEditRoute( } LaunchedEffect(key1 = true) { - viewModel.updateName(initialName) + viewModel.updateInitialInfo(initialName = initialName, initialProfile = initialProfile) } if (state.showBottomSheet) { @@ -64,9 +65,10 @@ fun ProfileEditRoute( onDismiss = { viewModel.updateBottomSheet(false) }, onSaveClick = { index -> viewModel.updateBottomSheet(false) - viewModel.updateCharacter(index) + viewModel.updateProfile(index) + viewModel.checkIsInfoChange(editName = state.name, editProfile = index) }, - initialSelectedOption = state.character + initialSelectedOption = state.profile ) } @@ -86,12 +88,13 @@ fun ProfileEditRoute( }, onInputChange = { editName -> viewModel.updateName(editName) + viewModel.checkIsInfoChange(editName = editName, editProfile = state.profile) }, onSaveClick = { viewModel.navigateUp() }, name = state.name, onBackButtonClick = { viewModel.navigateUp() }, onValidationChanged = { isValid -> - viewModel.updateButtonValidation(isValid) + if (state.isInfoChange) viewModel.updateButtonValidation(isValid) } ) } @@ -123,8 +126,7 @@ fun ProfileEditScreen( ) Spacer(modifier = modifier.height(24.dp)) Column( - modifier = modifier - .padding(horizontal = 24.dp) + modifier = modifier.padding(horizontal = 24.dp) ) { Text( text = stringResource(id = R.string.sign_up_profile_image), @@ -133,12 +135,12 @@ fun ProfileEditScreen( ) Spacer(modifier = modifier.height(20.dp)) ProfileWithPlusButton( - modifier = modifier + modifier = Modifier .noRippleClickable { onProfileEditClick(true) } .align(Alignment.CenterHorizontally), - index = profileEditState.character + index = profileEditState.profile ) Spacer(modifier = modifier.height(48.dp)) Text( diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt index a4f3079cb..47b3e7192 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt @@ -2,7 +2,10 @@ package com.terning.feature.mypage.profileedit data class ProfileEditState( val name: String = "", - val character: Int = 0, + val initialName: String = "", + val profile: Int = 0, + val initialProfile: Int = 0, + val isInfoChange: Boolean = false, val isButtonValid: Boolean = false, val authType: String = "", val showBottomSheet: Boolean = false diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt index 9260ed618..58bcec276 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt @@ -25,10 +25,6 @@ class ProfileEditViewModel @Inject constructor() : ViewModel() { _state.value = _state.value.copy(isButtonValid = isValid) } - fun updateCharacter(character: Int) { - _state.value = _state.value.copy(character = character) - } - fun navigateUp() = viewModelScope.launch { _sideEffects.emit(ProfileEditSideEffect.NavigateUp) } fun updateBottomSheet(isVisible: Boolean) { @@ -39,7 +35,26 @@ class ProfileEditViewModel @Inject constructor() : ViewModel() { _state.value = _state.value.copy(name = name) } - companion object { - private const val KAKA0 = "KAKAO" + fun updateProfile(profile: Int) { + _state.value = _state.value.copy(profile = profile) + } + + fun updateInitialInfo(initialName: String, initialProfile: Int) { + _state.value = _state.value.copy( + name = initialName, + initialName = initialName, + profile = initialProfile, + initialProfile = initialProfile + ) } + + fun checkIsInfoChange(editName: String, editProfile: Int) { + _state.value = _state.value.copy( + isInfoChange = when { + editName == _state.value.initialName && editProfile == _state.value.initialProfile -> false + else -> true + } + ) + } + } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt index 9b6c58268..71ef7f910 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/navigation/ProfileEditNavigation.kt @@ -4,7 +4,6 @@ import androidx.compose.animation.core.LinearOutSlowInEasing import androidx.compose.animation.core.tween import androidx.compose.animation.slideInHorizontally import androidx.compose.animation.slideOutHorizontally -import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController @@ -17,10 +16,11 @@ import kotlinx.serialization.Serializable fun NavController.navigateProfileEdit( name: String, + profile: Int, navOptions: NavOptions? = null ) { navigate( - route = ProfileEdit(name = name), + route = ProfileEdit(name = name, profile = profile), navOptions = navOptions ) } @@ -45,6 +45,7 @@ fun NavGraphBuilder.profileEditNavGraph( val args = it.toRoute() ProfileEditRoute( initialName = args.name, + initialProfile = args.profile, navigateUp = { navHostController.navigateUp() } ) } @@ -52,5 +53,6 @@ fun NavGraphBuilder.profileEditNavGraph( @Serializable data class ProfileEdit( - val name: String + val name: String, + val profile: Int ) : Route \ No newline at end of file From 4d1ec63b7c89952be829b1e535c451100edd1d96 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Mon, 2 Sep 2024 03:44:53 +0900 Subject: [PATCH 39/62] =?UTF-8?q?[FEAT/#206]=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EC=9C=A0=ED=9A=A8=EC=84=B1=20=EA=B2=80?= =?UTF-8?q?=EC=82=AC=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/mypage/profileedit/ProfileEditViewModel.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt index 58bcec276..c0f821d19 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt @@ -49,11 +49,10 @@ class ProfileEditViewModel @Inject constructor() : ViewModel() { } fun checkIsInfoChange(editName: String, editProfile: Int) { + val isInfoChanged = editName != _state.value.initialName || editProfile != _state.value.initialProfile _state.value = _state.value.copy( - isInfoChange = when { - editName == _state.value.initialName && editProfile == _state.value.initialProfile -> false - else -> true - } + isInfoChange = isInfoChanged, + isButtonValid = isInfoChanged && _state.value.isButtonValid ) } From 266f4191fe1d13000f433da76c940b5b047bbf61 Mon Sep 17 00:00:00 2001 From: arinming Date: Mon, 2 Sep 2024 18:32:37 +0900 Subject: [PATCH 40/62] =?UTF-8?q?[FEAT/#191]=20=EC=9D=B8=ED=84=B4=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=86=8C?= =?UTF-8?q?=EC=A0=9C=EB=AA=A9=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/intern/InternRoute.kt | 56 ++----------------- .../intern/component/InternPageTitle.kt | 25 +++++---- feature/src/main/res/values/strings.xml | 3 +- 3 files changed, 20 insertions(+), 64 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index 339f658c6..2cc24cc3f 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -196,64 +196,14 @@ fun InternScreen( ) { InternPageTitle( modifier = modifier, - text = stringResource(id = R.string.intern_sub_title_intern_info) + text = stringResource(id = R.string.intern_sub_title_intern_summary) ) InternPageTitle( modifier = modifier, - text = stringResource(id = R.string.intern_sub_title_intern_summary) + text = stringResource(id = R.string.intern_info_request) ) - Column( - modifier = modifier - .padding( - start = 24.dp, - bottom = 16.dp, - end = 24.dp - ) - .fillMaxWidth(), - verticalArrangement = Arrangement.Top, - horizontalAlignment = Alignment.Start, - ) { - Row( - modifier = modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.spacedBy( - 3.dp, - Alignment.Start - ), - verticalAlignment = Alignment.Top - ) { - Row( - modifier = modifier - .weight(2f), - verticalAlignment = Alignment.Top, - ) { - Icon( - painter = painterResource(id = R.drawable.ic_first_info_20), - contentDescription = null - ) - Text( - text = stringResource(id = R.string.intern_info_request), - style = TerningTheme.typography.button2, - color = Black - ) - } - Column( - modifier = modifier - .weight(5f) - .padding(start = 8.dp), - verticalArrangement = Arrangement.spacedBy(4.dp, Alignment.Top), - ) { - qualificationList.forEach { qualification -> - Text( - text = qualification, - style = TerningTheme.typography.body4, - color = Grey400, - ) - } - } - } - } Column( modifier = modifier .padding(horizontal = 24.dp) @@ -302,10 +252,12 @@ fun InternScreen( } } } + InternPageTitle( modifier = modifier, text = stringResource(id = R.string.intern_sub_title_intern_detail) ) + Column( modifier = modifier.padding( start = 24.dp, diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternPageTitle.kt b/feature/src/main/java/com/terning/feature/intern/component/InternPageTitle.kt index 011191a5a..8899a50be 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternPageTitle.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternPageTitle.kt @@ -1,39 +1,44 @@ package com.terning.feature.intern.component -import androidx.compose.foundation.background +import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.material3.Text +import androidx.compose.material3.VerticalDivider import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp +import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.TerningMain -import com.terning.core.designsystem.theme.TerningSub4 import com.terning.core.designsystem.theme.TerningTheme @Composable fun InternPageTitle( modifier: Modifier, - text: String + text: String, ) { Row( modifier = modifier + .height(IntrinsicSize.Min) .fillMaxWidth() .padding( - top = 16.dp, - bottom = 16.dp + top = 7.dp, + bottom = 6.dp, + start = 24.dp ) - .background(TerningSub4) ) { + VerticalDivider( + color = TerningMain, + thickness = 2.dp, + ) Text( text = text, style = TerningTheme.typography.title4, - color = TerningMain, + color = Black, modifier = modifier.padding( - top = 7.dp, - bottom = 6.dp, - start = 20.dp + start = 8.dp ) ) } diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 8c649e3cb..67de7f5e3 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -126,10 +126,9 @@ 서류 마감 근무 기간 근무 시작 - 공고 정보 공고 요약 + 자격 요건 상세 정보 - 자격요건 직무 관심 공고가 캘린더에 스크랩되었어요! 관심 공고가 캘린더에서 사라졌어요! From e518f4829fd1f1fc126f9632a179a07afe37a29c Mon Sep 17 00:00:00 2001 From: arinming Date: Mon, 2 Sep 2024 18:44:56 +0900 Subject: [PATCH 41/62] =?UTF-8?q?[FEAT/#191]=20=EC=9D=B8=ED=84=B4=20?= =?UTF-8?q?=EA=B3=B5=EA=B3=A0=20=EC=9A=94=EC=95=BD=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/intern/InternRoute.kt | 45 +++++++------------ .../feature/intern/component/InternInfoRow.kt | 8 ++-- .../intern/component/InternPageTitle.kt | 1 - feature/src/main/res/values/strings.xml | 3 +- 4 files changed, 23 insertions(+), 34 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index 2cc24cc3f..51d627d7c 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -2,7 +2,6 @@ package com.terning.feature.intern import android.view.ViewGroup import android.webkit.WebView -import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -10,7 +9,6 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Icon import androidx.compose.material3.Scaffold import androidx.compose.material3.Text @@ -33,7 +31,6 @@ import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.Grey400 -import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.extension.customShadow import com.terning.core.extension.toast @@ -170,40 +167,36 @@ fun InternScreen( viewCount = decimal.format(internInfoModel.viewCount) ) + Spacer(modifier = modifier.padding(top = 16.dp)) + + InternPageTitle( + modifier = modifier, + text = stringResource(id = R.string.intern_sub_title_intern_summary) + ) + Column( - modifier = modifier - .border( - width = 1.dp, - color = TerningMain, - shape = RoundedCornerShape(size = 5.dp) - ) - .fillMaxWidth() - .padding(start = 16.dp, top = 16.dp, bottom = 16.dp), - verticalArrangement = Arrangement.spacedBy( - 6.dp, - Alignment.CenterVertically - ), - horizontalAlignment = Alignment.Start, + modifier = modifier.padding( + top = 4.dp, + bottom = 4.dp, + start = 10.dp + ) ) { internInfoList.forEach { (title, value) -> InternInfoRow(title, value) } } - } - Column( - verticalArrangement = Arrangement.Top, - ) { - InternPageTitle( - modifier = modifier, - text = stringResource(id = R.string.intern_sub_title_intern_summary) - ) + Spacer(modifier = modifier.padding(top = 16.dp)) InternPageTitle( modifier = modifier, text = stringResource(id = R.string.intern_info_request) ) + } + Column( + verticalArrangement = Arrangement.Top, + ) { Column( modifier = modifier .padding(horizontal = 24.dp) @@ -225,10 +218,6 @@ fun InternScreen( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { - Icon( - painter = painterResource(id = R.drawable.ic_second_info_20), - contentDescription = null, - ) Text( text = stringResource(id = R.string.intern_info_work), style = TerningTheme.typography.button2, diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternInfoRow.kt b/feature/src/main/java/com/terning/feature/intern/component/InternInfoRow.kt index b01654710..756b4c097 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternInfoRow.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternInfoRow.kt @@ -6,25 +6,25 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.unit.dp -import com.terning.core.designsystem.theme.Black +import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.Grey500 import com.terning.core.designsystem.theme.TerningTheme @Composable fun InternInfoRow(title: String, value: String) { Row( - horizontalArrangement = Arrangement.spacedBy(12.dp, Alignment.Start), + horizontalArrangement = Arrangement.spacedBy(23.dp, Alignment.Start), verticalAlignment = Alignment.Top, ) { Text( text = title, style = TerningTheme.typography.body2, - color = Black, + color = Grey500, ) Text( text = value, style = TerningTheme.typography.body3, - color = Grey500, + color = Grey400, ) } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternPageTitle.kt b/feature/src/main/java/com/terning/feature/intern/component/InternPageTitle.kt index 8899a50be..79aa47b82 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternPageTitle.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternPageTitle.kt @@ -26,7 +26,6 @@ fun InternPageTitle( .padding( top = 7.dp, bottom = 6.dp, - start = 24.dp ) ) { VerticalDivider( diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 67de7f5e3..175133972 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -129,7 +129,8 @@ 공고 요약 자격 요건 상세 정보 - 직무 + 모집대상 + 모집직무 관심 공고가 캘린더에 스크랩되었어요! 관심 공고가 캘린더에서 사라졌어요! From a2a58ce28e572f76e8a2ba22b7526824932732e3 Mon Sep 17 00:00:00 2001 From: arinming Date: Mon, 2 Sep 2024 18:59:25 +0900 Subject: [PATCH 42/62] =?UTF-8?q?[FEAT/#191]=20=EC=9D=B8=ED=84=B4=20?= =?UTF-8?q?=EC=9E=90=EA=B2=A9=20=EC=9A=94=EA=B1=B4=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/intern/InternRoute.kt | 71 +++++-------------- feature/src/main/res/values/strings.xml | 2 +- 2 files changed, 20 insertions(+), 53 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index 51d627d7c..920d2b4fb 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -4,21 +4,16 @@ import android.view.ViewGroup import android.webkit.WebView import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.material3.Icon import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.viewinterop.AndroidView @@ -28,7 +23,6 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle import com.terning.core.designsystem.component.dialog.TerningBasicDialog import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar -import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningTheme @@ -96,8 +90,10 @@ fun InternScreen( stringResource(id = R.string.intern_info_start_date) to internInfoModel.startDate, ) - val qualificationList = internInfoModel.qualification.split(",").map { it.trim() } - val jobTypeList = internInfoModel.jobType.split(",").map { it.trim() } + val qualificationList = listOf( + stringResource(id = R.string.intern_recruitment_target) to internInfoModel.qualification, + stringResource(id = R.string.intern_info_work) to internInfoModel.jobType, + ) if (internUiState.showWeb) { AndroidView( @@ -192,60 +188,31 @@ fun InternScreen( modifier = modifier, text = stringResource(id = R.string.intern_info_request) ) - } - Column( - verticalArrangement = Arrangement.Top, - ) { Column( - modifier = modifier - .padding(horizontal = 24.dp) - .fillMaxWidth(), - verticalArrangement = Arrangement.Top, - horizontalAlignment = Alignment.Start, + modifier = modifier.padding( + top = 4.dp, + bottom = 4.dp, + start = 10.dp + ) ) { - Row( - modifier = modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.spacedBy( - 3.dp, - Alignment.Start - ), - verticalAlignment = Alignment.Top - ) { - Row( - modifier = modifier - .weight(2f), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.Start - ) { - Text( - text = stringResource(id = R.string.intern_info_work), - style = TerningTheme.typography.button2, - color = Black - ) - } - - Column( - modifier = modifier - .weight(5f) - .padding(start = 8.dp), - verticalArrangement = Arrangement.spacedBy(4.dp, Alignment.Top), - ) { - jobTypeList.forEach { jobType -> - Text( - text = jobType, - style = TerningTheme.typography.body4, - color = Grey400, - ) - } - } + qualificationList.forEach { (title, value) -> + InternInfoRow(title, value) } } + Spacer(modifier = modifier.padding(top = 16.dp)) + InternPageTitle( modifier = modifier, text = stringResource(id = R.string.intern_sub_title_intern_detail) ) + } + + Column( + verticalArrangement = Arrangement.Top, + ) { + Column( modifier = modifier.padding( diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index 175133972..cde3fa5a8 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -129,7 +129,7 @@ 공고 요약 자격 요건 상세 정보 - 모집대상 + 모집대상 모집직무 관심 공고가 캘린더에 스크랩되었어요! 관심 공고가 캘린더에서 사라졌어요! From 070a4ae429e6d3cffd6869c3c39a7f10cc2eb549 Mon Sep 17 00:00:00 2001 From: arinming Date: Mon, 2 Sep 2024 19:02:14 +0900 Subject: [PATCH 43/62] =?UTF-8?q?[FEAT/#191]=20=EC=9D=B8=ED=84=B4=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=EC=A0=95=EB=B3=B4=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/terning/feature/intern/InternRoute.kt | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index 920d2b4fb..75348a3d9 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -2,7 +2,6 @@ package com.terning.feature.intern import android.view.ViewGroup import android.webkit.WebView -import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.padding @@ -207,17 +206,11 @@ fun InternScreen( modifier = modifier, text = stringResource(id = R.string.intern_sub_title_intern_detail) ) - } - - Column( - verticalArrangement = Arrangement.Top, - ) { - Column( modifier = modifier.padding( - start = 24.dp, - end = 24.dp, + start = 10.dp, + top = 5.dp, bottom = 20.dp ) ) { @@ -230,6 +223,7 @@ fun InternScreen( } } } + if (internUiState.isScrapDialogVisible) { TerningBasicDialog( onDismissRequest = { From 2739af50f9fb959554918a84735748d0ca69feed Mon Sep 17 00:00:00 2001 From: arinming Date: Mon, 2 Sep 2024 19:04:41 +0900 Subject: [PATCH 44/62] =?UTF-8?q?[FEAT/#191]=20=EC=9D=B8=ED=84=B4=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=EC=A0=95=EB=B3=B4=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EC=84=A0=ED=83=9D=20=EC=98=81=EC=97=AD=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/terning/feature/intern/InternRoute.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index 75348a3d9..116b1888b 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.text.selection.SelectionContainer import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -214,11 +215,13 @@ fun InternScreen( bottom = 20.dp ) ) { - Text( - text = internInfoModel.detail.trimIndent(), - style = TerningTheme.typography.detail1, - color = Grey400 - ) + SelectionContainer { + Text( + text = internInfoModel.detail.trimIndent(), + style = TerningTheme.typography.body3, + color = Grey400 + ) + } } } } From 71af2c5d3acc493691c3b557b65e4be181834ec7 Mon Sep 17 00:00:00 2001 From: arinming Date: Mon, 2 Sep 2024 19:08:56 +0900 Subject: [PATCH 45/62] =?UTF-8?q?[FEAT/#191]=20=EC=9D=B8=ED=84=B4=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=92=A4?= =?UTF-8?q?=EB=A1=9C=20=EA=B0=80=EA=B8=B0=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/terning/feature/intern/InternRoute.kt | 7 ++++++- .../terning/feature/intern/navigation/InternNavigation.kt | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index 116b1888b..bcab1d50e 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -21,6 +21,7 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.flowWithLifecycle +import androidx.navigation.NavHostController import com.terning.core.designsystem.component.dialog.TerningBasicDialog import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar import com.terning.core.designsystem.theme.Grey200 @@ -43,6 +44,7 @@ import java.text.DecimalFormat fun InternRoute( announcementId: Long = 0, viewModel: InternViewModel = hiltViewModel(), + navController: NavHostController, ) { val internState by viewModel.internUiState.collectAsStateWithLifecycle() @@ -69,7 +71,8 @@ fun InternRoute( is UiState.Success -> { InternScreen( internUiState = internState, - internInfoModel = (internState.loadState as UiState.Success).data + internInfoModel = (internState.loadState as UiState.Success).data, + navController = navController ) } } @@ -78,6 +81,7 @@ fun InternRoute( @Composable fun InternScreen( modifier: Modifier = Modifier, + navController: NavHostController, viewModel: InternViewModel = hiltViewModel(), internUiState: InternUiState, internInfoModel: InternInfoModel, @@ -119,6 +123,7 @@ fun InternScreen( offsetY = 2.dp ), onBackButtonClick = { + navController.popBackStack() }, ) }, diff --git a/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt b/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt index 751aa15d2..7bc5c14c3 100644 --- a/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt +++ b/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt @@ -42,6 +42,7 @@ fun NavGraphBuilder.internNavGraph( val args = it.toRoute() InternRoute( announcementId = args.announcementId, + navController = navHostController ) } } From 58d51c1ea0adc14b90826e01e088f5b953477c0d Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Tue, 3 Sep 2024 14:09:32 +0900 Subject: [PATCH 46/62] =?UTF-8?q?[FIX/#216]=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=20=EC=84=9C=EB=B2=84=20=EA=B6=8C=ED=95=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dokka.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dokka.yml b/.github/workflows/dokka.yml index 252f3cd3d..33920026f 100644 --- a/.github/workflows/dokka.yml +++ b/.github/workflows/dokka.yml @@ -27,10 +27,12 @@ jobs: - name: Set Local Properties env: BASE_URL: ${{ secrets.BASE_URL }} + TEST_BASE_URL: ${{ secrets.TEST_BASE_URL }} NATIVE_APP_KEY: ${{ secrets.NATIVE_APP_KEY }} NATIVEAPPKEY: ${{ secrets.NATIVEAPPKEY }} run: | echo base.url=\"$BASE_URL\" >> local.properties + echo test.base.url=\"$TEST_BASE_URL\" >> local.properties echo native.app.key=\"$NATIVE_APP_KEY\" >> local.properties echo nativeAppKey=\"$NATIVEAPPKEY\" >> local.properties From ffab2b0d7513d8c8b2652966092a3ab45fbd1984 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Tue, 3 Sep 2024 14:12:50 +0900 Subject: [PATCH 47/62] =?UTF-8?q?[FIX/#216]=20=ED=94=BC=EC=95=8C=20?= =?UTF-8?q?=EC=B2=B4=EC=BB=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr_checker.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr_checker.yml b/.github/workflows/pr_checker.yml index e8548ccda..d08ddca5a 100644 --- a/.github/workflows/pr_checker.yml +++ b/.github/workflows/pr_checker.yml @@ -41,5 +41,11 @@ jobs: - name: Access Local Properties env: base_url: ${{ secrets.BASE_URL }} + TEST_BASE_URL: ${{ secrets.TEST_BASE_URL }} + NATIVE_APP_KEY: ${{ secrets.NATIVE_APP_KEY }} + NATIVEAPPKEY: ${{ secrets.NATIVEAPPKEY }} run: | - echo base.url=\"$base_url\" >> local.properties \ No newline at end of file + echo base.url=\"$base_url\" >> local.properties + echo test.base.url=\"$TEST_BASE_URL\" >> local.properties + echo native.app.key=\"$NATIVE_APP_KEY\" >> local.properties + echo nativeAppKey=\"$NATIVEAPPKEY\" >> local.properties \ No newline at end of file From 6aad38fda45ff5cfb73d4780956d42b619d3aabc Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Tue, 3 Sep 2024 18:56:37 +0900 Subject: [PATCH 48/62] =?UTF-8?q?[FIX/#206]=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=EA=B0=84=EA=B2=A9=20=EC=A1=B0=EC=A0=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/onboarding/signup/SignUpRoute.kt | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index 6f30f8675..6c719aca8 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -3,6 +3,7 @@ package com.terning.feature.onboarding.signup import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -106,30 +107,25 @@ fun SignUpScreen( .fillMaxSize() .addFocusCleaner(focusManager) ) { - Spacer(modifier = modifier.weight(1f)) + Spacer(modifier = modifier.height(56.dp)) Text( text = stringResource(id = R.string.sign_up_title), style = TerningTheme.typography.heading2, - modifier = modifier.padding( - bottom = 42.dp, - start = 24.dp - ) + modifier = modifier.padding(start = 24.dp) ) + Spacer(modifier = modifier.height(36.dp)) Text( text = stringResource(id = R.string.sign_up_profile_image), style = TerningTheme.typography.body2, modifier = modifier - .padding( - start = 24.dp, - bottom = 20.dp - ), + .padding(start = 24.dp), color = Grey500 ) + Spacer(modifier = modifier.height(20.dp)) Column( - modifier = modifier - .align(Alignment.CenterHorizontally) - .padding(bottom = 52.dp) + modifier = modifier.align(Alignment.CenterHorizontally) ) { + Spacer(modifier = modifier.height(48.dp)) ProfileWithPlusButton( modifier = modifier.noRippleClickable { onProfileEditClick(true) @@ -142,10 +138,8 @@ fun SignUpScreen( .align(Alignment.CenterHorizontally) .padding(horizontal = 24.dp) ) { - Text( - text = stringResource(id = R.string.sign_up_name), - modifier = modifier.padding(bottom = 20.dp) - ) + Text(text = stringResource(id = R.string.sign_up_name)) + Spacer(modifier = modifier.height(20.dp)) NameTextField( value = signUpState.name, onValueChange = { name -> @@ -155,7 +149,7 @@ fun SignUpScreen( onValidationChanged = { isValid -> onValidationChanged(isValid) } ) } - Spacer(modifier = modifier.weight(5f)) + Spacer(modifier = modifier.weight(1f)) RectangleButton( style = TerningTheme.typography.button1, paddingVertical = 20.dp, From 46ddf253bbc61be7b2d8aee130fb4b81efb4c7ac Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 4 Sep 2024 15:17:34 +0900 Subject: [PATCH 49/62] =?UTF-8?q?[FEAT/#206]=20=EC=88=98=EC=A0=95=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/textfield/NameTextField.kt | 20 ++++++++++--- .../textfield/TerningBasicTextField.kt | 20 +++++++------ .../mypage/profileedit/ProfileEditRoute.kt | 25 ++++++++-------- .../mypage/profileedit/ProfileEditState.kt | 3 +- .../profileedit/ProfileEditViewModel.kt | 29 +++++++------------ 5 files changed, 50 insertions(+), 47 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt index 2eff36cd3..04d33a4a1 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt @@ -21,9 +21,9 @@ import com.terning.core.util.NAME_ERROR_REGEX data class NameFieldState( val name: String, val lineColor: Color, - val helperMessage: Int, + val helperMessage: Int?, val helperIcon: Int?, - val helperColor: Color, + val helperColor: Color?, val isValid: Boolean ) @@ -33,7 +33,8 @@ fun NameTextField( onValueChange: (String) -> Unit, hint: String, modifier: Modifier = Modifier, - onValidationChanged: (Boolean) -> Unit + onValidationChanged: (Boolean) -> Unit, + initialView: Boolean = false ) { val focusManager = LocalFocusManager.current val keyboardController = LocalSoftwareKeyboardController.current @@ -49,6 +50,17 @@ fun NameTextField( } val state = when { + initialView -> { + NameFieldState( + name = trimmedName, + lineColor = Grey500, + helperMessage = null, + helperIcon = null, + helperColor = null, + isValid = false + ) + } + nameErrorRegex.matcher(trimmedName).find() -> { NameFieldState( name = trimmedName, @@ -108,7 +120,7 @@ fun NameTextField( hintColor = Grey300, showTextLength = true, maxTextLength = MAX_LENGTH, - helperMessage = stringResource(id = state.helperMessage), + helperMessage = state.helperMessage?.let { stringResource(id = it) }, helperIcon = state.helperIcon, helperColor = state.helperColor, imeAction = ImeAction.Done, diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt index 67c799550..855897161 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt @@ -48,10 +48,10 @@ fun TerningBasicTextField( maxTextLength: Int? = null, showTextLength: Boolean = false, hint: String = "", - helperMessage: String = "", + helperMessage: String? = "", helperIcon: Int? = null, enabled: Boolean = true, - helperColor: Color, + helperColor: Color? = null, readOnly: Boolean = false, onDoneAction: () -> Unit? = {}, onSearchAction: () -> Unit? = {}, @@ -137,17 +137,19 @@ fun TerningBasicTextField( horizontalArrangement = Arrangement.spacedBy(4.dp), modifier = modifier.padding(top = 5.dp) ) { - helperIcon?.let { + if (helperIcon != null && helperColor != null) { Icon( - painter = painterResource(id = it), + painter = painterResource(id = helperIcon), contentDescription = null, tint = helperColor, ) } - Text( - text = helperMessage, - style = TerningTheme.typography.detail3, - color = helperColor, - ) + if (helperMessage != null && helperColor != null) { + Text( + text = helperMessage, + style = TerningTheme.typography.detail3, + color = helperColor, + ) + } } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index b7842cd7d..1b51a7430 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -60,27 +60,26 @@ fun ProfileEditRoute( viewModel.updateInitialInfo(initialName = initialName, initialProfile = initialProfile) } + LaunchedEffect(viewModel.sideEffects, lifecycleOwner) { + viewModel.sideEffects.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle) + .collect { sideEffect -> + when (sideEffect) { + is ProfileEditSideEffect.NavigateUp -> navigateUp() + } + } + } + if (state.showBottomSheet) { ProfileBottomSheet( onDismiss = { viewModel.updateBottomSheet(false) }, onSaveClick = { index -> viewModel.updateBottomSheet(false) viewModel.updateProfile(index) - viewModel.checkIsInfoChange(editName = state.name, editProfile = index) }, initialSelectedOption = state.profile ) } - LaunchedEffect(viewModel.sideEffects, lifecycleOwner) { - viewModel.sideEffects.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle) - .collect { sideEffect -> - when (sideEffect) { - is ProfileEditSideEffect.NavigateUp -> navigateUp() - } - } - } - ProfileEditScreen( profileEditState = state, onProfileEditClick = { isVisible -> @@ -88,13 +87,12 @@ fun ProfileEditRoute( }, onInputChange = { editName -> viewModel.updateName(editName) - viewModel.checkIsInfoChange(editName = editName, editProfile = state.profile) }, onSaveClick = { viewModel.navigateUp() }, name = state.name, onBackButtonClick = { viewModel.navigateUp() }, onValidationChanged = { isValid -> - if (state.isInfoChange) viewModel.updateButtonValidation(isValid) + viewModel.updateButtonValidation(isValid) } ) } @@ -156,7 +154,8 @@ fun ProfileEditScreen( hint = stringResource(id = R.string.sign_up_hint), onValidationChanged = { isValid -> onValidationChanged(isValid) - } + }, + initialView = profileEditState.initialView ) Spacer(modifier = modifier.height(48.dp)) Text( diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt index 47b3e7192..eb34b9548 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt @@ -4,8 +4,7 @@ data class ProfileEditState( val name: String = "", val initialName: String = "", val profile: Int = 0, - val initialProfile: Int = 0, - val isInfoChange: Boolean = false, + val initialView: Boolean = true, val isButtonValid: Boolean = false, val authType: String = "", val showBottomSheet: Boolean = false diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt index c0f821d19..58bf6349f 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt @@ -21,39 +21,30 @@ class ProfileEditViewModel @Inject constructor() : ViewModel() { private val _sideEffects = MutableSharedFlow() val sideEffects: SharedFlow get() = _sideEffects.asSharedFlow() - fun updateButtonValidation(isValid: Boolean) { - _state.value = _state.value.copy(isButtonValid = isValid) - } - fun navigateUp() = viewModelScope.launch { _sideEffects.emit(ProfileEditSideEffect.NavigateUp) } fun updateBottomSheet(isVisible: Boolean) { _state.value = _state.value.copy(showBottomSheet = isVisible) } - fun updateName(name: String) { - _state.value = _state.value.copy(name = name) - } - - fun updateProfile(profile: Int) { - _state.value = _state.value.copy(profile = profile) - } - fun updateInitialInfo(initialName: String, initialProfile: Int) { _state.value = _state.value.copy( name = initialName, initialName = initialName, profile = initialProfile, - initialProfile = initialProfile ) } - fun checkIsInfoChange(editName: String, editProfile: Int) { - val isInfoChanged = editName != _state.value.initialName || editProfile != _state.value.initialProfile - _state.value = _state.value.copy( - isInfoChange = isInfoChanged, - isButtonValid = isInfoChanged && _state.value.isButtonValid - ) + fun updateName(name: String) { + _state.value = _state.value.copy(name = name, initialView = false) + } + + fun updateProfile(profile: Int) { + _state.value = _state.value.copy(profile = profile, initialView = false) + } + + fun updateButtonValidation(isValid: Boolean) { + _state.value = _state.value.copy(isButtonValid = isValid) } } \ No newline at end of file From d0ac79a1b14f81c3bf6035fa96f82f424c755d28 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 4 Sep 2024 15:50:44 +0900 Subject: [PATCH 50/62] =?UTF-8?q?[FEAT/#206]=20=EC=88=98=EC=A0=95=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/textfield/NameTextField.kt | 13 +++++++------ .../textfield/TerningBasicTextField.kt | 18 ++++++++---------- .../res/drawable/ic_name_text_field_check.xml | 18 ++++++++++++++++++ .../res/drawable/ic_name_text_field_error.xml | 18 ++++++++++++++++++ core/src/main/res/values/strings.xml | 1 + 5 files changed, 52 insertions(+), 16 deletions(-) create mode 100644 core/src/main/res/drawable/ic_name_text_field_check.xml create mode 100644 core/src/main/res/drawable/ic_name_text_field_error.xml diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt index 04d33a4a1..dfa48f52a 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt @@ -16,14 +16,15 @@ import com.terning.core.designsystem.theme.Grey500 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningTheme import com.terning.core.designsystem.theme.WarningRed +import com.terning.core.designsystem.theme.White import com.terning.core.util.NAME_ERROR_REGEX data class NameFieldState( val name: String, val lineColor: Color, - val helperMessage: Int?, + val helperMessage: Int, val helperIcon: Int?, - val helperColor: Color?, + val helperColor: Color, val isValid: Boolean ) @@ -54,9 +55,9 @@ fun NameTextField( NameFieldState( name = trimmedName, lineColor = Grey500, - helperMessage = null, - helperIcon = null, - helperColor = null, + helperMessage = R.string.sign_up_helper, + helperIcon = R.drawable.ic_name_text_field_check, + helperColor = White, isValid = false ) } @@ -120,7 +121,7 @@ fun NameTextField( hintColor = Grey300, showTextLength = true, maxTextLength = MAX_LENGTH, - helperMessage = state.helperMessage?.let { stringResource(id = it) }, + helperMessage = stringResource(id = state.helperMessage), helperIcon = state.helperIcon, helperColor = state.helperColor, imeAction = ImeAction.Done, diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt index 855897161..0e8bd9667 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/TerningBasicTextField.kt @@ -41,6 +41,7 @@ fun TerningBasicTextField( hintColor: Color, drawLineColor: Color, cursorBrush: Brush, + helperColor: Color, strokeWidth: Float = 1f, leftIcon: Int? = null, leftIconColor: Color = TerningMain, @@ -48,10 +49,9 @@ fun TerningBasicTextField( maxTextLength: Int? = null, showTextLength: Boolean = false, hint: String = "", - helperMessage: String? = "", + helperMessage: String = "", helperIcon: Int? = null, enabled: Boolean = true, - helperColor: Color? = null, readOnly: Boolean = false, onDoneAction: () -> Unit? = {}, onSearchAction: () -> Unit? = {}, @@ -137,19 +137,17 @@ fun TerningBasicTextField( horizontalArrangement = Arrangement.spacedBy(4.dp), modifier = modifier.padding(top = 5.dp) ) { - if (helperIcon != null && helperColor != null) { + helperIcon?.let { Icon( painter = painterResource(id = helperIcon), contentDescription = null, tint = helperColor, ) } - if (helperMessage != null && helperColor != null) { - Text( - text = helperMessage, - style = TerningTheme.typography.detail3, - color = helperColor, - ) - } + Text( + text = helperMessage, + style = TerningTheme.typography.detail3, + color = helperColor, + ) } } \ No newline at end of file diff --git a/core/src/main/res/drawable/ic_name_text_field_check.xml b/core/src/main/res/drawable/ic_name_text_field_check.xml new file mode 100644 index 000000000..6c2547e9d --- /dev/null +++ b/core/src/main/res/drawable/ic_name_text_field_check.xml @@ -0,0 +1,18 @@ + + + + \ No newline at end of file diff --git a/core/src/main/res/drawable/ic_name_text_field_error.xml b/core/src/main/res/drawable/ic_name_text_field_error.xml new file mode 100644 index 000000000..04eb2ddbe --- /dev/null +++ b/core/src/main/res/drawable/ic_name_text_field_error.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index f88829a70..a8a7b28f4 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -66,4 +66,5 @@ 이름에 특수문자는 입력할 수 없어요 사용 가능한 이름이에요 이름은 12자리 이내로 설정해 주세요 + \ No newline at end of file From 862ce989ae7a4f1f4184e829d1b195f6aa4f4aea Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 4 Sep 2024 17:05:42 +0900 Subject: [PATCH 51/62] =?UTF-8?q?[FEAT/#206]=20=EC=8A=A4=ED=94=8C=EB=9E=98?= =?UTF-8?q?=EC=89=AC=20modifier=20=EC=9C=84=EC=B9=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/terning/feature/onboarding/splash/SplashRoute.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/src/main/java/com/terning/feature/onboarding/splash/SplashRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/splash/SplashRoute.kt index 3de111c73..511f07109 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/splash/SplashRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/splash/SplashRoute.kt @@ -60,8 +60,8 @@ fun SplashRoute( @Composable fun SplashScreen( - paddingValues: PaddingValues = PaddingValues(), modifier: Modifier = Modifier, + paddingValues: PaddingValues = PaddingValues(), ) { Column( modifier = modifier From 44af5c0528daa236567c6b56735f00f075977318 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Wed, 4 Sep 2024 17:06:43 +0900 Subject: [PATCH 52/62] =?UTF-8?q?[FEAT/#206]=20=EC=8A=A4=ED=94=8C=EB=9E=98?= =?UTF-8?q?=EC=89=AC=20modifier=20=EC=9C=84=EC=B9=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/onboarding/splash/SplashRoute.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/onboarding/splash/SplashRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/splash/SplashRoute.kt index 511f07109..ba79374e2 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/splash/SplashRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/splash/SplashRoute.kt @@ -1,5 +1,6 @@ package com.terning.feature.onboarding.splash +import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues @@ -9,12 +10,12 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.SideEffect import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource import androidx.compose.ui.tooling.preview.Preview import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.flowWithLifecycle import com.google.accompanist.systemuicontroller.rememberSystemUiController -import com.terning.core.designsystem.component.image.TerningImage import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.feature.R @@ -60,18 +61,18 @@ fun SplashRoute( @Composable fun SplashScreen( - modifier: Modifier = Modifier, paddingValues: PaddingValues = PaddingValues(), ) { Column( - modifier = modifier + modifier = Modifier .padding(paddingValues) .fillMaxSize() .background(TerningMain), ) { - TerningImage( - painter = R.drawable.ic_splash, - modifier = Modifier.fillMaxSize() + Image( + painter = painterResource(id = R.drawable.ic_splash), + modifier = Modifier.fillMaxSize(), + contentDescription = "splash screen" ) } } From 32cf97da8491d4d663ae0f0ecd8f359116d0ab33 Mon Sep 17 00:00:00 2001 From: arinming Date: Wed, 4 Sep 2024 22:22:55 +0900 Subject: [PATCH 53/62] =?UTF-8?q?[FEAT/#191]=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0=20=EA=B8=B0=EB=B0=98=202=EC=B0=A8=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 --- .../feature/intern/component/InternCompanyInfo.kt | 3 --- .../terning/feature/intern/component/InternTitle.kt | 13 +++++-------- .../{ic_view_14.xml => ic_view_count_14.xml} | 0 3 files changed, 5 insertions(+), 11 deletions(-) rename feature/src/main/res/drawable/{ic_view_14.xml => ic_view_count_14.xml} (100%) diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt b/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt index aa2ce345f..7dc5ec55b 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt @@ -70,9 +70,6 @@ fun InternCompanyInfo( Alignment.Bottom ), horizontalAlignment = Alignment.CenterHorizontally, - modifier = modifier - .padding( - ) ) { Text( text = company, diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternTitle.kt b/feature/src/main/java/com/terning/feature/intern/component/InternTitle.kt index 1432f41ee..0d6a34e7c 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternTitle.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternTitle.kt @@ -30,19 +30,16 @@ fun InternTitle( viewCount: String, ) { Column( - modifier = Modifier + modifier = modifier .fillMaxWidth(), ) { Row( - modifier = modifier + modifier = Modifier .background( color = TerningSub3, shape = RoundedCornerShape(size = 5.dp) ), - horizontalArrangement = Arrangement.spacedBy( - 0.dp, - Alignment.CenterHorizontally - ), + horizontalArrangement = Arrangement.Center, verticalAlignment = Alignment.CenterVertically ) { Text( @@ -69,11 +66,11 @@ fun InternTitle( Row( horizontalArrangement = Arrangement.spacedBy(3.dp, Alignment.Start), verticalAlignment = Alignment.CenterVertically, - modifier = modifier + modifier = Modifier .fillMaxWidth() ) { TerningImage( - painter = R.drawable.ic_view_14 + painter = R.drawable.ic_view_count_14 ) Text( text = stringResource(id = R.string.intern_view_count_detail, viewCount), diff --git a/feature/src/main/res/drawable/ic_view_14.xml b/feature/src/main/res/drawable/ic_view_count_14.xml similarity index 100% rename from feature/src/main/res/drawable/ic_view_14.xml rename to feature/src/main/res/drawable/ic_view_count_14.xml From d93e0ec9d8925697f43fb3ad28e457dfec0fd640 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 5 Sep 2024 00:05:54 +0900 Subject: [PATCH 54/62] [FEAT/#206] pull from develop --- .../com/terning/feature/mypage/profileedit/ProfileEditRoute.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index 1b51a7430..99e7a8187 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -158,6 +158,7 @@ fun ProfileEditScreen( initialView = profileEditState.initialView ) Spacer(modifier = modifier.height(48.dp)) + Text( text = stringResource(id = R.string.profile_edit_auth_type), style = TerningTheme.typography.body2, From 2c3ac87ec494254151b24d2ace28bc8bcbea9f92 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 5 Sep 2024 02:32:58 +0900 Subject: [PATCH 55/62] =?UTF-8?q?[FEAT/#206]=20paddingValues=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../filtering/filtering/FilteringOneScreen.kt | 6 +++ .../filtering/FilteringThreeRoute.kt | 10 +++- .../filtering/filtering/FilteringTwoScreen.kt | 6 +++ .../navigation/FilteringOneNavigation.kt | 3 ++ .../navigation/FilteringThreeNavigation.kt | 3 ++ .../navigation/FilteringTwoNavigation.kt | 3 ++ .../startfiltering/StartFilteringScreen.kt | 9 +++- .../navigation/StartFilteringNavigation.kt | 3 ++ .../filtering/starthome/StartHomeScreen.kt | 18 ++++---- .../navigation/StartHomeNavigation.kt | 20 ++++---- .../com/terning/feature/main/MainScreen.kt | 46 +++++++++++++------ .../feature/onboarding/signin/SignInRoute.kt | 24 ++++++---- .../signin/navigation/SignInNavigation.kt | 3 ++ .../feature/onboarding/signup/SignUpRoute.kt | 34 ++++++++------ .../signup/navigation/SignUpNavigation.kt | 3 ++ 15 files changed, 134 insertions(+), 57 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringOneScreen.kt b/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringOneScreen.kt index 3f4a28c8c..17ba94a8c 100644 --- a/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringOneScreen.kt +++ b/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringOneScreen.kt @@ -1,6 +1,8 @@ package com.terning.feature.filtering.filtering +import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding @@ -21,6 +23,7 @@ import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.designsystem.theme.White import com.terning.feature.R import com.terning.feature.filtering.filtering.component.StatusOneRadioGroup @@ -30,6 +33,7 @@ fun FilteringOneScreen( onNextClick: (Int) -> Unit, navigateUp: () -> Unit, modifier: Modifier = Modifier, + paddingValues: PaddingValues = PaddingValues(), onButtonClick: (Int) -> Unit = {}, ) { val isButtonValid = remember { mutableStateOf(false) } @@ -38,6 +42,8 @@ fun FilteringOneScreen( Column( modifier = modifier + .padding(paddingValues) + .background(White) ) { BackButtonTopAppBar( onBackButtonClick = { navigateUp() } diff --git a/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringThreeRoute.kt b/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringThreeRoute.kt index b51640a80..3eb6a89db 100644 --- a/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringThreeRoute.kt +++ b/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringThreeRoute.kt @@ -1,6 +1,8 @@ package com.terning.feature.filtering.filtering +import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding @@ -26,6 +28,7 @@ import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.designsystem.theme.White import com.terning.core.extension.toast import com.terning.feature.R import java.util.Calendar @@ -37,6 +40,7 @@ fun FilteringThreeRoute( navigateUp: () -> Unit, navigateToStartHome: () -> Unit, viewModel: FilteringViewModel = hiltViewModel(), + paddingValues: PaddingValues ) { val context = LocalContext.current val lifecycleOwner = LocalLifecycleOwner.current @@ -68,6 +72,7 @@ fun FilteringThreeRoute( } FilteringThreeScreen( + paddingValues = paddingValues, navigateUp = { navigateUp() }, chosenYear = chosenYear, chosenMonth = chosenMonth, @@ -80,6 +85,7 @@ fun FilteringThreeRoute( @Composable fun FilteringThreeScreen( modifier: Modifier = Modifier, + paddingValues: PaddingValues = PaddingValues(), navigateUp: () -> Unit, chosenYear: Int, chosenMonth: Int, @@ -88,7 +94,9 @@ fun FilteringThreeScreen( onNextClick: () -> Unit, ) { Column( - modifier = modifier, + modifier = modifier + .padding(paddingValues) + .background(White), ) { BackButtonTopAppBar( onBackButtonClick = { navigateUp() } diff --git a/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringTwoScreen.kt b/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringTwoScreen.kt index e66df12e8..c35eec330 100644 --- a/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringTwoScreen.kt +++ b/feature/src/main/java/com/terning/feature/filtering/filtering/FilteringTwoScreen.kt @@ -1,6 +1,8 @@ package com.terning.feature.filtering.filtering +import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding @@ -21,6 +23,7 @@ import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar import com.terning.core.designsystem.theme.Grey300 import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.designsystem.theme.White import com.terning.feature.R import com.terning.feature.filtering.filtering.component.StatusTwoRadioGroup @@ -30,6 +33,7 @@ fun FilteringTwoScreen( onNextClick: (Int, Int) -> Unit, navigateUp: () -> Unit, modifier: Modifier = Modifier, + paddingValues: PaddingValues = PaddingValues(), onButtonClick: (Int) -> Unit = {}, ) { val isButtonValid = remember { mutableStateOf(false) } @@ -38,6 +42,8 @@ fun FilteringTwoScreen( Column( modifier = modifier + .padding(paddingValues) + .background(White) ) { BackButtonTopAppBar( onBackButtonClick = { navigateUp() } diff --git a/feature/src/main/java/com/terning/feature/filtering/filtering/navigation/FilteringOneNavigation.kt b/feature/src/main/java/com/terning/feature/filtering/filtering/navigation/FilteringOneNavigation.kt index 266137688..3ac282c44 100644 --- a/feature/src/main/java/com/terning/feature/filtering/filtering/navigation/FilteringOneNavigation.kt +++ b/feature/src/main/java/com/terning/feature/filtering/filtering/navigation/FilteringOneNavigation.kt @@ -1,5 +1,6 @@ package com.terning.feature.filtering.filtering.navigation +import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController @@ -21,11 +22,13 @@ fun NavController.navigateFilteringOne( } fun NavGraphBuilder.filteringOneNavGraph( + paddingValues: PaddingValues, navHostController: NavHostController ) { composable { val args = it.toRoute() FilteringOneScreen( + paddingValues = paddingValues, name = args.name, onNextClick = { grade -> navHostController.navigateFilteringTwo(grade) }, navigateUp = { navHostController.navigateUp() } diff --git a/feature/src/main/java/com/terning/feature/filtering/filtering/navigation/FilteringThreeNavigation.kt b/feature/src/main/java/com/terning/feature/filtering/filtering/navigation/FilteringThreeNavigation.kt index 759c65c4d..97f95beae 100644 --- a/feature/src/main/java/com/terning/feature/filtering/filtering/navigation/FilteringThreeNavigation.kt +++ b/feature/src/main/java/com/terning/feature/filtering/filtering/navigation/FilteringThreeNavigation.kt @@ -1,5 +1,6 @@ package com.terning.feature.filtering.filtering.navigation +import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController @@ -23,11 +24,13 @@ fun NavController.navigateFilteringThree( } fun NavGraphBuilder.filteringThreeNavGraph( + paddingValues: PaddingValues, navHostController: NavHostController ) { composable { val args = it.toRoute() FilteringThreeRoute( + paddingValues = paddingValues, grade = args.grade, workingPeriod = args.workingPeriod, navigateUp = { navHostController.navigateUp() }, diff --git a/feature/src/main/java/com/terning/feature/filtering/filtering/navigation/FilteringTwoNavigation.kt b/feature/src/main/java/com/terning/feature/filtering/filtering/navigation/FilteringTwoNavigation.kt index 0bde2ac5e..ff9f1286d 100644 --- a/feature/src/main/java/com/terning/feature/filtering/filtering/navigation/FilteringTwoNavigation.kt +++ b/feature/src/main/java/com/terning/feature/filtering/filtering/navigation/FilteringTwoNavigation.kt @@ -1,5 +1,6 @@ package com.terning.feature.filtering.filtering.navigation +import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController @@ -21,11 +22,13 @@ fun NavController.navigateFilteringTwo( } fun NavGraphBuilder.filteringTwoNavGraph( + paddingValues: PaddingValues, navHostController: NavHostController ) { composable { val args = it.toRoute() FilteringTwoScreen( + paddingValues = paddingValues, grade = args.grade, onNextClick = { _, workingPeriod -> navHostController.navigateFilteringThree( diff --git a/feature/src/main/java/com/terning/feature/filtering/startfiltering/StartFilteringScreen.kt b/feature/src/main/java/com/terning/feature/filtering/startfiltering/StartFilteringScreen.kt index e8e1128b2..2429947ce 100644 --- a/feature/src/main/java/com/terning/feature/filtering/startfiltering/StartFilteringScreen.kt +++ b/feature/src/main/java/com/terning/feature/filtering/startfiltering/StartFilteringScreen.kt @@ -2,8 +2,10 @@ package com.terning.feature.filtering.startfiltering import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.fadeIn +import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -27,12 +29,14 @@ import com.terning.core.designsystem.component.button.RectangleButton import com.terning.core.designsystem.component.image.TerningImage import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.designsystem.theme.White import com.terning.feature.R import kotlinx.coroutines.delay @Composable fun StartFilteringScreen( modifier: Modifier = Modifier, + paddingValues: PaddingValues = PaddingValues(), onNextClick: () -> Unit ) { var isVisible by remember { mutableStateOf(false) } @@ -46,7 +50,10 @@ fun StartFilteringScreen( } Box( - modifier = modifier.fillMaxSize() + modifier = modifier + .fillMaxSize() + .padding(paddingValues) + .background(White) ) { Column( modifier = Modifier.fillMaxSize(), diff --git a/feature/src/main/java/com/terning/feature/filtering/startfiltering/navigation/StartFilteringNavigation.kt b/feature/src/main/java/com/terning/feature/filtering/startfiltering/navigation/StartFilteringNavigation.kt index e70d98afa..17280736b 100644 --- a/feature/src/main/java/com/terning/feature/filtering/startfiltering/navigation/StartFilteringNavigation.kt +++ b/feature/src/main/java/com/terning/feature/filtering/startfiltering/navigation/StartFilteringNavigation.kt @@ -1,5 +1,6 @@ package com.terning.feature.filtering.startfiltering.navigation +import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController @@ -22,11 +23,13 @@ fun NavController.navigateStartFiltering( } fun NavGraphBuilder.startFilteringNavGraph( + paddingValues: PaddingValues, navHostController: NavHostController ) { composable { val args = it.toRoute() StartFilteringScreen( + paddingValues = paddingValues, onNextClick = { navHostController.navigateFilteringOne(args.name) } diff --git a/feature/src/main/java/com/terning/feature/filtering/starthome/StartHomeScreen.kt b/feature/src/main/java/com/terning/feature/filtering/starthome/StartHomeScreen.kt index 63b92593f..29cdba837 100644 --- a/feature/src/main/java/com/terning/feature/filtering/starthome/StartHomeScreen.kt +++ b/feature/src/main/java/com/terning/feature/filtering/starthome/StartHomeScreen.kt @@ -2,8 +2,10 @@ package com.terning.feature.filtering.starthome import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.fadeIn +import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxSize @@ -24,9 +26,6 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import androidx.navigation.NavController -import androidx.navigation.NavOptions -import androidx.navigation.compose.rememberNavController import com.airbnb.lottie.compose.LottieAnimation import com.airbnb.lottie.compose.LottieCompositionSpec import com.airbnb.lottie.compose.LottieConstants @@ -34,16 +33,14 @@ import com.airbnb.lottie.compose.rememberLottieComposition import com.terning.core.designsystem.component.button.RectangleButton import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.designsystem.theme.White import com.terning.feature.R -import com.terning.feature.home.home.navigation.navigateHome -import com.terning.feature.main.MainNavigator -import com.terning.feature.main.rememberMainNavigator -import com.terning.feature.onboarding.signin.navigation.SignIn import kotlinx.coroutines.delay @Composable fun StartHomeScreen( modifier: Modifier = Modifier, + paddingValues: PaddingValues = PaddingValues(), navigateToHome: () -> Unit ) { var isVisible by remember { mutableStateOf(false) } @@ -57,7 +54,10 @@ fun StartHomeScreen( } Box( - modifier = modifier.fillMaxSize() + modifier = modifier + .fillMaxSize() + .padding(paddingValues) + .background(White) ) { Column( modifier = Modifier.fillMaxSize(), @@ -95,7 +95,7 @@ fun StartHomeScreen( } } -private const val DELAY : Long = 1000 +private const val DELAY: Long = 1000 @Composable fun StartHomeLottieAnimation( diff --git a/feature/src/main/java/com/terning/feature/filtering/starthome/navigation/StartHomeNavigation.kt b/feature/src/main/java/com/terning/feature/filtering/starthome/navigation/StartHomeNavigation.kt index ed29bcf97..ef2297130 100644 --- a/feature/src/main/java/com/terning/feature/filtering/starthome/navigation/StartHomeNavigation.kt +++ b/feature/src/main/java/com/terning/feature/filtering/starthome/navigation/StartHomeNavigation.kt @@ -2,6 +2,7 @@ package com.terning.feature.filtering.starthome.navigation import androidx.compose.animation.EnterTransition import androidx.compose.animation.ExitTransition +import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController @@ -21,6 +22,7 @@ fun NavController.navigateStartHome(navOptions: NavOptions? = null) { } fun NavGraphBuilder.startHomeNavGraph( + paddingValues: PaddingValues, navHostController: NavHostController ) { composable( @@ -37,14 +39,16 @@ fun NavGraphBuilder.startHomeNavGraph( ExitTransition.None } ) { - StartHomeScreen(navigateToHome = { - navHostController.navigateHome( - navOptions = NavOptions.Builder().setPopUpTo( - route = SignIn, - inclusive = true - ).build() - ) - } + StartHomeScreen( + paddingValues = paddingValues, + navigateToHome = { + navHostController.navigateHome( + navOptions = NavOptions.Builder().setPopUpTo( + route = SignIn, + inclusive = true + ).build() + ) + } ) } } diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index ca90e4a54..d78934eba 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -9,7 +9,6 @@ import androidx.compose.animation.slideIn import androidx.compose.animation.slideOut import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.padding import androidx.compose.material3.Icon import androidx.compose.material3.NavigationBar import androidx.compose.material3.NavigationBarItem @@ -56,7 +55,7 @@ fun MainScreen( onTabSelected = navigator::navigate ) }, - ) { innerPadding -> + ) { paddingValues -> Column( modifier = Modifier.fillMaxSize() ) { @@ -77,29 +76,50 @@ fun MainScreen( startDestination = navigator.startDestination ) { splashNavGraph( - paddingValues = innerPadding, + paddingValues = paddingValues, navHostController = navigator.navController ) homeNavGraph( - paddingValues = innerPadding, + paddingValues = paddingValues, navHostController = navigator.navController ) calendarNavGraph(navHostController = navigator.navController) searchNavGraph(navHostController = navigator.navController) - myPageNavGraph( - paddingValues = innerPadding, + signInNavGraph( + paddingValues = paddingValues, + navHostController = navigator.navController + ) + signUpNavGraph( + paddingValues = paddingValues, + navHostController = navigator.navController + ) + startFilteringNavGraph( + paddingValues = paddingValues, + navHostController = navigator.navController + ) + startHomeNavGraph( + paddingValues = paddingValues, + navHostController = navigator.navController + ) + filteringOneNavGraph( + paddingValues = paddingValues, + navHostController = navigator.navController + ) + filteringTwoNavGraph( + paddingValues = paddingValues, + navHostController = navigator.navController + ) + filteringThreeNavGraph( + paddingValues = paddingValues, navHostController = navigator.navController ) - signInNavGraph(navHostController = navigator.navController) - signUpNavGraph(navHostController = navigator.navController) - filteringOneNavGraph(navHostController = navigator.navController) - filteringTwoNavGraph(navHostController = navigator.navController) - filteringThreeNavGraph(navHostController = navigator.navController) searchProcessNavGraph(navHostController = navigator.navController) changeFilterNavGraph(navHostController = navigator.navController) - startFilteringNavGraph(navHostController = navigator.navController) - startHomeNavGraph(navHostController = navigator.navController) internNavGraph(navHostController = navigator.navController) + myPageNavGraph( + paddingValues = paddingValues, + navHostController = navigator.navController + ) profileEditNavGraph(navHostController = navigator.navController) } } diff --git a/feature/src/main/java/com/terning/feature/onboarding/signin/SignInRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signin/SignInRoute.kt index 43b79c8c6..9b946f9f5 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signin/SignInRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signin/SignInRoute.kt @@ -3,6 +3,7 @@ package com.terning.feature.onboarding.signin import android.content.Context import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -31,6 +32,7 @@ import com.terning.feature.onboarding.signin.component.KakaoButton @Composable fun SignInRoute( + paddingValues: PaddingValues, navigateToHome: () -> Unit, navigateToSignUp: (String) -> Unit, viewModel: SignInViewModel = hiltViewModel(), @@ -79,6 +81,7 @@ fun SignInRoute( } SignInScreen( + paddingValues = paddingValues, onSignInClick = { viewModel.startKakaoLogIn( isKakaoAvailable = UserApiClient.instance.isKakaoTalkLoginAvailable( @@ -91,29 +94,28 @@ fun SignInRoute( @Composable fun SignInScreen( - modifier: Modifier = Modifier, - onSignInClick: () -> Unit = {}, + onSignInClick: () -> Unit, + paddingValues: PaddingValues = PaddingValues(), ) { Column( - modifier = modifier + modifier = Modifier .fillMaxSize() .background(color = White) + .padding(paddingValues) .padding(horizontal = 20.dp), horizontalAlignment = Alignment.CenterHorizontally ) { - Spacer(modifier = modifier.weight(1f)) + Spacer(modifier = Modifier.weight(1f)) TerningImage( painter = R.drawable.ic_terning_login, modifier = Modifier.fillMaxWidth() ) - Spacer(modifier = modifier.weight(1f)) + Spacer(modifier = Modifier.weight(1f)) KakaoButton( title = stringResource(id = R.string.sign_in_kakao_button), - onSignInClick = { - onSignInClick() - } + onSignInClick = onSignInClick ) - Spacer(modifier = modifier.weight(1f)) + Spacer(modifier = Modifier.weight(1f)) } } @@ -154,6 +156,8 @@ private const val KAKAO_NOT_LOGGED_IN = "statusCode=302" @Composable fun SignInScreenPreview() { TerningPointTheme { - SignInScreen() + SignInScreen( + onSignInClick = {} + ) } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/onboarding/signin/navigation/SignInNavigation.kt b/feature/src/main/java/com/terning/feature/onboarding/signin/navigation/SignInNavigation.kt index f9ee42532..49f367ab3 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signin/navigation/SignInNavigation.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signin/navigation/SignInNavigation.kt @@ -1,5 +1,6 @@ package com.terning.feature.onboarding.signin.navigation +import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController @@ -19,10 +20,12 @@ fun NavController.navigateSignIn(navOptions: NavOptions? = null) { } fun NavGraphBuilder.signInNavGraph( + paddingValues: PaddingValues, navHostController: NavHostController, ) { composable { SignInRoute( + paddingValues = paddingValues, navigateToHome = { navHostController.navigateHome() }, navigateToSignUp = { authId -> navHostController.navigateSignUp(authId) } ) diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt index e8d9c0f6d..9a963fe57 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/SignUpRoute.kt @@ -1,6 +1,7 @@ package com.terning.feature.onboarding.signup import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.height @@ -34,6 +35,7 @@ import com.terning.feature.R @Composable fun SignUpRoute( + paddingValues: PaddingValues, authId: String, navigateToStartFiltering: (String) -> Unit, viewModel: SignUpViewModel = hiltViewModel(), @@ -70,6 +72,7 @@ fun SignUpRoute( } SignUpScreen( + paddingValues = paddingValues, state = state, onSignUpClick = { viewModel.postSignUpWithServer() @@ -92,48 +95,49 @@ fun SignUpScreen( onSignUpClick: () -> Unit, onInputChange: (String) -> Unit, onProfileEditClick: (Boolean) -> Unit, - modifier: Modifier = Modifier, - onValidationChanged: (Boolean) -> Unit + onValidationChanged: (Boolean) -> Unit, + paddingValues: PaddingValues = PaddingValues(), ) { val focusManager = LocalFocusManager.current Column( - modifier = modifier + modifier = Modifier .fillMaxSize() .addFocusCleaner(focusManager) + .padding(paddingValues) ) { - Spacer(modifier = modifier.height(56.dp)) + Spacer(modifier = Modifier.height(56.dp)) Text( text = stringResource(id = R.string.sign_up_title), style = TerningTheme.typography.heading2, - modifier = modifier.padding(start = 24.dp) + modifier = Modifier.padding(start = 24.dp) ) - Spacer(modifier = modifier.height(36.dp)) + Spacer(modifier = Modifier.height(36.dp)) Text( text = stringResource(id = R.string.sign_up_profile_image), style = TerningTheme.typography.body2, - modifier = modifier.padding(start = 24.dp), + modifier = Modifier.padding(start = 24.dp), color = Grey500 ) - Spacer(modifier = modifier.height(20.dp)) + Spacer(modifier = Modifier.height(20.dp)) Column( - modifier = modifier.align(Alignment.CenterHorizontally) + modifier = Modifier.align(Alignment.CenterHorizontally) ) { - Spacer(modifier = modifier.height(48.dp)) + Spacer(modifier = Modifier.height(48.dp)) ProfileWithPlusButton( - modifier = modifier.noRippleClickable { + modifier = Modifier.noRippleClickable { onProfileEditClick(true) }, index = state.profileImage ) } Column( - modifier = modifier + modifier = Modifier .align(Alignment.CenterHorizontally) .padding(horizontal = 24.dp) ) { Text(text = stringResource(id = R.string.sign_up_name)) - Spacer(modifier = modifier.height(20.dp)) + Spacer(modifier = Modifier.height(20.dp)) NameTextField( value = state.name, onValueChange = { name -> @@ -143,13 +147,13 @@ fun SignUpScreen( onValidationChanged = { isValid -> onValidationChanged(isValid) } ) } - Spacer(modifier = modifier.weight(1f)) + Spacer(modifier = Modifier.weight(1f)) RectangleButton( style = TerningTheme.typography.button1, paddingVertical = 20.dp, text = R.string.sign_up_next_button, onButtonClick = { onSignUpClick() }, - modifier = modifier.padding(bottom = 12.dp), + modifier = Modifier.padding(bottom = 12.dp), isEnabled = state.isButtonValid ) } diff --git a/feature/src/main/java/com/terning/feature/onboarding/signup/navigation/SignUpNavigation.kt b/feature/src/main/java/com/terning/feature/onboarding/signup/navigation/SignUpNavigation.kt index 20ba7bf6f..34308cc81 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/signup/navigation/SignUpNavigation.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/signup/navigation/SignUpNavigation.kt @@ -1,5 +1,6 @@ package com.terning.feature.onboarding.signup.navigation +import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController @@ -22,11 +23,13 @@ fun NavController.navigateSignUp( } fun NavGraphBuilder.signUpNavGraph( + paddingValues: PaddingValues, navHostController: NavHostController ) { composable { val args = it.toRoute() SignUpRoute( + paddingValues = paddingValues, authId = args.authId, navigateToStartFiltering = { name -> navHostController.navigateFilteringOne(name) } ) From 197b16f7fe54ab6fd62d2598c46653c99d832b84 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 5 Sep 2024 02:34:56 +0900 Subject: [PATCH 56/62] =?UTF-8?q?[FEAT/#206]=20=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=EC=A0=84=ED=99=98=20=EB=A1=9C=EC=A7=81=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../navigation/StartHomeNavigation.kt | 17 +---------------- .../mypage/navigation/MyPageNavigation.kt | 11 +++++++---- .../splash/navigation/SplashNavigation.kt | 19 ++----------------- 3 files changed, 10 insertions(+), 37 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/filtering/starthome/navigation/StartHomeNavigation.kt b/feature/src/main/java/com/terning/feature/filtering/starthome/navigation/StartHomeNavigation.kt index ef2297130..9f493d51a 100644 --- a/feature/src/main/java/com/terning/feature/filtering/starthome/navigation/StartHomeNavigation.kt +++ b/feature/src/main/java/com/terning/feature/filtering/starthome/navigation/StartHomeNavigation.kt @@ -1,7 +1,5 @@ package com.terning.feature.filtering.starthome.navigation -import androidx.compose.animation.EnterTransition -import androidx.compose.animation.ExitTransition import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder @@ -25,20 +23,7 @@ fun NavGraphBuilder.startHomeNavGraph( paddingValues: PaddingValues, navHostController: NavHostController ) { - composable( - exitTransition = { - ExitTransition.None - }, - popEnterTransition = { - EnterTransition.None - }, - enterTransition = { - EnterTransition.None - }, - popExitTransition = { - ExitTransition.None - } - ) { + composable { StartHomeScreen( paddingValues = paddingValues, navigateToHome = { diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt index 1940effbd..7248c8a2a 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/navigation/MyPageNavigation.kt @@ -1,7 +1,5 @@ package com.terning.feature.mypage.mypage.navigation -import androidx.compose.animation.EnterTransition -import androidx.compose.animation.ExitTransition import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder @@ -24,10 +22,15 @@ fun NavGraphBuilder.myPageNavGraph( paddingValues: PaddingValues, navHostController: NavHostController, ) { - composable{ + composable { MyPageRoute( paddingValues = paddingValues, - navigateToProfileEdit = { name, profile -> navHostController.navigateProfileEdit(name, profile) } + navigateToProfileEdit = { name, profile -> + navHostController.navigateProfileEdit( + name, + profile + ) + } ) } } diff --git a/feature/src/main/java/com/terning/feature/onboarding/splash/navigation/SplashNavigation.kt b/feature/src/main/java/com/terning/feature/onboarding/splash/navigation/SplashNavigation.kt index 255acab86..37dfeca9c 100644 --- a/feature/src/main/java/com/terning/feature/onboarding/splash/navigation/SplashNavigation.kt +++ b/feature/src/main/java/com/terning/feature/onboarding/splash/navigation/SplashNavigation.kt @@ -1,7 +1,5 @@ package com.terning.feature.onboarding.splash.navigation -import androidx.compose.animation.EnterTransition -import androidx.compose.animation.ExitTransition import androidx.compose.foundation.layout.PaddingValues import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder @@ -22,23 +20,10 @@ fun NavController.navigateSplash(navOptions: NavOptions? = null) { } fun NavGraphBuilder.splashNavGraph( - paddingValues : PaddingValues, + paddingValues: PaddingValues, navHostController: NavHostController, ) { - composable( - popExitTransition = { - ExitTransition.None - }, - exitTransition = { - ExitTransition.None - }, - enterTransition = { - EnterTransition.None - }, - popEnterTransition = { - EnterTransition.None - } - ) { + composable { SplashRoute( paddingValues = paddingValues, navigateToHome = { From cf12689f2ab9a947859d85bee85e10a8725bdaba Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 5 Sep 2024 02:50:23 +0900 Subject: [PATCH 57/62] =?UTF-8?q?[FEAT/#206]=20=EB=A7=88=EC=9D=B4=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/mypage/mypage/MyPageRoute.kt | 44 +++++++++++-------- .../main/res/drawable/ic_my_page_notice.xml | 33 ++++++-------- .../main/res/drawable/ic_my_page_opinion.xml | 33 ++++++-------- .../main/res/drawable/ic_my_page_personal.xml | 27 ++++++++++++ .../main/res/drawable/ic_my_page_service.xml | 24 ++++++++++ .../main/res/drawable/ic_my_page_version.xml | 41 ++++++----------- feature/src/main/res/values/strings.xml | 6 +-- 7 files changed, 122 insertions(+), 86 deletions(-) create mode 100644 feature/src/main/res/drawable/ic_my_page_personal.xml create mode 100644 feature/src/main/res/drawable/ic_my_page_service.xml diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt index 3cd54e59a..7207198ed 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt @@ -107,11 +107,13 @@ fun MyPageRoute( is UiState.Success -> { MyPageScreen( paddingValues = paddingValues, + onEditClick = { viewModel.navigateToProfileEdit() }, onLogoutClick = { viewModel.fetchShowLogoutBottomSheet(true) }, onQuitClick = { viewModel.fetchShowQuitBottomSheet(true) }, onNoticeClick = { viewModel.fetchShowNotice(true) }, onOpinionClick = { viewModel.fetchShowOpinion(true) }, - onEditClick = { viewModel.navigateToProfileEdit() }, + onServiceClick = {}, + onPersonalClick = {}, name = state.name, profile = state.profile ) @@ -135,11 +137,13 @@ fun MyPageRoute( @Composable fun MyPageScreen( + onEditClick: () -> Unit, onLogoutClick: () -> Unit, onQuitClick: () -> Unit, onNoticeClick: () -> Unit, onOpinionClick: () -> Unit, - onEditClick: () -> Unit, + onServiceClick: () -> Unit, + onPersonalClick: () -> Unit, modifier: Modifier = Modifier, paddingValues: PaddingValues = PaddingValues(), name: String = "", @@ -161,8 +165,8 @@ fun MyPageScreen( onOpinionClick = onOpinionClick ) ServiceInfo( - onNoticeClick = onNoticeClick, - onOpinionClick = onOpinionClick + onServiceClick = onServiceClick, + onPersonalClick = onPersonalClick ) Row( modifier = Modifier @@ -226,10 +230,12 @@ fun UserProfile( bottom = 7.dp ) ) - Row(verticalAlignment = Alignment.CenterVertically, + Row( + verticalAlignment = Alignment.CenterVertically, modifier = Modifier.noRippleClickable { onEditClick() - }) { + } + ) { Text( text = stringResource(id = R.string.my_page_edit_profile), modifier = Modifier.padding(start = 16.dp, end = 7.dp), @@ -278,9 +284,9 @@ fun TerningCommunity( modifier = Modifier.padding(bottom = 20.dp) ) MyPageItem( - text = stringResource(id = R.string.my_page_information), + text = stringResource(id = R.string.my_page_notice), icon = R.drawable.ic_my_page_notice, - onButtonClick = { onNoticeClick() } + onButtonClick = onNoticeClick ) HorizontalDivider( modifier = Modifier @@ -291,7 +297,7 @@ fun TerningCommunity( MyPageItem( text = stringResource(id = R.string.my_page_opinion), icon = R.drawable.ic_my_page_opinion, - onButtonClick = { onOpinionClick() } + onButtonClick = onOpinionClick ) } } @@ -300,8 +306,8 @@ fun TerningCommunity( @Composable fun ServiceInfo( modifier: Modifier = Modifier, - onNoticeClick: () -> Unit, - onOpinionClick: () -> Unit + onServiceClick: () -> Unit, + onPersonalClick: () -> Unit ) { Column( modifier = modifier @@ -332,9 +338,9 @@ fun ServiceInfo( modifier = Modifier.padding(bottom = 20.dp) ) MyPageItem( - text = stringResource(id = R.string.my_page_notice), - icon = R.drawable.ic_my_page_notice, - onButtonClick = { onNoticeClick() } + text = stringResource(id = R.string.my_page_service), + icon = R.drawable.ic_my_page_service, + onButtonClick = onServiceClick ) HorizontalDivider( modifier = Modifier @@ -343,9 +349,9 @@ fun ServiceInfo( color = Grey150 ) MyPageItem( - text = stringResource(id = R.string.my_page_private_information), - icon = R.drawable.ic_my_page_opinion, - onButtonClick = { onOpinionClick() } + text = stringResource(id = R.string.my_page_personal), + icon = R.drawable.ic_my_page_personal, + onButtonClick = onPersonalClick ) HorizontalDivider( modifier = Modifier @@ -374,7 +380,9 @@ fun MyPageScreenPreview() { onOpinionClick = {}, onLogoutClick = {}, onQuitClick = {}, - onEditClick = {} + onEditClick = {}, + onServiceClick = {}, + onPersonalClick = {}, ) } } \ No newline at end of file diff --git a/feature/src/main/res/drawable/ic_my_page_notice.xml b/feature/src/main/res/drawable/ic_my_page_notice.xml index 6f049a9e3..3e56590a0 100644 --- a/feature/src/main/res/drawable/ic_my_page_notice.xml +++ b/feature/src/main/res/drawable/ic_my_page_notice.xml @@ -1,26 +1,21 @@ + android:width="22dp" + android:height="22dp" + android:viewportWidth="22" + android:viewportHeight="22"> + android:pathData="M2.17,6.609H3.44V10.929H2.17C1.5,10.929 0.96,10.389 0.96,9.719V7.819C0.96,7.149 1.5,6.609 2.17,6.609Z" + android:fillColor="#1EAC61"/> + android:pathData="M12.76,20.279H11.23C10.87,20.279 10.56,19.989 10.45,19.569L7.77,8.449H10.99L13.54,18.999C13.69,19.639 13.31,20.289 12.76,20.289V20.279Z" + android:fillColor="#1EAC61"/> + android:pathData="M5.84,4.641H15.44V12.911H5.84C4.38,12.911 3.2,11.731 3.2,10.271V7.271C3.2,5.811 4.38,4.631 5.84,4.631V4.641Z" + android:fillColor="#65DB9B"/> + android:pathData="M19.75,10.291H18.78V7.261H19.75C20.59,7.261 21.27,7.941 21.27,8.781C21.27,9.621 20.59,10.301 19.75,10.301V10.291Z" + android:fillColor="#0D8443"/> + android:pathData="M13.27,4.7V12.85L19.03,15.79C19.33,15.94 19.65,15.67 19.65,15.27V2.29C19.65,1.89 19.32,1.61 19.03,1.77L13.27,4.71V4.7Z" + android:fillColor="#1EAC61"/> diff --git a/feature/src/main/res/drawable/ic_my_page_opinion.xml b/feature/src/main/res/drawable/ic_my_page_opinion.xml index 41512f23e..848db9d9a 100644 --- a/feature/src/main/res/drawable/ic_my_page_opinion.xml +++ b/feature/src/main/res/drawable/ic_my_page_opinion.xml @@ -1,26 +1,21 @@ + android:width="22dp" + android:height="22dp" + android:viewportWidth="22" + android:viewportHeight="22"> + android:pathData="M21.1,14.81V11.63C21.1,10 19.78,8.68 18.15,8.68H10.3C8.67,8.68 7.35,10 7.35,11.63V14.81C7.35,16.44 8.67,17.76 10.3,17.76H16.75C18.67,19.74 20.97,19.93 20.97,19.93C20.09,19.11 19.58,18.25 19.28,17.54C20.35,17.1 21.11,16.05 21.11,14.81H21.1Z" + android:fillColor="#1EAC61"/> + android:pathData="M0.9,9.26V5.53C0.9,3.62 2.57,2.07 4.62,2.07H14.52C16.57,2.07 18.24,3.62 18.24,5.53V9.26C18.24,11.17 16.57,12.72 14.52,12.72H6.4C3.98,15.04 1.08,15.27 1.08,15.27C2.19,14.31 2.83,13.3 3.21,12.46C1.86,11.94 0.9,10.71 0.9,9.26Z" + android:fillColor="#65DB9B"/> + android:pathData="M9.63,8.379C10.072,8.379 10.43,8.021 10.43,7.579C10.43,7.137 10.072,6.779 9.63,6.779C9.188,6.779 8.83,7.137 8.83,7.579C8.83,8.021 9.188,8.379 9.63,8.379Z" + android:fillColor="#1EAC61"/> + android:pathData="M12.71,8.379C13.152,8.379 13.51,8.021 13.51,7.579C13.51,7.137 13.152,6.779 12.71,6.779C12.268,6.779 11.91,7.137 11.91,7.579C11.91,8.021 12.268,8.379 12.71,8.379Z" + android:fillColor="#1EAC61"/> + android:pathData="M6.55,8.379C6.992,8.379 7.35,8.021 7.35,7.579C7.35,7.137 6.992,6.779 6.55,6.779C6.108,6.779 5.75,7.137 5.75,7.579C5.75,8.021 6.108,8.379 6.55,8.379Z" + android:fillColor="#1EAC61"/> diff --git a/feature/src/main/res/drawable/ic_my_page_personal.xml b/feature/src/main/res/drawable/ic_my_page_personal.xml new file mode 100644 index 000000000..62f540bf0 --- /dev/null +++ b/feature/src/main/res/drawable/ic_my_page_personal.xml @@ -0,0 +1,27 @@ + + + + + + + + + diff --git a/feature/src/main/res/drawable/ic_my_page_service.xml b/feature/src/main/res/drawable/ic_my_page_service.xml new file mode 100644 index 000000000..ea3583ef0 --- /dev/null +++ b/feature/src/main/res/drawable/ic_my_page_service.xml @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/feature/src/main/res/drawable/ic_my_page_version.xml b/feature/src/main/res/drawable/ic_my_page_version.xml index f264846fb..1d70ec4c2 100644 --- a/feature/src/main/res/drawable/ic_my_page_version.xml +++ b/feature/src/main/res/drawable/ic_my_page_version.xml @@ -1,34 +1,21 @@ + android:width="22dp" + android:height="22dp" + android:viewportWidth="22" + android:viewportHeight="22"> + android:pathData="M15.21,0.711H6.79C5.244,0.711 3.99,1.965 3.99,3.511V18.491C3.99,20.037 5.244,21.291 6.79,21.291H15.21C16.756,21.291 18.01,20.037 18.01,18.491V3.511C18.01,1.965 16.756,0.711 15.21,0.711Z" + android:fillColor="#1EAC61"/> + android:pathData="M15.73,3.85H6.28C5.855,3.85 5.51,4.194 5.51,4.62V16.19C5.51,16.615 5.855,16.96 6.28,16.96H15.73C16.155,16.96 16.5,16.615 16.5,16.19V4.62C16.5,4.194 16.155,3.85 15.73,3.85Z" + android:fillColor="#65DB9B"/> + android:pathData="M8.38,2.6C8.656,2.6 8.88,2.376 8.88,2.1C8.88,1.823 8.656,1.6 8.38,1.6C8.104,1.6 7.88,1.823 7.88,2.1C7.88,2.376 8.104,2.6 8.38,2.6Z" + android:fillColor="#0D8443"/> + android:pathData="M13.62,1.6H9.97C9.694,1.6 9.47,1.823 9.47,2.1C9.47,2.376 9.694,2.6 9.97,2.6H13.62C13.896,2.6 14.12,2.376 14.12,2.1C14.12,1.823 13.896,1.6 13.62,1.6Z" + android:fillColor="#0D8443"/> - - + android:pathData="M11,20.511C11.635,20.511 12.15,19.996 12.15,19.361C12.15,18.726 11.635,18.211 11,18.211C10.365,18.211 9.85,18.726 9.85,19.361C9.85,19.996 10.365,20.511 11,20.511Z" + android:fillColor="#0D8443"/> diff --git a/feature/src/main/res/values/strings.xml b/feature/src/main/res/values/strings.xml index bf3482521..fc9ccfc9b 100644 --- a/feature/src/main/res/values/strings.xml +++ b/feature/src/main/res/values/strings.xml @@ -136,11 +136,11 @@ 탈퇴하기 프로필 수정 터닝 커뮤니티 - 공지사항 + 공지사항 의견보내기 서비스 정보 - 서비스 이용약관 - 개인정보 처리방침 + 서비스 이용약관 + 개인정보 처리방침 버전정보 From 3ff3cffec165baac9e46f04589fdff907a9aca22 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 5 Sep 2024 03:20:55 +0900 Subject: [PATCH 58/62] =?UTF-8?q?[FEAT/#206]=20=EB=A7=88=EC=9D=B4=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=ED=94=84=EB=A1=9C=ED=95=84=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bottomsheet/ProfileBottomSheet.kt | 18 +- .../mypage/mypage/component/MyPageProfile.kt | 10 +- .../res/drawable/ic_terning_profile_00.xml | 179 +++++----------- .../res/drawable/ic_terning_profile_01.xml | 200 +++++++----------- .../res/drawable/ic_terning_profile_02.xml | 161 ++++++-------- .../res/drawable/ic_terning_profile_03.xml | 195 ++++++----------- .../res/drawable/ic_terning_profile_04.xml | 180 +++++----------- .../res/drawable/ic_terning_profile_05.xml | 172 ++++++--------- 8 files changed, 402 insertions(+), 713 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt index 87de9fa95..937c68a4b 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt @@ -5,7 +5,9 @@ import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.aspectRatio 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.LazyVerticalGrid import androidx.compose.foundation.lazy.grid.itemsIndexed @@ -112,13 +114,15 @@ fun RadioButtonGroup( ) { itemsIndexed(options) { index, option -> val imageModifier = if (selectedOption == options[index]) { - modifier.border( - color = TerningMain, - width = 2.dp, - shape = CircleShape - ) - } else { modifier + .border( + color = TerningMain, + width = 2.dp, + shape = CircleShape + ) + .aspectRatio(1f) + } else { + modifier.aspectRatio(1f) } Image( @@ -132,6 +136,8 @@ fun RadioButtonGroup( selectedOption = option } .clip(shape = CircleShape) + .size(76.dp) + .aspectRatio(1f) ) } } diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/component/MyPageProfile.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/component/MyPageProfile.kt index 8bc3860ec..cd12d2623 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/component/MyPageProfile.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/component/MyPageProfile.kt @@ -1,13 +1,15 @@ package com.terning.feature.mypage.component +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip +import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp import com.terning.core.R -import com.terning.core.designsystem.component.image.TerningImage @Composable fun MyPageProfile( @@ -32,10 +34,12 @@ fun MyPageProfile( else -> options[5] } - TerningImage( - painter = option, + Image( + painter = painterResource(id = option), modifier = modifier .size(72.dp) .clip(shape = CircleShape) + .aspectRatio(1f), + contentDescription = "profile image" ) } diff --git a/feature/src/main/res/drawable/ic_terning_profile_00.xml b/feature/src/main/res/drawable/ic_terning_profile_00.xml index f34f8769c..99edfdf96 100644 --- a/feature/src/main/res/drawable/ic_terning_profile_00.xml +++ b/feature/src/main/res/drawable/ic_terning_profile_00.xml @@ -1,137 +1,60 @@ - - - - - - - + android:width="76dp" + android:height="76dp" + android:viewportWidth="76" + android:viewportHeight="76"> + android:pathData="M38,0L38,0A38,38 0,0 1,76 38L76,38A38,38 0,0 1,38 76L38,76A38,38 0,0 1,0 38L0,38A38,38 0,0 1,38 0z"/> - - - - - - - - - - - - - - - - + android:pathData="M76,0H0V76H76V0Z" + android:fillColor="#FBF8CB"/> - - - - + android:pathData="M57.95,77.966L67.64,49.542C68.314,47.472 67.574,45.192 65.807,43.909L41.971,26.59C40.204,25.308 37.819,25.308 36.053,26.59L12.217,43.909C10.45,45.192 9.718,47.462 10.384,49.542L19.494,77.567C20.169,79.638 22.097,81.045 24.282,81.045H53.751" + android:fillColor="#ffffff"/> - - - - - - + android:pathData="M57.95,77.966L67.64,49.542C68.314,47.472 67.574,45.192 65.807,43.909L41.971,26.59C40.204,25.308 37.819,25.308 36.053,26.59L12.217,43.909C10.45,45.192 9.718,47.462 10.384,49.542L19.494,77.567C20.169,79.638 22.097,81.045 24.282,81.045H53.751" + android:strokeWidth="1.425" + android:fillColor="#00000000" + android:strokeColor="#171717" + android:strokeLineCap="round"/> + + + + + + + + + android:pathData="M35.444,53.884C35.444,53.884 36.243,55.613 38.114,55.613C39.986,55.613 40.565,53.884 40.565,53.884" + android:strokeWidth="1.425" + android:fillColor="#00000000" + android:strokeColor="#171717" + android:strokeLineCap="round"/> - diff --git a/feature/src/main/res/drawable/ic_terning_profile_01.xml b/feature/src/main/res/drawable/ic_terning_profile_01.xml index 557c169b6..0bfcc7b29 100644 --- a/feature/src/main/res/drawable/ic_terning_profile_01.xml +++ b/feature/src/main/res/drawable/ic_terning_profile_01.xml @@ -1,132 +1,80 @@ - - - - - - + android:width="76dp" + android:height="76dp" + android:viewportWidth="76" + android:viewportHeight="76"> + android:pathData="M38,0L38,0A38,38 0,0 1,76 38L76,38A38,38 0,0 1,38 76L38,76A38,38 0,0 1,0 38L0,38A38,38 0,0 1,38 0z"/> + android:pathData="M76,0H0V76H76V0Z" + android:fillColor="#ECF9CA"/> + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - diff --git a/feature/src/main/res/drawable/ic_terning_profile_02.xml b/feature/src/main/res/drawable/ic_terning_profile_02.xml index 1ad3e5dd8..8ba5ffc15 100644 --- a/feature/src/main/res/drawable/ic_terning_profile_02.xml +++ b/feature/src/main/res/drawable/ic_terning_profile_02.xml @@ -1,98 +1,75 @@ - - - - - - + android:width="76dp" + android:height="76dp" + android:viewportWidth="76" + android:viewportHeight="76"> + android:pathData="M38,0L38,0A38,38 0,0 1,76 38L76,38A38,38 0,0 1,38 76L38,76A38,38 0,0 1,0 38L0,38A38,38 0,0 1,38 0z"/> + android:pathData="M76,0H0V76H76V0Z" + android:fillColor="#D4F9DE"/> + + + + + + + + + + + + + - - - - - - - - - - - - - - diff --git a/feature/src/main/res/drawable/ic_terning_profile_03.xml b/feature/src/main/res/drawable/ic_terning_profile_03.xml index fc45cad6a..25e878efb 100644 --- a/feature/src/main/res/drawable/ic_terning_profile_03.xml +++ b/feature/src/main/res/drawable/ic_terning_profile_03.xml @@ -1,131 +1,76 @@ - - - - - + android:width="76dp" + android:height="76dp" + android:viewportWidth="76" + android:viewportHeight="76"> + android:pathData="M38,0L38,0A38,38 0,0 1,76 38L76,38A38,38 0,0 1,38 76L38,76A38,38 0,0 1,0 38L0,38A38,38 0,0 1,38 0z"/> + android:pathData="M76.209,0H0.209V76H76.209V0Z" + android:fillColor="#C5DEF2"/> + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - diff --git a/feature/src/main/res/drawable/ic_terning_profile_04.xml b/feature/src/main/res/drawable/ic_terning_profile_04.xml index 228909ea8..8b27c5c6c 100644 --- a/feature/src/main/res/drawable/ic_terning_profile_04.xml +++ b/feature/src/main/res/drawable/ic_terning_profile_04.xml @@ -1,150 +1,74 @@ + android:width="76dp" + android:height="76dp" + android:viewportWidth="76" + android:viewportHeight="76"> + android:pathData="M76,0H0V76H76V0Z" + android:fillColor="#E9F1E4"/> - - - - - - - - - - - - - - - - - - - - - - + android:pathData="M64.676,32.956H11.324V85.035H64.676V32.956Z" + android:strokeLineJoin="round" + android:strokeWidth="1.425" + android:fillColor="#ffffff" + android:strokeColor="#171717" + android:strokeLineCap="round"/> + android:pathData="M31.663,53.447C31.663,53.779 31.616,54.131 31.502,54.416C31.388,54.701 31.036,54.872 30.808,55.1C30.58,55.328 30.409,55.623 30.105,55.746C29.801,55.869 29.488,55.841 29.155,55.841C28.823,55.841 28.509,55.822 28.224,55.699C27.939,55.575 27.654,55.395 27.426,55.167C27.198,54.938 26.999,54.682 26.875,54.378C26.752,54.074 26.638,53.761 26.638,53.438C26.638,53.114 26.837,52.811 26.961,52.526C27.084,52.241 27.274,52.003 27.502,51.775C27.73,51.547 27.939,51.319 28.234,51.195C28.528,51.072 28.832,51.072 29.165,51.072C29.497,51.072 29.801,51.082 30.086,51.205C30.371,51.328 30.647,51.509 30.875,51.728C31.103,51.946 31.293,52.212 31.416,52.507C31.54,52.801 31.682,53.105 31.682,53.438L31.663,53.447Z" + android:fillColor="#F9DBDE"/> + android:pathData="M31.663,53.447C31.663,53.779 31.616,54.131 31.502,54.416C31.388,54.701 31.036,54.872 30.808,55.1C30.58,55.328 30.409,55.623 30.105,55.746C29.801,55.869 29.488,55.841 29.155,55.841C28.823,55.841 28.509,55.822 28.224,55.699C27.939,55.575 27.654,55.395 27.426,55.167C27.198,54.938 26.999,54.682 26.875,54.378C26.752,54.074 26.638,53.761 26.638,53.438C26.638,53.114 26.837,52.811 26.961,52.526C27.084,52.241 27.274,52.003 27.502,51.775C27.73,51.547 27.939,51.319 28.234,51.195C28.528,51.072 28.832,51.072 29.165,51.072C29.497,51.072 29.801,51.082 30.086,51.205C30.371,51.328 30.647,51.509 30.875,51.728C31.103,51.946 31.293,52.212 31.416,52.507C31.54,52.801 31.682,53.105 31.682,53.438L31.663,53.447Z" + android:strokeWidth="0.7315" + android:fillColor="#00000000" + android:strokeColor="#F9DBDE"/> + android:pathData="M49.343,53.267C49.343,53.599 49.267,53.932 49.143,54.226C49.02,54.521 48.839,54.825 48.611,55.043C48.383,55.262 48.079,55.433 47.785,55.556C47.49,55.68 47.167,55.651 46.835,55.651C46.502,55.651 46.217,55.585 45.923,55.461C45.628,55.338 45.267,55.281 45.049,55.053C44.83,54.825 44.669,54.511 44.545,54.217C44.422,53.922 44.422,53.599 44.422,53.267C44.422,52.934 44.45,52.611 44.564,52.326C44.678,52.041 44.897,51.775 45.125,51.557C45.353,51.338 45.638,51.215 45.932,51.091C46.227,50.968 46.502,50.92 46.835,50.92C47.167,50.92 47.49,50.863 47.785,50.987C48.079,51.11 48.355,51.3 48.583,51.528C48.811,51.756 49.01,52.022 49.134,52.326C49.257,52.63 49.343,52.944 49.343,53.276V53.267Z" + android:fillColor="#F9DBDE"/> + android:strokeColor="#F9DBDE"/> + android:pathData="M37.506,63.441H38.598C38.988,63.441 39.32,63.707 39.396,64.077L41.762,75.8C41.828,76.199 41.705,76.608 41.42,76.902L39.016,79.372C38.503,79.895 37.648,79.914 37.126,79.401L34.618,76.978C34.314,76.684 34.171,76.256 34.247,75.838L36.717,64.077C36.793,63.707 37.126,63.441 37.515,63.441H37.506Z" + android:strokeWidth="1.425" + android:fillColor="#A6B7FF" + android:strokeColor="#171717"/> + android:pathData="M39.168,63.907H36.955C36.518,63.907 36.147,63.603 36.053,63.185L35.54,60.952C35.407,60.373 35.853,59.812 36.442,59.812H39.701C40.299,59.812 40.745,60.373 40.603,60.952L40.071,63.185C39.976,63.603 39.596,63.897 39.168,63.897V63.907Z" + android:strokeWidth="1.425" + android:fillColor="#A6B7FF" + android:strokeColor="#171717"/> + android:pathData="M34.818,52.497C35.384,52.497 35.843,51.791 35.843,50.92C35.843,50.049 35.384,49.343 34.818,49.343C34.251,49.343 33.792,50.049 33.792,50.92C33.792,51.791 34.251,52.497 34.818,52.497Z" + android:fillColor="#171717"/> + android:pathData="M41.182,52.497C41.749,52.497 42.208,51.791 42.208,50.92C42.208,50.049 41.749,49.343 41.182,49.343C40.616,49.343 40.157,50.049 40.157,50.92C40.157,51.791 40.616,52.497 41.182,52.497Z" + android:fillColor="#171717"/> + diff --git a/feature/src/main/res/drawable/ic_terning_profile_05.xml b/feature/src/main/res/drawable/ic_terning_profile_05.xml index 2d21f7990..9a32c789e 100644 --- a/feature/src/main/res/drawable/ic_terning_profile_05.xml +++ b/feature/src/main/res/drawable/ic_terning_profile_05.xml @@ -1,111 +1,73 @@ - - - - + android:width="76dp" + android:height="76dp" + android:viewportWidth="76" + android:viewportHeight="76"> + android:pathData="M38,0L38,0A38,38 0,0 1,76 38L76,38A38,38 0,0 1,38 76L38,76A38,38 0,0 1,0 38L0,38A38,38 0,0 1,38 0z"/> + android:pathData="M76,0H0V76H76V0Z" + android:fillColor="#E6FFF6"/> + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - From 4ab99e1f811cbd5ff5d0a2d594f52512c7baa3cd Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 5 Sep 2024 03:29:57 +0900 Subject: [PATCH 59/62] =?UTF-8?q?[FEAT/#206]=20=EB=A7=88=EC=9D=B4=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=ED=94=84=EB=A1=9C=ED=95=84=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/bottomsheet/ProfileBottomSheet.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt index 937c68a4b..9382ceb7a 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/bottomsheet/ProfileBottomSheet.kt @@ -85,15 +85,15 @@ fun ProfileBottomSheet( /** * 6개의 프로필 이미지 중, 하나의 이미지만 선택할 수 있는 라디오 버튼입니다. * - * @param modifier 라디오 버튼에 적용할 Modifier입니다. * @param onOptionSelected 선택된 이미지의 인덱스 값을 나타내는 콜백 함수입니다. * @param initialSelectedOption 초기에 선택된 이미지를 나타내는 인덱스 값입니다. + * @param modifier 라디오 버튼에 적용할 Modifier입니다. */ @Composable fun RadioButtonGroup( - modifier: Modifier = Modifier, onOptionSelected: (Int) -> Unit, - initialSelectedOption: Int + initialSelectedOption: Int, + modifier: Modifier = Modifier, ) { val options = listOf( R.drawable.ic_terning_profile_00, @@ -114,7 +114,7 @@ fun RadioButtonGroup( ) { itemsIndexed(options) { index, option -> val imageModifier = if (selectedOption == options[index]) { - modifier + Modifier .border( color = TerningMain, width = 2.dp, @@ -122,7 +122,7 @@ fun RadioButtonGroup( ) .aspectRatio(1f) } else { - modifier.aspectRatio(1f) + Modifier.aspectRatio(1f) } Image( From 17955e494a4a7530f68082b570fa1657683b1061 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 5 Sep 2024 03:34:23 +0900 Subject: [PATCH 60/62] =?UTF-8?q?[FEAT/#206]=20=EC=BD=94=EB=93=9C=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 --- .../component/textfield/NameTextField.kt | 6 ++-- .../mypage/profileedit/ProfileEditRoute.kt | 30 +++++++++---------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt index dfa48f52a..9620bde6c 100644 --- a/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt +++ b/core/src/main/java/com/terning/core/designsystem/component/textfield/NameTextField.kt @@ -42,10 +42,10 @@ fun NameTextField( val nameErrorRegex = NAME_ERROR_REGEX val trimmedName: String - var outOfBoundName = false + var isNameOutOfBounds = false if (value.length > MAX_LENGTH) { trimmedName = value.substring(0, MAX_LENGTH) - outOfBoundName = true + isNameOutOfBounds = true } else { trimmedName = value } @@ -84,7 +84,7 @@ fun NameTextField( ) } - outOfBoundName -> { + isNameOutOfBounds -> { NameFieldState( name = trimmedName, lineColor = WarningRed, diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index 99e7a8187..577c5689b 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -40,9 +40,9 @@ import com.terning.feature.R @Composable fun ProfileEditRoute( navigateUp: () -> Unit, - viewModel: ProfileEditViewModel = hiltViewModel(), initialName: String, - initialProfile: Int + initialProfile: Int, + viewModel: ProfileEditViewModel = hiltViewModel(), ) { val state by viewModel.state.collectAsStateWithLifecycle() @@ -105,13 +105,12 @@ fun ProfileEditScreen( onSaveClick: () -> Unit, name: String, onBackButtonClick: () -> Unit, - modifier: Modifier = Modifier, - onValidationChanged: (Boolean) -> Unit + onValidationChanged: (Boolean) -> Unit, ) { val focusManager = LocalFocusManager.current Column( - modifier = modifier + modifier = Modifier .statusBarsPadding() .navigationBarsPadding() .fillMaxSize() @@ -122,16 +121,16 @@ fun ProfileEditScreen( onBackButtonClick = { onBackButtonClick() }, title = stringResource(id = R.string.profile_edit_title), ) - Spacer(modifier = modifier.height(24.dp)) + Spacer(modifier = Modifier.height(24.dp)) Column( - modifier = modifier.padding(horizontal = 24.dp) + modifier = Modifier.padding(horizontal = 24.dp) ) { Text( text = stringResource(id = R.string.sign_up_profile_image), style = TerningTheme.typography.body2, color = Grey500 ) - Spacer(modifier = modifier.height(20.dp)) + Spacer(modifier = Modifier.height(20.dp)) ProfileWithPlusButton( modifier = Modifier .noRippleClickable { @@ -140,12 +139,12 @@ fun ProfileEditScreen( .align(Alignment.CenterHorizontally), index = profileEditState.profile ) - Spacer(modifier = modifier.height(48.dp)) + Spacer(modifier = Modifier.height(48.dp)) Text( text = stringResource(id = R.string.sign_up_name), color = Grey500 ) - Spacer(modifier = modifier.height(20.dp)) + Spacer(modifier = Modifier.height(20.dp)) NameTextField( value = name, onValueChange = { editName -> @@ -157,28 +156,27 @@ fun ProfileEditScreen( }, initialView = profileEditState.initialView ) - Spacer(modifier = modifier.height(48.dp)) - + Spacer(modifier = Modifier.height(48.dp)) Text( text = stringResource(id = R.string.profile_edit_auth_type), style = TerningTheme.typography.body2, color = Grey500, ) - Spacer(modifier = modifier.height(11.dp)) + Spacer(modifier = Modifier.height(11.dp)) Text( text = profileEditState.authType, style = TerningTheme.typography.detail0 ) } - Spacer(modifier = modifier.weight(1f)) + Spacer(modifier = Modifier.weight(1f)) RectangleButton( style = TerningTheme.typography.button1, paddingVertical = 20.dp, text = R.string.profile_edit_save, - onButtonClick = { onSaveClick() }, + onButtonClick = onSaveClick, isEnabled = profileEditState.isButtonValid, ) - Spacer(modifier = modifier.height(12.dp)) + Spacer(modifier = Modifier.height(12.dp)) } } From 45692416d3089793751e9fd9fe102e474b58aa3e Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 5 Sep 2024 03:36:51 +0900 Subject: [PATCH 61/62] =?UTF-8?q?[FEAT/#206]=20=EC=BD=94=EB=93=9C=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 --- .../terning/feature/mypage/mypage/MyPageRoute.kt | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt index 7207198ed..e520d3504 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt @@ -48,8 +48,8 @@ import com.terning.feature.mypage.mypage.component.MyPageItem @Composable fun MyPageRoute( paddingValues: PaddingValues, + navigateToProfileEdit: (String, Int) -> Unit, viewModel: MyPageViewModel = hiltViewModel(), - navigateToProfileEdit: (String, Int) -> Unit ) { val state by viewModel.state.collectAsStateWithLifecycle() val context = LocalContext.current @@ -144,13 +144,12 @@ fun MyPageScreen( onOpinionClick: () -> Unit, onServiceClick: () -> Unit, onPersonalClick: () -> Unit, - modifier: Modifier = Modifier, paddingValues: PaddingValues = PaddingValues(), name: String = "", profile: Int = 0 ) { Column( - modifier = modifier + modifier = Modifier .fillMaxSize() .background(Back) .padding(paddingValues) @@ -289,8 +288,7 @@ fun TerningCommunity( onButtonClick = onNoticeClick ) HorizontalDivider( - modifier = Modifier - .padding(vertical = 20.dp), + modifier = Modifier.padding(vertical = 20.dp), thickness = 1.dp, color = Grey150 ) @@ -343,8 +341,7 @@ fun ServiceInfo( onButtonClick = onServiceClick ) HorizontalDivider( - modifier = Modifier - .padding(vertical = 20.dp), + modifier = Modifier.padding(vertical = 20.dp), thickness = 1.dp, color = Grey150 ) @@ -354,8 +351,7 @@ fun ServiceInfo( onButtonClick = onPersonalClick ) HorizontalDivider( - modifier = Modifier - .padding(vertical = 20.dp), + modifier = Modifier.padding(vertical = 20.dp), thickness = 1.dp, color = Grey150 ) From 1892ea7a2c81bda7c84890769b244608f23f50d5 Mon Sep 17 00:00:00 2001 From: arinming Date: Fri, 6 Sep 2024 16:31:25 +0900 Subject: [PATCH 62/62] =?UTF-8?q?[FEAT/#191]=20=EC=9D=B4=EB=AF=B8=EC=A7=80?= =?UTF-8?q?=20ContentScale=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/intern/component/InternCompanyInfo.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt b/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt index 7dc5ec55b..39d31b248 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternCompanyInfo.kt @@ -58,7 +58,7 @@ fun InternCompanyInfo( .data(companyImage) .build(), contentDescription = stringResource(id = R.string.search_image), - contentScale = ContentScale.Crop, + contentScale = ContentScale.Fit, modifier = Modifier .fillMaxWidth() .clip(CircleShape),