From 974849ee10beb6c4b248d643be5f8b8b1eac2877 Mon Sep 17 00:00:00 2001 From: ows3090 Date: Thu, 21 Mar 2024 02:53:27 +0900 Subject: [PATCH] =?UTF-8?q?[UI]=20#59=20=EB=AA=A8=EC=95=84=20=EC=95=BD?= =?UTF-8?q?=EA=B4=80=20=EC=83=81=EC=84=B8=20=EC=9B=B9=EB=B7=B0=20=ED=99=94?= =?UTF-8?q?=EB=A9=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/res/values/strings.xml | 2 + .../buddycon/navigation/BuddyConNavHost.kt | 2 +- feature/startup/build.gradle | 1 + .../buddycon/startup/signup/SignUpScreen.kt | 66 +++++++++++++++---- gradle/libs.versions.toml | 1 + 5 files changed, 60 insertions(+), 12 deletions(-) diff --git a/core/designsystem/src/main/res/values/strings.xml b/core/designsystem/src/main/res/values/strings.xml index 7a5f9618..35283167 100644 --- a/core/designsystem/src/main/res/values/strings.xml +++ b/core/designsystem/src/main/res/values/strings.xml @@ -25,6 +25,8 @@ 건너뛰기 다음 시작하기 + 모아 이용약관 + 개인정보 처리방침 알림 diff --git a/core/navigation/src/main/java/com/yapp/buddycon/navigation/BuddyConNavHost.kt b/core/navigation/src/main/java/com/yapp/buddycon/navigation/BuddyConNavHost.kt index b2f1437c..3d52d944 100644 --- a/core/navigation/src/main/java/com/yapp/buddycon/navigation/BuddyConNavHost.kt +++ b/core/navigation/src/main/java/com/yapp/buddycon/navigation/BuddyConNavHost.kt @@ -75,7 +75,7 @@ fun BuddyConNavHost( composable(route = StartUpDestination.Login.route) { LoginScreen { - navHostController.navigate(GifticonDestination.Gifticon.route) + navHostController.navigate(StartUpDestination.SignUp.route) } } diff --git a/feature/startup/build.gradle b/feature/startup/build.gradle index d88c5698..a9a706ab 100644 --- a/feature/startup/build.gradle +++ b/feature/startup/build.gradle @@ -48,6 +48,7 @@ dependencies { implementation project(":domain") implementation libs.accompanist.systemuicontroller implementation libs.accompanist.pager + implementation libs.accompanist.webview implementation libs.accompanist.pager.indicators implementation libs.hilt.android kapt libs.hilt.compiler diff --git a/feature/startup/src/main/java/com/yapp/buddycon/startup/signup/SignUpScreen.kt b/feature/startup/src/main/java/com/yapp/buddycon/startup/signup/SignUpScreen.kt index d4efd055..9fc34f40 100644 --- a/feature/startup/src/main/java/com/yapp/buddycon/startup/signup/SignUpScreen.kt +++ b/feature/startup/src/main/java/com/yapp/buddycon/startup/signup/SignUpScreen.kt @@ -1,5 +1,6 @@ package com.yapp.buddycon.startup.signup +import androidx.activity.compose.BackHandler import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column @@ -23,6 +24,8 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp +import com.google.accompanist.web.WebView +import com.google.accompanist.web.rememberWebViewState import com.yapp.buddycon.designsystem.R import com.yapp.buddycon.designsystem.component.appbar.TopAppBarWithBack import com.yapp.buddycon.designsystem.component.button.BuddyConButton @@ -32,32 +35,71 @@ import com.yapp.buddycon.designsystem.theme.Grey40 import com.yapp.buddycon.designsystem.theme.Grey60 import com.yapp.buddycon.designsystem.theme.Paddings +private const val DEFAULT_TERMS_URL = "" +private const val SERVICE_TERMS_URL = "https://scarce-cartoon-27d.notion.site/e09da35361e142b7936c12e38396475e" +private const val PRIVACY_INFORMATION_TERMS_URL = "https://scarce-cartoon-27d.notion.site/c4e5ff54f9bd434e971a2631d122252c" + @Composable fun SignUpScreen( onNavigateToWelcome: () -> Unit = {}, onBack: () -> Unit ) { + var webUrl by remember { mutableStateOf(DEFAULT_TERMS_URL) } + val webViewState = rememberWebViewState(url = webUrl) Scaffold( topBar = { TopAppBarWithBack( - title = stringResource(R.string.signup), - onBack = onBack + title = when (webUrl) { + SERVICE_TERMS_URL -> stringResource(R.string.startup_use_information_terms) + PRIVACY_INFORMATION_TERMS_URL -> stringResource(R.string.startup_privacy_information_terms) + else -> stringResource(R.string.signup) + }, + onBack = { + if (webUrl == DEFAULT_TERMS_URL) { + onBack() + } else { + webUrl = DEFAULT_TERMS_URL + } + } ) } ) { paddingValues -> - SignUpContent( - modifier = Modifier - .padding(paddingValues) - .fillMaxSize() - .background(BuddyConTheme.colors.background), - onNavigateToWelcome = onNavigateToWelcome - ) + if (webUrl != DEFAULT_TERMS_URL) { + WebView( + state = webViewState, + modifier = Modifier.fillMaxSize(), + onCreated = { + it.settings.javaScriptEnabled = true + it.settings.domStorageEnabled = true + } + ) + } else { + SignUpContent( + modifier = Modifier + .padding(paddingValues) + .fillMaxSize() + .background(BuddyConTheme.colors.background), + onLoadUseInformationTerms = { webUrl = SERVICE_TERMS_URL }, + onLoadPrivacyInformationTerms = { webUrl = PRIVACY_INFORMATION_TERMS_URL }, + onNavigateToWelcome = onNavigateToWelcome + ) + } + } + + BackHandler { + if (webUrl == DEFAULT_TERMS_URL) { + onBack() + } else { + webUrl = DEFAULT_TERMS_URL + } } } @Composable private fun SignUpContent( modifier: Modifier = Modifier, + onLoadUseInformationTerms: () -> Unit = {}, + onLoadPrivacyInformationTerms: () -> Unit = {}, onNavigateToWelcome: () -> Unit = {}, ) { var signUpTermsState by remember { mutableStateOf(SignUpTermsState()) } @@ -92,7 +134,8 @@ private fun SignUpContent( isChecked = signUpTermsState.termsOfUse, text = stringResource(R.string.signup_terms_of_use_agree), hasMore = true, - onCheck = { signUpTermsState = signUpTermsState.copy(termsOfUse = it) } + onCheck = { signUpTermsState = signUpTermsState.copy(termsOfUse = it) }, + onClickHasMore = { onLoadUseInformationTerms() } ) SignUpTermsContent( modifier = Modifier @@ -101,7 +144,8 @@ private fun SignUpContent( isChecked = signUpTermsState.privacyPolicy, text = stringResource(R.string.signup_privacy_policy_agree), hasMore = true, - onCheck = { signUpTermsState = signUpTermsState.copy(privacyPolicy = it) } + onCheck = { signUpTermsState = signUpTermsState.copy(privacyPolicy = it) }, + onClickHasMore = { onLoadPrivacyInformationTerms() } ) Spacer(Modifier.weight(1f)) BuddyConButton( diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 556f8427..d455a25b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -85,6 +85,7 @@ timber = { group = "com.jakewharton.timber", name = "timber", version.ref = "tim accompanist-systemuicontroller = { group = "com.google.accompanist", name = "accompanist-systemuicontroller", version.ref = "accompanist-compose" } accompanist-pager = { group = "com.google.accompanist", name = "accompanist-pager", version.ref = "accompanist-compose" } accompanist-pager-indicators = { group = "com.google.accompanist", name = "accompanist-pager-indicators", version.ref = "accompanist-compose" } +accompanist-webview = { group = "com.google.accompanist", name = "accompanist-webview", version.ref = "accompanist-compose" } ## 3rd library coil-compose = { group = "io.coil-kt", name = "coil-compose", version.ref = "coil-compose" }