From 6730a62503d23d23d633a1ea34bdd5a8404219e9 Mon Sep 17 00:00:00 2001 From: tgyuuAn Date: Tue, 7 Jan 2025 14:27:43 +0900 Subject: [PATCH 01/11] =?UTF-8?q?[PC-300]=20PieceTopBar=EC=97=90=20?= =?UTF-8?q?=EB=86=92=EC=9D=B4=2060dp=20=EA=B3=A0=EC=A0=95=EA=B0=92=20?= =?UTF-8?q?=EC=82=BD=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../puzzle/designsystem/component/TopBar.kt | 25 +++++++++++++------ .../registration/RegistrationDetailScreen.kt | 19 ++++++++++++-- .../graph/registration/RegistrationScreen.kt | 2 -- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/core/designsystem/src/main/java/com/puzzle/designsystem/component/TopBar.kt b/core/designsystem/src/main/java/com/puzzle/designsystem/component/TopBar.kt index 5305d2c..8cca539 100644 --- a/core/designsystem/src/main/java/com/puzzle/designsystem/component/TopBar.kt +++ b/core/designsystem/src/main/java/com/puzzle/designsystem/component/TopBar.kt @@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.material3.Text @@ -30,7 +31,9 @@ fun PieceMainTopBar( ) { Row( verticalAlignment = Alignment.CenterVertically, - modifier = modifier, + modifier = modifier + .fillMaxWidth() + .height(60.dp), ) { Text( text = title, @@ -54,7 +57,9 @@ fun PieceSubTopBar( Row( horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically, - modifier = modifier, + modifier = modifier + .fillMaxWidth() + .height(60.dp), ) { Image( painter = painterResource(R.drawable.ic_arrow_left), @@ -78,7 +83,11 @@ fun PieceSubBackTopBar( onBackClick: () -> Unit, modifier: Modifier = Modifier, ) { - Box(modifier = modifier.fillMaxWidth()) { + Box( + modifier = modifier + .fillMaxWidth() + .height(60.dp), + ) { Image( painter = painterResource(R.drawable.ic_arrow_left), contentDescription = "뒤로 가기 버튼", @@ -105,7 +114,11 @@ fun PieceSubCloseTopBar( closeButtonEnabled: Boolean = true, contentColor: Color = PieceTheme.colors.black, ) { - Box(modifier = modifier.fillMaxWidth()) { + Box( + modifier = modifier + .fillMaxWidth() + .height(60.dp), + ) { Text( text = title, style = PieceTheme.typography.headingSSB, @@ -176,9 +189,7 @@ fun PreviewPieceSubTopBar() { modifier = Modifier.size(32.dp), ) }, - modifier = Modifier - .fillMaxWidth() - .padding(vertical = 20.dp), + modifier = Modifier.padding(vertical = 20.dp), ) } } diff --git a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt index 408dd8c..0add505 100644 --- a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt +++ b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt @@ -1,8 +1,23 @@ package com.puzzle.auth.graph.registration +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.height import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import com.puzzle.designsystem.component.PieceSubBackTopBar @Composable -internal fun RegistrationDetailScreen() { - +internal fun RegistrationDetailScreen( + termTitle: String, + onBackClick: () -> Unit, +) { + Column(modifier = Modifier.fillMaxSize()) { + PieceSubBackTopBar( + title = termTitle, + onBackClick = onBackClick, + modifier = Modifier + ) + } } \ No newline at end of file diff --git a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationScreen.kt b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationScreen.kt index 2301591..1a24190 100644 --- a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationScreen.kt +++ b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationScreen.kt @@ -4,7 +4,6 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize 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.runtime.Composable @@ -54,7 +53,6 @@ private fun RegistrationScreen( PieceSubBackTopBar( title = "", onBackClick = { navigate(NavigationEvent.NavigateUp) }, - modifier = Modifier.height(60.dp), ) Text( From 425fafd0bc1f34a1a87d5f90b42fb57aa90b4bb8 Mon Sep 17 00:00:00 2001 From: tgyuuAn Date: Tue, 7 Jan 2025 15:48:16 +0900 Subject: [PATCH 02/11] =?UTF-8?q?[PC-300]=20=EC=84=9C=EB=B9=84=EC=8A=A4=20?= =?UTF-8?q?=EC=9D=B4=EC=9A=A9=EC=95=BD=EA=B4=80=20=EC=83=81=EC=84=B8=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20UI=20=EB=A0=88=EC=9D=B4=EC=95=84?= =?UTF-8?q?=EC=9B=83=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../registration/RegistrationDetailScreen.kt | 26 +++++++++++-- .../graph/registration/RegistrationScreen.kt | 39 +++++++++++++------ .../registration/RegistrationViewModel.kt | 2 + 3 files changed, 52 insertions(+), 15 deletions(-) diff --git a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt index 0add505..da15a25 100644 --- a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt +++ b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt @@ -1,23 +1,41 @@ package com.puzzle.auth.graph.registration 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.fillMaxWidth +import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp +import com.puzzle.designsystem.component.PieceSolidButton import com.puzzle.designsystem.component.PieceSubBackTopBar +import com.puzzle.domain.model.terms.Term @Composable internal fun RegistrationDetailScreen( - termTitle: String, + term: Term, onBackClick: () -> Unit, + onAgreeClick: () -> Unit, ) { - Column(modifier = Modifier.fillMaxSize()) { + Column( + modifier = Modifier + .fillMaxSize() + .padding(horizontal = 20.dp), + ) { PieceSubBackTopBar( - title = termTitle, + title = term.title, onBackClick = onBackClick, + ) + + Spacer(modifier = Modifier.weight(1f)) + + PieceSolidButton( + label = "동의하기", + onClick = onAgreeClick, modifier = Modifier + .fillMaxWidth() + .padding(top = 12.dp, bottom = 10.dp), ) } } \ No newline at end of file diff --git a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationScreen.kt b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationScreen.kt index 1a24190..41ff1f7 100644 --- a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationScreen.kt +++ b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationScreen.kt @@ -8,6 +8,8 @@ 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.ui.Modifier import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.buildAnnotatedString @@ -22,6 +24,7 @@ import com.puzzle.designsystem.component.PieceCheckList import com.puzzle.designsystem.component.PieceSolidButton import com.puzzle.designsystem.component.PieceSubBackTopBar import com.puzzle.designsystem.foundation.PieceTheme +import com.puzzle.domain.model.terms.Term import com.puzzle.navigation.NavigationEvent @Composable @@ -29,13 +32,26 @@ internal fun RegistrationRoute( viewModel: RegistrationViewModel = mavericksViewModel() ) { val state by viewModel.collectAsState() + val (selectedTerm, setSelectedTerm) = remember { mutableStateOf(null) } - RegistrationScreen( - state = state, - checkAllTerms = { viewModel.onIntent(RegistrationIntent.CheckAllTerms) }, - checkTerm = { viewModel.onIntent(RegistrationIntent.CheckTerm(it)) }, - navigate = { event -> viewModel.onSideEffect(RegistrationSideEffect.Navigate(event)) } - ) + if (selectedTerm != null) { + RegistrationDetailScreen( + term = selectedTerm, + onBackClick = { setSelectedTerm(null) }, + onAgreeClick = { + viewModel.onIntent(RegistrationIntent.CheckTerm(selectedTerm.termId)) + setSelectedTerm(null) + } + ) + } else { + RegistrationScreen( + state = state, + checkAllTerms = { viewModel.onIntent(RegistrationIntent.CheckAllTerms) }, + checkTerm = { viewModel.onIntent(RegistrationIntent.CheckTerm(it)) }, + showTermDetail = { setSelectedTerm(it) }, + navigate = { event -> viewModel.onSideEffect(RegistrationSideEffect.Navigate(event)) } + ) + } } @Composable @@ -43,6 +59,7 @@ private fun RegistrationScreen( state: RegistrationState, checkAllTerms: () -> Unit, checkTerm: (Int) -> Unit, + showTermDetail: (Term) -> Unit, navigate: (NavigationEvent) -> Unit, ) { Column( @@ -86,13 +103,13 @@ private fun RegistrationScreen( .padding(bottom = 12.dp), ) - state.terms.forEach { termInfo -> + state.terms.forEach { term -> PieceCheckList( - checked = state.termsCheckedInfo.getOrDefault(termInfo.termId, false), + checked = state.termsCheckedInfo.getOrDefault(term.termId, false), arrowEnabled = true, - label = termInfo.title, - onCheckedChange = { checkTerm(termInfo.termId) }, - onArrowClick = {}, + label = term.title, + onCheckedChange = { checkTerm(term.termId) }, + onArrowClick = { showTermDetail(term) }, modifier = Modifier.fillMaxWidth(), ) } diff --git a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationViewModel.kt b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationViewModel.kt index 8579cf4..e05eecc 100644 --- a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationViewModel.kt +++ b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationViewModel.kt @@ -1,5 +1,6 @@ package com.puzzle.auth.graph.registration +import android.util.Log import com.airbnb.mvrx.MavericksViewModel import com.airbnb.mvrx.MavericksViewModelFactory import com.airbnb.mvrx.hilt.AssistedViewModelFactory @@ -66,6 +67,7 @@ class RegistrationViewModel @AssistedInject constructor( private fun fetchTerms() = viewModelScope.launch { termsRepository.getTerms().onSuccess { + Log.d("test", it.toString()) setState { copy(terms = it) } }.onFailure { errorHelper.sendError(it) } } From f6cdd2da466d3626c4e0a5764bf4dd2a29b53762 Mon Sep 17 00:00:00 2001 From: tgyuuAn Date: Tue, 7 Jan 2025 17:49:46 +0900 Subject: [PATCH 03/11] =?UTF-8?q?[PC-300]=20PieceWebView=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../registration/RegistrationDetailScreen.kt | 45 +++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt index da15a25..0e98a60 100644 --- a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt +++ b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt @@ -1,13 +1,22 @@ package com.puzzle.auth.graph.registration +import android.webkit.WebChromeClient +import android.webkit.WebView +import android.webkit.WebViewClient +import androidx.activity.compose.BackHandler import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding 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.LocalContext import androidx.compose.ui.unit.dp +import androidx.compose.ui.viewinterop.AndroidView import com.puzzle.designsystem.component.PieceSolidButton import com.puzzle.designsystem.component.PieceSubBackTopBar import com.puzzle.domain.model.terms.Term @@ -18,6 +27,8 @@ internal fun RegistrationDetailScreen( onBackClick: () -> Unit, onAgreeClick: () -> Unit, ) { + BackHandler { onBackClick() } + Column( modifier = Modifier .fillMaxSize() @@ -28,7 +39,12 @@ internal fun RegistrationDetailScreen( onBackClick = onBackClick, ) - Spacer(modifier = Modifier.weight(1f)) + PieceWebView( + url = term.content, + modifier = Modifier + .fillMaxWidth() + .weight(1f), + ) PieceSolidButton( label = "동의하기", @@ -38,4 +54,27 @@ internal fun RegistrationDetailScreen( .padding(top = 12.dp, bottom = 10.dp), ) } -} \ No newline at end of file +} + +@Composable +internal fun PieceWebView( + url: String, + modifier: Modifier = Modifier, +) { + val context = LocalContext.current + var webView by remember { mutableStateOf(null) } + + AndroidView( + factory = { + webView = WebView(context).apply { + settings.javaScriptEnabled = true + webViewClient = object : WebViewClient() {} + webChromeClient = object : WebChromeClient() {} + } + webView!! + }, + update = { it.loadUrl(url) }, + onRelease = { webView?.destroy() }, + modifier = modifier, + ) +} From af0dddd18408f03ecc9924ddd27a159d6f30b28c Mon Sep 17 00:00:00 2001 From: tgyuuAn Date: Wed, 8 Jan 2025 13:10:09 +0900 Subject: [PATCH 04/11] =?UTF-8?q?[PC-300]=20PieceWebView=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=ED=99=94=EB=A9=B4=EC=97=90=EC=84=9C=EB=8F=84=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=EB=90=98=EB=8A=94=20=EA=B2=83=EC=9D=84=20?= =?UTF-8?q?=EA=B3=A0=EB=A0=A4=ED=95=98=EC=97=AC=20DesignSystem=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../puzzle/designsystem/component/WebView.kt | 36 +++++++++++++++++++ .../registration/RegistrationDetailScreen.kt | 33 +---------------- 2 files changed, 37 insertions(+), 32 deletions(-) create mode 100644 core/designsystem/src/main/java/com/puzzle/designsystem/component/WebView.kt diff --git a/core/designsystem/src/main/java/com/puzzle/designsystem/component/WebView.kt b/core/designsystem/src/main/java/com/puzzle/designsystem/component/WebView.kt new file mode 100644 index 0000000..8cba18c --- /dev/null +++ b/core/designsystem/src/main/java/com/puzzle/designsystem/component/WebView.kt @@ -0,0 +1,36 @@ +package com.puzzle.designsystem.component + +import android.webkit.WebChromeClient +import android.webkit.WebView +import android.webkit.WebViewClient +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.LocalContext +import androidx.compose.ui.viewinterop.AndroidView + +@Composable +fun PieceWebView( + url: String, + modifier: Modifier = Modifier, +) { + val context = LocalContext.current + var webView by remember { mutableStateOf(null) } + + AndroidView( + factory = { + webView = WebView(context).apply { + settings.javaScriptEnabled = true + webViewClient = object : WebViewClient() {} + webChromeClient = object : WebChromeClient() {} + } + webView!! + }, + update = { it.loadUrl(url) }, + onRelease = { webView?.destroy() }, + modifier = modifier, + ) +} diff --git a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt index 0e98a60..bcab0e3 100644 --- a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt +++ b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt @@ -1,24 +1,16 @@ package com.puzzle.auth.graph.registration -import android.webkit.WebChromeClient -import android.webkit.WebView -import android.webkit.WebViewClient import androidx.activity.compose.BackHandler import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding 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.LocalContext import androidx.compose.ui.unit.dp -import androidx.compose.ui.viewinterop.AndroidView import com.puzzle.designsystem.component.PieceSolidButton import com.puzzle.designsystem.component.PieceSubBackTopBar +import com.puzzle.designsystem.component.PieceWebView import com.puzzle.domain.model.terms.Term @Composable @@ -55,26 +47,3 @@ internal fun RegistrationDetailScreen( ) } } - -@Composable -internal fun PieceWebView( - url: String, - modifier: Modifier = Modifier, -) { - val context = LocalContext.current - var webView by remember { mutableStateOf(null) } - - AndroidView( - factory = { - webView = WebView(context).apply { - settings.javaScriptEnabled = true - webViewClient = object : WebViewClient() {} - webChromeClient = object : WebChromeClient() {} - } - webView!! - }, - update = { it.loadUrl(url) }, - onRelease = { webView?.destroy() }, - modifier = modifier, - ) -} From 0adf576f4b8d0a52267e66a396d629071ec1577d Mon Sep 17 00:00:00 2001 From: tgyuuAn Date: Wed, 8 Jan 2025 13:13:40 +0900 Subject: [PATCH 05/11] =?UTF-8?q?[PC-300]=20=ED=95=98=EB=93=9C=20=EC=BD=94?= =?UTF-8?q?=EB=94=A9=EB=90=9C=20String=20Strings.xml=20=EB=A1=9C=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/designsystem/src/main/res/values/strings.xml | 5 +++++ .../auth/graph/registration/RegistrationDetailScreen.kt | 4 +++- .../puzzle/auth/graph/registration/RegistrationScreen.kt | 6 ++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/core/designsystem/src/main/res/values/strings.xml b/core/designsystem/src/main/res/values/strings.xml index c5f0d6c..b350db6 100644 --- a/core/designsystem/src/main/res/values/strings.xml +++ b/core/designsystem/src/main/res/values/strings.xml @@ -1,5 +1,10 @@ + + 다음 + 동의하기 + 약관 전체 동의 + Matching 매칭 조각을 확인해주세요! diff --git a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt index bcab0e3..5ab68b7 100644 --- a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt +++ b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt @@ -7,7 +7,9 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp +import com.puzzle.designsystem.R import com.puzzle.designsystem.component.PieceSolidButton import com.puzzle.designsystem.component.PieceSubBackTopBar import com.puzzle.designsystem.component.PieceWebView @@ -39,7 +41,7 @@ internal fun RegistrationDetailScreen( ) PieceSolidButton( - label = "동의하기", + label = stringResource(R.string.agree), onClick = onAgreeClick, modifier = Modifier .fillMaxWidth() diff --git a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationScreen.kt b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationScreen.kt index 41ff1f7..f75594d 100644 --- a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationScreen.kt +++ b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationScreen.kt @@ -11,6 +11,7 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.withStyle @@ -20,6 +21,7 @@ import com.airbnb.mvrx.compose.mavericksViewModel import com.puzzle.auth.graph.registration.contract.RegistrationIntent import com.puzzle.auth.graph.registration.contract.RegistrationSideEffect import com.puzzle.auth.graph.registration.contract.RegistrationState +import com.puzzle.designsystem.R import com.puzzle.designsystem.component.PieceCheckList import com.puzzle.designsystem.component.PieceSolidButton import com.puzzle.designsystem.component.PieceSubBackTopBar @@ -95,7 +97,7 @@ private fun RegistrationScreen( PieceCheckList( checked = state.allTermsAgreed, - label = "약관 전체 동의", + label = stringResource(R.string.all_term_agree), containerColor = PieceTheme.colors.light3, onCheckedChange = checkAllTerms, modifier = Modifier @@ -121,7 +123,7 @@ private fun RegistrationScreen( ) PieceSolidButton( - label = "다음", + label = stringResource(R.string.next), onClick = {}, modifier = Modifier .fillMaxWidth() From 072731d1ecb220713caa549e499836afc14b36a5 Mon Sep 17 00:00:00 2001 From: tgyuuAn Date: Wed, 8 Jan 2025 13:14:45 +0900 Subject: [PATCH 06/11] =?UTF-8?q?[PC-300]=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/puzzle/auth/graph/registration/RegistrationViewModel.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationViewModel.kt b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationViewModel.kt index e05eecc..8579cf4 100644 --- a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationViewModel.kt +++ b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationViewModel.kt @@ -1,6 +1,5 @@ package com.puzzle.auth.graph.registration -import android.util.Log import com.airbnb.mvrx.MavericksViewModel import com.airbnb.mvrx.MavericksViewModelFactory import com.airbnb.mvrx.hilt.AssistedViewModelFactory @@ -67,7 +66,6 @@ class RegistrationViewModel @AssistedInject constructor( private fun fetchTerms() = viewModelScope.launch { termsRepository.getTerms().onSuccess { - Log.d("test", it.toString()) setState { copy(terms = it) } }.onFailure { errorHelper.sendError(it) } } From ced86caa09e26c1345050874720b1e4d9c4d046e Mon Sep 17 00:00:00 2001 From: tgyuuAn Date: Wed, 8 Jan 2025 22:31:19 +0900 Subject: [PATCH 07/11] =?UTF-8?q?[PC-300]=20termId=20->=20id=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20=EB=B0=8F=20=EB=B6=84=ED=95=B4=20=EC=84=A0=EC=96=B8?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=EC=9E=84=EC=9C=BC=EB=A1=9C=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 --- .../data/repository/TermsRepositoryImpl.kt | 4 +-- .../puzzle/database/model/terms/TermEntity.kt | 2 +- .../com/puzzle/domain/model/terms/Term.kt | 2 +- .../network/model/terms/LoadTermsResponse.kt | 2 +- .../graph/registration/RegistrationScreen.kt | 34 +++++++++---------- .../registration/RegistrationViewModel.kt | 2 +- .../contract/RegistrationState.kt | 14 +++++++- .../{ => ui}/RegistrationDetailScreen.kt | 2 +- .../graph/detail/MatchingDetailRoute.kt | 30 ++++++++-------- .../common/component/BasicInfoHeader.kt | 2 +- .../detail}/common/constant/DialogType.kt | 2 +- .../detail}/common/ui/BasicInfoBody.kt | 4 +-- .../detail}/common/ui/ValuePickBody.kt | 4 +-- .../detail}/common/ui/ValueTalkBody.kt | 4 +-- .../detail/contract/MatchingDetailState.kt | 20 +++++------ 15 files changed, 70 insertions(+), 58 deletions(-) rename feature/auth/src/main/java/com/puzzle/auth/graph/registration/{ => ui}/RegistrationDetailScreen.kt (96%) rename feature/matching/src/main/java/com/puzzle/matching/{ => graph/detail}/common/component/BasicInfoHeader.kt (96%) rename feature/matching/src/main/java/com/puzzle/matching/{ => graph/detail}/common/constant/DialogType.kt (62%) rename feature/matching/src/main/java/com/puzzle/matching/{ => graph/detail}/common/ui/BasicInfoBody.kt (98%) rename feature/matching/src/main/java/com/puzzle/matching/{ => graph/detail}/common/ui/ValuePickBody.kt (98%) rename feature/matching/src/main/java/com/puzzle/matching/{ => graph/detail}/common/ui/ValueTalkBody.kt (98%) diff --git a/core/data/src/main/java/com/puzzle/data/repository/TermsRepositoryImpl.kt b/core/data/src/main/java/com/puzzle/data/repository/TermsRepositoryImpl.kt index 225a74e..a336c38 100644 --- a/core/data/src/main/java/com/puzzle/data/repository/TermsRepositoryImpl.kt +++ b/core/data/src/main/java/com/puzzle/data/repository/TermsRepositoryImpl.kt @@ -16,11 +16,11 @@ class TermsRepositoryImpl @Inject constructor( val terms = termDataSource.loadTerms() .getOrThrow() .toDomain() - .filter { it.termId != UNKNOWN_INT } + .filter { it.id != UNKNOWN_INT } val termsEntity = terms.map { TermEntity( - id = it.termId, + id = it.id, title = it.title, content = it.content, required = it.required, diff --git a/core/database/src/main/java/com/puzzle/database/model/terms/TermEntity.kt b/core/database/src/main/java/com/puzzle/database/model/terms/TermEntity.kt index 8918233..c1f6529 100644 --- a/core/database/src/main/java/com/puzzle/database/model/terms/TermEntity.kt +++ b/core/database/src/main/java/com/puzzle/database/model/terms/TermEntity.kt @@ -16,7 +16,7 @@ data class TermEntity( @ColumnInfo(name = "start_date") val startDate: LocalDateTime, ) { fun toDomain() = Term( - termId = id, + id = id, title = title, content = content, required = required, diff --git a/core/domain/src/main/java/com/puzzle/domain/model/terms/Term.kt b/core/domain/src/main/java/com/puzzle/domain/model/terms/Term.kt index e089652..b0eb5b3 100644 --- a/core/domain/src/main/java/com/puzzle/domain/model/terms/Term.kt +++ b/core/domain/src/main/java/com/puzzle/domain/model/terms/Term.kt @@ -3,7 +3,7 @@ package com.puzzle.domain.model.terms import java.time.LocalDateTime data class Term( - val termId: Int, + val id: Int, val title: String, val content: String, val required: Boolean, diff --git a/core/network/src/main/java/com/puzzle/network/model/terms/LoadTermsResponse.kt b/core/network/src/main/java/com/puzzle/network/model/terms/LoadTermsResponse.kt index e2b6cfa..ca99221 100644 --- a/core/network/src/main/java/com/puzzle/network/model/terms/LoadTermsResponse.kt +++ b/core/network/src/main/java/com/puzzle/network/model/terms/LoadTermsResponse.kt @@ -23,7 +23,7 @@ data class TermResponse( val startDate: String?, ) { fun toDomain(): Term = Term( - termId = termId ?: UNKNOWN_INT, + id = termId ?: UNKNOWN_INT, title = title ?: UNKNOWN_STRING, content = content ?: UNKNOWN_STRING, required = required ?: false, diff --git a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationScreen.kt b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationScreen.kt index f75594d..aaa6223 100644 --- a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationScreen.kt +++ b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationScreen.kt @@ -10,6 +10,7 @@ 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.res.stringResource import androidx.compose.ui.text.SpanStyle @@ -21,6 +22,7 @@ import com.airbnb.mvrx.compose.mavericksViewModel import com.puzzle.auth.graph.registration.contract.RegistrationIntent import com.puzzle.auth.graph.registration.contract.RegistrationSideEffect import com.puzzle.auth.graph.registration.contract.RegistrationState +import com.puzzle.auth.graph.registration.ui.RegistrationDetailScreen import com.puzzle.designsystem.R import com.puzzle.designsystem.component.PieceCheckList import com.puzzle.designsystem.component.PieceSolidButton @@ -34,26 +36,24 @@ internal fun RegistrationRoute( viewModel: RegistrationViewModel = mavericksViewModel() ) { val state by viewModel.collectAsState() - val (selectedTerm, setSelectedTerm) = remember { mutableStateOf(null) } + var selectedTerm by remember { mutableStateOf(null) } - if (selectedTerm != null) { + selectedTerm?.let { term -> RegistrationDetailScreen( - term = selectedTerm, - onBackClick = { setSelectedTerm(null) }, + term = term, + onBackClick = { selectedTerm = null }, onAgreeClick = { - viewModel.onIntent(RegistrationIntent.CheckTerm(selectedTerm.termId)) - setSelectedTerm(null) + viewModel.onIntent(RegistrationIntent.CheckTerm(term.id)) + selectedTerm = null } ) - } else { - RegistrationScreen( - state = state, - checkAllTerms = { viewModel.onIntent(RegistrationIntent.CheckAllTerms) }, - checkTerm = { viewModel.onIntent(RegistrationIntent.CheckTerm(it)) }, - showTermDetail = { setSelectedTerm(it) }, - navigate = { event -> viewModel.onSideEffect(RegistrationSideEffect.Navigate(event)) } - ) - } + } ?: RegistrationScreen( + state = state, + checkAllTerms = { viewModel.onIntent(RegistrationIntent.CheckAllTerms) }, + checkTerm = { viewModel.onIntent(RegistrationIntent.CheckTerm(it)) }, + showTermDetail = { selectedTerm = it }, + navigate = { event -> viewModel.onSideEffect(RegistrationSideEffect.Navigate(event)) } + ) } @Composable @@ -107,10 +107,10 @@ private fun RegistrationScreen( state.terms.forEach { term -> PieceCheckList( - checked = state.termsCheckedInfo.getOrDefault(term.termId, false), + checked = state.termsCheckedInfo.getOrDefault(term.id, false), arrowEnabled = true, label = term.title, - onCheckedChange = { checkTerm(term.termId) }, + onCheckedChange = { checkTerm(term.id) }, onArrowClick = { showTermDetail(term) }, modifier = Modifier.fillMaxWidth(), ) diff --git a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationViewModel.kt b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationViewModel.kt index 8579cf4..276bd88 100644 --- a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationViewModel.kt +++ b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationViewModel.kt @@ -85,7 +85,7 @@ class RegistrationViewModel @AssistedInject constructor( val updatedTermsCheckedInfo = termsCheckedInfo.toMutableMap() terms.forEach { termInfo -> - updatedTermsCheckedInfo[termInfo.termId] = true + updatedTermsCheckedInfo[termInfo.id] = true } copy(termsCheckedInfo = updatedTermsCheckedInfo) diff --git a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/contract/RegistrationState.kt b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/contract/RegistrationState.kt index 2dc7c45..e39d915 100644 --- a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/contract/RegistrationState.kt +++ b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/contract/RegistrationState.kt @@ -7,5 +7,17 @@ data class RegistrationState( val terms: List = emptyList(), val termsCheckedInfo: MutableMap = mutableMapOf(), ) : MavericksState { - val allTermsAgreed = terms.all { termsCheckedInfo.getOrDefault(it.termId, false) } + val allTermsAgreed = terms.all { termsCheckedInfo.getOrDefault(it.id, false) } + + enum class RegistrationPage() { + TermPage, + TermDetailPage, + AccessRightsPage, + AvoidAcquaintancesPage, + SignUpCompleted; + + companion object { + + } + } } diff --git a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/ui/RegistrationDetailScreen.kt similarity index 96% rename from feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt rename to feature/auth/src/main/java/com/puzzle/auth/graph/registration/ui/RegistrationDetailScreen.kt index 5ab68b7..4edf754 100644 --- a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationDetailScreen.kt +++ b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/ui/RegistrationDetailScreen.kt @@ -1,4 +1,4 @@ -package com.puzzle.auth.graph.registration +package com.puzzle.auth.graph.registration.ui import androidx.activity.compose.BackHandler import androidx.compose.foundation.layout.Column diff --git a/feature/matching/src/main/java/com/puzzle/matching/graph/detail/MatchingDetailRoute.kt b/feature/matching/src/main/java/com/puzzle/matching/graph/detail/MatchingDetailRoute.kt index 5036f46..c379c99 100644 --- a/feature/matching/src/main/java/com/puzzle/matching/graph/detail/MatchingDetailRoute.kt +++ b/feature/matching/src/main/java/com/puzzle/matching/graph/detail/MatchingDetailRoute.kt @@ -37,10 +37,10 @@ import com.puzzle.designsystem.component.PieceImageDialog import com.puzzle.designsystem.component.PieceRoundingButton import com.puzzle.designsystem.component.PieceSubCloseTopBar import com.puzzle.designsystem.foundation.PieceTheme -import com.puzzle.matching.common.constant.DialogType -import com.puzzle.matching.common.ui.BasicInfoBody -import com.puzzle.matching.common.ui.ValuePickBody -import com.puzzle.matching.common.ui.ValueTalkBody +import com.puzzle.matching.graph.detail.common.constant.DialogType +import com.puzzle.matching.graph.detail.common.ui.BasicInfoBody +import com.puzzle.matching.graph.detail.common.ui.ValuePickBody +import com.puzzle.matching.graph.detail.common.ui.ValueTalkBody import com.puzzle.matching.graph.detail.contract.MatchingDetailIntent import com.puzzle.matching.graph.detail.contract.MatchingDetailState import com.puzzle.matching.graph.detail.contract.MatchingDetailState.MatchingDetailPage @@ -149,7 +149,7 @@ private fun MatchingDetailScreen( modifier = modifier .fillMaxSize() .then( - if (state.currentPage != MatchingDetailPage.BasicInfoState) { + if (state.currentPage != MatchingDetailPage.BasicInfoPage) { Modifier.background(PieceTheme.colors.light3) } else { Modifier @@ -184,7 +184,7 @@ private fun MatchingDetailScreen( .height(topBarHeight) .align(Alignment.TopCenter) .let { - if (state.currentPage != MatchingDetailPage.BasicInfoState) { + if (state.currentPage != MatchingDetailPage.BasicInfoPage) { it.background(PieceTheme.colors.white) } else { it @@ -243,7 +243,7 @@ private fun MatchingDetailContent( ) { Box(modifier = modifier.fillMaxSize()) { when (state.currentPage) { - MatchingDetailState.MatchingDetailPage.BasicInfoState -> + MatchingDetailState.MatchingDetailPage.BasicInfoPage -> BasicInfoBody( nickName = state.nickName, selfDescription = state.selfDescription, @@ -258,7 +258,7 @@ private fun MatchingDetailContent( modifier = Modifier.padding(horizontal = 20.dp), ) - MatchingDetailState.MatchingDetailPage.ValueTalkState -> + MatchingDetailState.MatchingDetailPage.ValueTalkPage -> ValueTalkBody( nickName = state.nickName, selfDescription = state.selfDescription, @@ -266,7 +266,7 @@ private fun MatchingDetailContent( onMoreClick = onMoreClick, ) - MatchingDetailState.MatchingDetailPage.ValuePickState -> + MatchingDetailState.MatchingDetailPage.ValuePickPage -> ValuePickBody( nickName = state.nickName, selfDescription = state.selfDescription, @@ -290,7 +290,7 @@ private fun MatchingDetailBottomBar( verticalAlignment = Alignment.CenterVertically, modifier = modifier, ) { - if (currentPage == MatchingDetailPage.ValuePickState) { + if (currentPage == MatchingDetailPage.ValuePickPage) { Image( painter = painterResource(id = R.drawable.ic_profile_image), contentDescription = "이전 페이지 버튼", @@ -304,7 +304,7 @@ private fun MatchingDetailBottomBar( Spacer(modifier = Modifier.weight(1f)) - if (currentPage == MatchingDetailPage.BasicInfoState) { + if (currentPage == MatchingDetailPage.BasicInfoPage) { Image( painter = painterResource(id = R.drawable.ic_left_disable), contentDescription = "이전 페이지 버튼", @@ -325,7 +325,7 @@ private fun MatchingDetailBottomBar( Spacer(modifier = Modifier.width(8.dp)) - if (currentPage == MatchingDetailPage.ValuePickState) { + if (currentPage == MatchingDetailPage.ValuePickPage) { PieceRoundingButton( label = stringResource(R.string.valuepick_bottom_bar_label), onClick = onAcceptClick, @@ -366,7 +366,7 @@ private fun MatchingDetailScreenPreview() { private fun BottomNavigationOnBasicInfoStatePreview() { PieceTheme { MatchingDetailBottomBar( - currentPage = MatchingDetailPage.BasicInfoState, + currentPage = MatchingDetailPage.BasicInfoPage, {}, {}, {}, @@ -380,7 +380,7 @@ private fun BottomNavigationOnBasicInfoStatePreview() { private fun BottomNavigationOnValueTalkStatePreview() { PieceTheme { MatchingDetailBottomBar( - currentPage = MatchingDetailPage.ValueTalkState, + currentPage = MatchingDetailPage.ValueTalkPage, {}, {}, {}, @@ -394,7 +394,7 @@ private fun BottomNavigationOnValueTalkStatePreview() { private fun BottomNavigationOnValuePickStatePreview() { PieceTheme { MatchingDetailBottomBar( - currentPage = MatchingDetailPage.ValuePickState, + currentPage = MatchingDetailPage.ValuePickPage, {}, {}, {}, diff --git a/feature/matching/src/main/java/com/puzzle/matching/common/component/BasicInfoHeader.kt b/feature/matching/src/main/java/com/puzzle/matching/graph/detail/common/component/BasicInfoHeader.kt similarity index 96% rename from feature/matching/src/main/java/com/puzzle/matching/common/component/BasicInfoHeader.kt rename to feature/matching/src/main/java/com/puzzle/matching/graph/detail/common/component/BasicInfoHeader.kt index 3bf4034..8a14116 100644 --- a/feature/matching/src/main/java/com/puzzle/matching/common/component/BasicInfoHeader.kt +++ b/feature/matching/src/main/java/com/puzzle/matching/graph/detail/common/component/BasicInfoHeader.kt @@ -1,4 +1,4 @@ -package com.puzzle.matching.common.component +package com.puzzle.matching.graph.detail.common.component import androidx.compose.foundation.Image import androidx.compose.foundation.clickable diff --git a/feature/matching/src/main/java/com/puzzle/matching/common/constant/DialogType.kt b/feature/matching/src/main/java/com/puzzle/matching/graph/detail/common/constant/DialogType.kt similarity index 62% rename from feature/matching/src/main/java/com/puzzle/matching/common/constant/DialogType.kt rename to feature/matching/src/main/java/com/puzzle/matching/graph/detail/common/constant/DialogType.kt index 4e0a114..7584df3 100644 --- a/feature/matching/src/main/java/com/puzzle/matching/common/constant/DialogType.kt +++ b/feature/matching/src/main/java/com/puzzle/matching/graph/detail/common/constant/DialogType.kt @@ -1,4 +1,4 @@ -package com.puzzle.matching.common.constant +package com.puzzle.matching.graph.detail.common.constant enum class DialogType { ACCEPT_MATCHING, diff --git a/feature/matching/src/main/java/com/puzzle/matching/common/ui/BasicInfoBody.kt b/feature/matching/src/main/java/com/puzzle/matching/graph/detail/common/ui/BasicInfoBody.kt similarity index 98% rename from feature/matching/src/main/java/com/puzzle/matching/common/ui/BasicInfoBody.kt rename to feature/matching/src/main/java/com/puzzle/matching/graph/detail/common/ui/BasicInfoBody.kt index 3ef8288..1cb9746 100644 --- a/feature/matching/src/main/java/com/puzzle/matching/common/ui/BasicInfoBody.kt +++ b/feature/matching/src/main/java/com/puzzle/matching/graph/detail/common/ui/BasicInfoBody.kt @@ -1,4 +1,4 @@ -package com.puzzle.matching.common.ui +package com.puzzle.matching.graph.detail.common.ui import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement @@ -21,7 +21,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.puzzle.designsystem.R import com.puzzle.designsystem.foundation.PieceTheme -import com.puzzle.matching.common.component.BasicInfoHeader +import com.puzzle.matching.graph.detail.common.component.BasicInfoHeader @Composable internal fun BasicInfoBody( diff --git a/feature/matching/src/main/java/com/puzzle/matching/common/ui/ValuePickBody.kt b/feature/matching/src/main/java/com/puzzle/matching/graph/detail/common/ui/ValuePickBody.kt similarity index 98% rename from feature/matching/src/main/java/com/puzzle/matching/common/ui/ValuePickBody.kt rename to feature/matching/src/main/java/com/puzzle/matching/graph/detail/common/ui/ValuePickBody.kt index 9e224d6..f3591b2 100644 --- a/feature/matching/src/main/java/com/puzzle/matching/common/ui/ValuePickBody.kt +++ b/feature/matching/src/main/java/com/puzzle/matching/graph/detail/common/ui/ValuePickBody.kt @@ -1,4 +1,4 @@ -package com.puzzle.matching.common.ui +package com.puzzle.matching.graph.detail.common.ui import androidx.compose.foundation.Image import androidx.compose.foundation.background @@ -45,7 +45,7 @@ import com.puzzle.designsystem.R import com.puzzle.designsystem.component.PieceSubButton import com.puzzle.designsystem.foundation.PieceTheme import com.puzzle.domain.model.matching.ValuePick -import com.puzzle.matching.common.component.BasicInfoHeader +import com.puzzle.matching.graph.detail.common.component.BasicInfoHeader @Composable internal fun ValuePickBody( diff --git a/feature/matching/src/main/java/com/puzzle/matching/common/ui/ValueTalkBody.kt b/feature/matching/src/main/java/com/puzzle/matching/graph/detail/common/ui/ValueTalkBody.kt similarity index 98% rename from feature/matching/src/main/java/com/puzzle/matching/common/ui/ValueTalkBody.kt rename to feature/matching/src/main/java/com/puzzle/matching/graph/detail/common/ui/ValueTalkBody.kt index 73c0109..16e1fb7 100644 --- a/feature/matching/src/main/java/com/puzzle/matching/common/ui/ValueTalkBody.kt +++ b/feature/matching/src/main/java/com/puzzle/matching/graph/detail/common/ui/ValueTalkBody.kt @@ -1,4 +1,4 @@ -package com.puzzle.matching.common.ui +package com.puzzle.matching.graph.detail.common.ui import androidx.compose.foundation.Image import androidx.compose.foundation.background @@ -32,7 +32,7 @@ import com.puzzle.common.ui.CollapsingHeaderNestedScrollConnection import com.puzzle.designsystem.R import com.puzzle.designsystem.foundation.PieceTheme import com.puzzle.domain.model.matching.ValueTalk -import com.puzzle.matching.common.component.BasicInfoHeader +import com.puzzle.matching.graph.detail.common.component.BasicInfoHeader @Composable internal fun ValueTalkBody( diff --git a/feature/matching/src/main/java/com/puzzle/matching/graph/detail/contract/MatchingDetailState.kt b/feature/matching/src/main/java/com/puzzle/matching/graph/detail/contract/MatchingDetailState.kt index b8023ee..04ba59a 100644 --- a/feature/matching/src/main/java/com/puzzle/matching/graph/detail/contract/MatchingDetailState.kt +++ b/feature/matching/src/main/java/com/puzzle/matching/graph/detail/contract/MatchingDetailState.kt @@ -6,7 +6,7 @@ import com.puzzle.domain.model.matching.ValueTalk data class MatchingDetailState( val isLoading: Boolean = false, - val currentPage: MatchingDetailPage = MatchingDetailPage.BasicInfoState, + val currentPage: MatchingDetailPage = MatchingDetailPage.BasicInfoPage, // BasicInfoState val selfDescription: String = "", val nickName: String = "", @@ -22,24 +22,24 @@ data class MatchingDetailState( ) : MavericksState { enum class MatchingDetailPage(val title: String) { - BasicInfoState(title = ""), - ValueTalkState(title = "가치관 Talk"), - ValuePickState(title = "가치관 Pick"); + BasicInfoPage(title = ""), + ValueTalkPage(title = "가치관 Talk"), + ValuePickPage(title = "가치관 Pick"); companion object { fun getNextPage(currentPage: MatchingDetailPage): MatchingDetailPage { return when (currentPage) { - BasicInfoState -> ValueTalkState - ValueTalkState -> ValuePickState - ValuePickState -> ValuePickState + BasicInfoPage -> ValueTalkPage + ValueTalkPage -> ValuePickPage + ValuePickPage -> ValuePickPage } } fun getPreviousPage(currentPage: MatchingDetailPage): MatchingDetailPage { return when (currentPage) { - BasicInfoState -> BasicInfoState - ValueTalkState -> BasicInfoState - ValuePickState -> ValueTalkState + BasicInfoPage -> BasicInfoPage + ValueTalkPage -> BasicInfoPage + ValuePickPage -> ValueTalkPage } } } From d0fd7a07ceaefce603603fdf48c91ed3f1bf8e7c Mon Sep 17 00:00:00 2001 From: tgyuuAn Date: Wed, 8 Jan 2025 22:47:20 +0900 Subject: [PATCH 08/11] =?UTF-8?q?[PC-300]=20kotlinXSerialization=20BuildLo?= =?UTF-8?q?gic=20Android=EC=97=90=EC=84=9C=20Feature=EB=A1=9C=20=EC=9D=B4?= =?UTF-8?q?=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/puzzle/build/logic/KotlinAndroid.kt | 1 - .../java/com/puzzle/build/logic/configure/AndroidComposes.kt | 3 ++- core/navigation/build.gradle.kts | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build-logic/src/main/java/com/puzzle/build/logic/KotlinAndroid.kt b/build-logic/src/main/java/com/puzzle/build/logic/KotlinAndroid.kt index 506d6ee..5dd6dfb 100644 --- a/build-logic/src/main/java/com/puzzle/build/logic/KotlinAndroid.kt +++ b/build-logic/src/main/java/com/puzzle/build/logic/KotlinAndroid.kt @@ -9,7 +9,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile internal fun Project.configureKotlinAndroid() { pluginManager.apply("org.jetbrains.kotlin.android") - pluginManager.apply("org.jetbrains.kotlin.plugin.serialization") androidExtension.apply { compileSdk = 35 diff --git a/build-logic/src/main/java/com/puzzle/build/logic/configure/AndroidComposes.kt b/build-logic/src/main/java/com/puzzle/build/logic/configure/AndroidComposes.kt index 722cd11..ca94be3 100644 --- a/build-logic/src/main/java/com/puzzle/build/logic/configure/AndroidComposes.kt +++ b/build-logic/src/main/java/com/puzzle/build/logic/configure/AndroidComposes.kt @@ -8,6 +8,7 @@ import org.gradle.kotlin.dsl.dependencies internal fun Project.configureAndroidCompose() { with(plugins) { apply("org.jetbrains.kotlin.plugin.compose") + apply("org.jetbrains.kotlin.plugin.serialization") } val libs = extensions.libs @@ -28,7 +29,7 @@ internal fun Project.configureAndroidCompose() { add("implementation", libs.findLibrary("androidx.compose.material3").get()) add("implementation", libs.findLibrary("androidx.compose.ui").get()) add("implementation", libs.findLibrary("androidx.compose.ui.tooling.preview").get()) - add("debugImplementation", libs.findLibrary("androidx.compose.ui.tooling").get()) + add("implementation", libs.findLibrary("androidx.compose.ui.tooling").get()) } } } \ No newline at end of file diff --git a/core/navigation/build.gradle.kts b/core/navigation/build.gradle.kts index 7c9fddf..c9e0abc 100644 --- a/core/navigation/build.gradle.kts +++ b/core/navigation/build.gradle.kts @@ -1,5 +1,6 @@ plugins { id("piece.android.library") + alias(libs.plugins.kotlin.serialization) } android { From b57f260be6caca534500aef96d0d545df378ed73 Mon Sep 17 00:00:00 2001 From: tgyuuAn Date: Thu, 9 Jan 2025 00:19:43 +0900 Subject: [PATCH 09/11] =?UTF-8?q?[PC-300]=20LocalDataSource=20getTerms=20-?= =?UTF-8?q?>=20retrieveTerms=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 2 -- .../java/com/puzzle/build/logic/configure/AndroidComposes.kt | 2 +- .../main/java/com/puzzle/data/repository/TermsRepositoryImpl.kt | 2 +- .../java/com/puzzle/database/source/term/LocalTermDataSource.kt | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index f7e7799..58fe4e2 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -21,8 +21,6 @@ android { buildConfigField("String", "KAKAO_APP_KEY", "\"${localProperties["KAKAO_APP_KEY"]}\"") } - packaging { resources { excludes += "/META-INF/*" } } - buildTypes { release { signingConfig = signingConfigs.getByName("debug") diff --git a/build-logic/src/main/java/com/puzzle/build/logic/configure/AndroidComposes.kt b/build-logic/src/main/java/com/puzzle/build/logic/configure/AndroidComposes.kt index ca94be3..37592f4 100644 --- a/build-logic/src/main/java/com/puzzle/build/logic/configure/AndroidComposes.kt +++ b/build-logic/src/main/java/com/puzzle/build/logic/configure/AndroidComposes.kt @@ -29,7 +29,7 @@ internal fun Project.configureAndroidCompose() { add("implementation", libs.findLibrary("androidx.compose.material3").get()) add("implementation", libs.findLibrary("androidx.compose.ui").get()) add("implementation", libs.findLibrary("androidx.compose.ui.tooling.preview").get()) - add("implementation", libs.findLibrary("androidx.compose.ui.tooling").get()) + add("debugImplementation", libs.findLibrary("androidx.compose.ui.tooling").get()) } } } \ No newline at end of file diff --git a/core/data/src/main/java/com/puzzle/data/repository/TermsRepositoryImpl.kt b/core/data/src/main/java/com/puzzle/data/repository/TermsRepositoryImpl.kt index a336c38..d5b2868 100644 --- a/core/data/src/main/java/com/puzzle/data/repository/TermsRepositoryImpl.kt +++ b/core/data/src/main/java/com/puzzle/data/repository/TermsRepositoryImpl.kt @@ -32,7 +32,7 @@ class TermsRepositoryImpl @Inject constructor( } override suspend fun getTerms(): Result> = runCatching { - localTermDataSource.getTerms() + localTermDataSource.retrieveTerms() .map { it.toDomain() } } } diff --git a/core/database/src/main/java/com/puzzle/database/source/term/LocalTermDataSource.kt b/core/database/src/main/java/com/puzzle/database/source/term/LocalTermDataSource.kt index 3c9da99..bd1c8ad 100644 --- a/core/database/src/main/java/com/puzzle/database/source/term/LocalTermDataSource.kt +++ b/core/database/src/main/java/com/puzzle/database/source/term/LocalTermDataSource.kt @@ -9,7 +9,7 @@ import javax.inject.Singleton class LocalTermDataSource @Inject constructor( private val termsDao: TermsDao, ) { - suspend fun getTerms() = termsDao.getTerms() + suspend fun retrieveTerms() = termsDao.getTerms() suspend fun clearAndInsertTerms(terms: List) = termsDao.clearAndInsertTerms(*terms.toTypedArray()) } From 3c5ffa1eed0e10a84b9114b50f5b9f3c1372147a Mon Sep 17 00:00:00 2001 From: tgyuuAn Date: Thu, 9 Jan 2025 00:20:23 +0900 Subject: [PATCH 10/11] =?UTF-8?q?[PC-300]=20Room=20clearAndInsertTemrs=20-?= =?UTF-8?q?>=20replaceTerms=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/puzzle/data/repository/TermsRepositoryImpl.kt | 2 +- .../com/puzzle/data/repository/TermsRepositoryImplTest.kt | 8 ++++---- .../java/com/puzzle/database/dao/TermsDaoTest.kt | 2 +- .../src/main/java/com/puzzle/database/dao/TermsDao.kt | 2 +- .../puzzle/database/source/term/LocalTermDataSource.kt | 3 +-- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/core/data/src/main/java/com/puzzle/data/repository/TermsRepositoryImpl.kt b/core/data/src/main/java/com/puzzle/data/repository/TermsRepositoryImpl.kt index d5b2868..2d9219a 100644 --- a/core/data/src/main/java/com/puzzle/data/repository/TermsRepositoryImpl.kt +++ b/core/data/src/main/java/com/puzzle/data/repository/TermsRepositoryImpl.kt @@ -28,7 +28,7 @@ class TermsRepositoryImpl @Inject constructor( ) } - localTermDataSource.clearAndInsertTerms(termsEntity) + localTermDataSource.replaceTerms(termsEntity) } override suspend fun getTerms(): Result> = runCatching { diff --git a/core/data/src/test/java/com/puzzle/data/repository/TermsRepositoryImplTest.kt b/core/data/src/test/java/com/puzzle/data/repository/TermsRepositoryImplTest.kt index 35d9df3..44bb4b3 100644 --- a/core/data/src/test/java/com/puzzle/data/repository/TermsRepositoryImplTest.kt +++ b/core/data/src/test/java/com/puzzle/data/repository/TermsRepositoryImplTest.kt @@ -48,7 +48,7 @@ class TermsRepositoryImplTest { coEvery { termDataSource.loadTerms() } returns Result.success(LoadTermsResponse(listOf(invalidTerm, validTerm))) - coEvery { localTermDataSource.clearAndInsertTerms(any()) } just Runs + coEvery { localTermDataSource.replaceTerms(any()) } just Runs // when val result = termsRepository.loadTerms() @@ -56,7 +56,7 @@ class TermsRepositoryImplTest { // then assertTrue(result.isSuccess) coVerify(exactly = 1) { - localTermDataSource.clearAndInsertTerms( + localTermDataSource.replaceTerms( match { it.size == 1 && it.first().id == validTerm.termId } @@ -85,14 +85,14 @@ class TermsRepositoryImplTest { ) coEvery { termDataSource.loadTerms() } returns Result.success(LoadTermsResponse(validTerms)) - coEvery { localTermDataSource.clearAndInsertTerms(any()) } just Runs + coEvery { localTermDataSource.replaceTerms(any()) } just Runs // when termsRepository.loadTerms() // then coVerify(exactly = 1) { - localTermDataSource.clearAndInsertTerms( + localTermDataSource.replaceTerms( match { it.size == validTerms.size && it.all { entity -> validTerms.any { term -> diff --git a/core/database/src/androidTest/java/com/puzzle/database/dao/TermsDaoTest.kt b/core/database/src/androidTest/java/com/puzzle/database/dao/TermsDaoTest.kt index 260fb6d..ebbd886 100644 --- a/core/database/src/androidTest/java/com/puzzle/database/dao/TermsDaoTest.kt +++ b/core/database/src/androidTest/java/com/puzzle/database/dao/TermsDaoTest.kt @@ -80,7 +80,7 @@ class TermsDaoTest { val expected = listOf( TermEntity(2, "새로운 약관", "새로운 내용", false, "2024-06-01T00:00:00".parseDateTime()) ) - termsDao.clearAndInsertTerms(*expected.toTypedArray()) + termsDao.replaceTerms(*expected.toTypedArray()) val actual = termsDao.getTerms() // then diff --git a/core/database/src/main/java/com/puzzle/database/dao/TermsDao.kt b/core/database/src/main/java/com/puzzle/database/dao/TermsDao.kt index abed201..42060f6 100644 --- a/core/database/src/main/java/com/puzzle/database/dao/TermsDao.kt +++ b/core/database/src/main/java/com/puzzle/database/dao/TermsDao.kt @@ -19,7 +19,7 @@ interface TermsDao { suspend fun clearTerms() @Transaction - suspend fun clearAndInsertTerms(vararg terms: TermEntity) { + suspend fun replaceTerms(vararg terms: TermEntity) { clearTerms() insertTerms(*terms) } diff --git a/core/database/src/main/java/com/puzzle/database/source/term/LocalTermDataSource.kt b/core/database/src/main/java/com/puzzle/database/source/term/LocalTermDataSource.kt index bd1c8ad..0c6e9d3 100644 --- a/core/database/src/main/java/com/puzzle/database/source/term/LocalTermDataSource.kt +++ b/core/database/src/main/java/com/puzzle/database/source/term/LocalTermDataSource.kt @@ -10,6 +10,5 @@ class LocalTermDataSource @Inject constructor( private val termsDao: TermsDao, ) { suspend fun retrieveTerms() = termsDao.getTerms() - suspend fun clearAndInsertTerms(terms: List) = - termsDao.clearAndInsertTerms(*terms.toTypedArray()) + suspend fun replaceTerms(terms: List) = termsDao.replaceTerms(*terms.toTypedArray()) } From 13c81b1eacc408fdc6e393da87eb33678d6e7420 Mon Sep 17 00:00:00 2001 From: tgyuuAn Date: Thu, 9 Jan 2025 00:55:54 +0900 Subject: [PATCH 11/11] =?UTF-8?q?[PC-300]=20MutableMap=20->=20Map=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../registration/RegistrationViewModel.kt | 20 ++++++++----------- .../contract/RegistrationState.kt | 2 +- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationViewModel.kt b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationViewModel.kt index 276bd88..1192467 100644 --- a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationViewModel.kt +++ b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/RegistrationViewModel.kt @@ -71,25 +71,21 @@ class RegistrationViewModel @AssistedInject constructor( } private fun checkTerm(termId: Int) = setState { - val updatedTermsCheckedInfo = termsCheckedInfo.toMutableMap().apply { - this[termId] = !(this[termId] ?: false) - } + val updatedTermsCheckedInfo = termsCheckedInfo.toMutableMap() + .apply { this[termId] = !(this[termId] ?: false) } + .toMap() copy(termsCheckedInfo = updatedTermsCheckedInfo) } private fun checkAllTerms() = setState { - if (allTermsAgreed) { - copy(termsCheckedInfo = mutableMapOf()) + val updatedTermsCheckedInfo = if (allTermsAgreed) { + emptyMap() } else { - val updatedTermsCheckedInfo = termsCheckedInfo.toMutableMap() - - terms.forEach { termInfo -> - updatedTermsCheckedInfo[termInfo.id] = true - } - - copy(termsCheckedInfo = updatedTermsCheckedInfo) + terms.associate { termInfo -> termInfo.id to true } } + + copy(termsCheckedInfo = updatedTermsCheckedInfo) } @AssistedFactory diff --git a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/contract/RegistrationState.kt b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/contract/RegistrationState.kt index e39d915..ad03a47 100644 --- a/feature/auth/src/main/java/com/puzzle/auth/graph/registration/contract/RegistrationState.kt +++ b/feature/auth/src/main/java/com/puzzle/auth/graph/registration/contract/RegistrationState.kt @@ -5,7 +5,7 @@ import com.puzzle.domain.model.terms.Term data class RegistrationState( val terms: List = emptyList(), - val termsCheckedInfo: MutableMap = mutableMapOf(), + val termsCheckedInfo: Map = emptyMap(), ) : MavericksState { val allTermsAgreed = terms.all { termsCheckedInfo.getOrDefault(it.id, false) }