From bd1d1cac42908182d86db1cd7d2cf9d6822b763a Mon Sep 17 00:00:00 2001 From: easyhz Date: Tue, 27 Aug 2024 15:21:04 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=20?= =?UTF-8?q?=ED=99=94=EB=A9=B4=20bottomSheet=20=EC=B6=94=EA=B0=80=20(#159)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/assets/marketing.html | 687 ++++++++++++++++++ .../component/terms/TermsView.kt | 22 +- .../core/design_system/util/terms/TermType.kt | 3 + .../src/main/res/values/terms.xml | 3 + .../creation/promotion/PromotionScreen.kt | 2 +- .../signUp/TermsDetailBottomSheet.kt | 70 ++ .../sign/component/signUp/TermsView.kt | 3 +- .../sign/contract/signUp/SignUpIntent.kt | 4 +- .../sign/contract/signUp/SignUpSideEffect.kt | 1 + .../sign/contract/signUp/SignUpState.kt | 8 +- .../sign/screen/signUp/SignUpScreen.kt | 33 +- .../sign/screen/signUp/SignUpViewModel.kt | 19 +- 12 files changed, 841 insertions(+), 14 deletions(-) create mode 100644 core/design-system/src/main/assets/marketing.html create mode 100644 feature/sign/src/main/java/com/easyhz/noffice/feature/sign/component/signUp/TermsDetailBottomSheet.kt diff --git a/core/design-system/src/main/assets/marketing.html b/core/design-system/src/main/assets/marketing.html new file mode 100644 index 00000000..bcd90b48 --- /dev/null +++ b/core/design-system/src/main/assets/marketing.html @@ -0,0 +1,687 @@ +마케팅 수신 이용 동의

마케팅 수신 이용 동의

사용자는 개인(신용)정보의 선택적인 수집∙이용, 제공에 대한 동의를 거부할 수 있습니다. 다만, 동의하지 않을 경우 관련 편의제공(이벤트 안내, 공지사항, 할인행사)안내 등 이용 목적에 따른 혜택에 제한이 있을 수 있습니다.

그 밖에 계약과 관련된 불이익은 없습니다. 동의한 경우에도 귀하는 동의를 철회하거나 마케팅 목적으로 귀하에게 연락하는 것을 중지하도록 요청할 수 있습니다.

1. 수집 및 이용목적

고객에 대한 편의제공, 노피스 및 제휴업체의 상품·서비스 안내, 사은·판촉행사 등의 마케팅 활동, 시장조사 및 상품·서비스 개발연구 등을 목적으로 수집·이용

2. 수집 및 이용항목

  • 개인식별정보: 성명, 성별, 나이, 전화번호, e-mail 등
  • 고객 ID, 접속 일시, IP주소 등

3. 보유기간

동의일로부터 회원 탈퇴 혹은 마케팅 동의 해제 시까지 보유·이용

\ No newline at end of file diff --git a/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/terms/TermsView.kt b/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/terms/TermsView.kt index 26605fce..d7079884 100644 --- a/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/terms/TermsView.kt +++ b/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/component/terms/TermsView.kt @@ -1,8 +1,12 @@ package com.easyhz.noffice.core.design_system.component.terms +import android.view.ViewGroup +import android.webkit.WebChromeClient +import android.webkit.WebSettings import android.webkit.WebView import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.viewinterop.AndroidView @Composable @@ -10,12 +14,24 @@ fun TermsView( modifier: Modifier = Modifier, fileName: String ) { + val context = LocalContext.current AndroidView( modifier = modifier, - factory = { ctx -> - WebView(ctx).apply { - loadUrl("file:///android_asset/${fileName}") + factory = { _ -> + WebView(context).apply { + layoutParams = ViewGroup.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT + ) + settings.apply { + cacheMode = WebSettings.LOAD_DEFAULT + textZoom = 100 + } + webChromeClient = WebChromeClient() } + }, + update = { + it.loadUrl("file:///android_asset/${fileName}") } ) } diff --git a/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/util/terms/TermType.kt b/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/util/terms/TermType.kt index a32fdcac..cc917b8b 100644 --- a/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/util/terms/TermType.kt +++ b/core/design-system/src/main/java/com/easyhz/noffice/core/design_system/util/terms/TermType.kt @@ -14,5 +14,8 @@ enum class TermsType( PRIVACY_POLICY( title = R.string.privacy_policy_title, fileName = "privacy_policy.html" + ),MARKETING( + title = R.string.marketing, + fileName = "marketing.html" ), } \ No newline at end of file diff --git a/core/design-system/src/main/res/values/terms.xml b/core/design-system/src/main/res/values/terms.xml index 06bc4f62..00defe60 100644 --- a/core/design-system/src/main/res/values/terms.xml +++ b/core/design-system/src/main/res/values/terms.xml @@ -6,4 +6,7 @@ 개인정보 처리방침 + + 마켓팅 수신 동의 + \ No newline at end of file diff --git a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/creation/promotion/PromotionScreen.kt b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/creation/promotion/PromotionScreen.kt index ee275ebd..bc9d6877 100644 --- a/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/creation/promotion/PromotionScreen.kt +++ b/feature/announcement/src/main/java/com/easyhz/noffice/feature/announcement/screen/creation/promotion/PromotionScreen.kt @@ -175,7 +175,7 @@ fun PromotionScreen( } if(uiState.isShowPromotionBottomSheet) { PromotionBottomSheet( - sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true), + sheetState = sheetState, selectedCard = uiState.bottomSheetSelectCardIndex, coverImages = uiState.coverList, hasPromotion = uiState.hasPromotion, diff --git a/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/component/signUp/TermsDetailBottomSheet.kt b/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/component/signUp/TermsDetailBottomSheet.kt new file mode 100644 index 00000000..77064e90 --- /dev/null +++ b/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/component/signUp/TermsDetailBottomSheet.kt @@ -0,0 +1,70 @@ +package com.easyhz.noffice.feature.sign.component.signUp + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.SheetState +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import com.easyhz.noffice.core.design_system.R +import com.easyhz.noffice.core.design_system.component.bottomSheet.BottomSheet +import com.easyhz.noffice.core.design_system.component.topBar.DetailTopBar +import com.easyhz.noffice.core.design_system.theme.Grey400 +import com.easyhz.noffice.core.design_system.theme.Grey50 +import com.easyhz.noffice.core.design_system.theme.White +import com.easyhz.noffice.core.design_system.util.terms.TermsType +import com.easyhz.noffice.core.design_system.util.topBar.DetailTopBarMenu + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +internal fun TermsDetailBottomSheet( + sheetState: SheetState, + termsType: TermsType, + onDismissRequest: () -> Unit, +) { + val scrollState = rememberScrollState() + BottomSheet( + sheetState = sheetState, + shape = RoundedCornerShape(topStart = 24.dp, topEnd = 24.dp), + containerColor = White, + onDismissRequest = onDismissRequest, + dragHandle = { + DetailTopBar( + modifier = Modifier.background(Grey50), + title = stringResource(id =termsType.title), + trailingItem = DetailTopBarMenu( + content = { + Icon( + modifier = Modifier.size(24.dp), + painter = painterResource(id = R.drawable.ic_x), + contentDescription = "left", + tint = Grey400 + ) + }, + onClick = onDismissRequest + ), + ) + } + ) { + Box(modifier = Modifier.fillMaxHeight(0.9f)) { + Column( + modifier = Modifier.verticalScroll(scrollState) + ) { + com.easyhz.noffice.core.design_system.component.terms.TermsView( + modifier = Modifier, + fileName = termsType.fileName + ) + } + } + } +} \ No newline at end of file diff --git a/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/component/signUp/TermsView.kt b/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/component/signUp/TermsView.kt index 48e8c7d0..6ea239b5 100644 --- a/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/component/signUp/TermsView.kt +++ b/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/component/signUp/TermsView.kt @@ -2,6 +2,7 @@ package com.easyhz.noffice.feature.sign.component.signUp import androidx.compose.animation.Crossfade import androidx.compose.foundation.Image +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -195,7 +196,7 @@ private fun TermsItem( } } Row( - modifier = Modifier.noRippleClickable { onClickDetail() }, + modifier = Modifier.clickable { onClickDetail() }, verticalAlignment = Alignment.CenterVertically ) { Text( diff --git a/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/contract/signUp/SignUpIntent.kt b/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/contract/signUp/SignUpIntent.kt index 8cf8f990..ae233408 100644 --- a/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/contract/signUp/SignUpIntent.kt +++ b/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/contract/signUp/SignUpIntent.kt @@ -1,6 +1,5 @@ package com.easyhz.noffice.feature.sign.contract.signUp -import androidx.compose.ui.text.input.TextFieldValue import com.easyhz.noffice.core.common.base.UiIntent import com.easyhz.noffice.feature.sign.util.signUp.Terms @@ -13,4 +12,7 @@ sealed class SignUpIntent: UiIntent() { data class ClickTermsDetail(val terms: Terms): SignUpIntent() data class ChangeNameTextValue(val text: String): SignUpIntent() data object ClearFocus: SignUpIntent() + data object HideTermsBottomSheet: SignUpIntent() + data class SetTermsBottomSheet(val isShow: Boolean): SignUpIntent() + } \ No newline at end of file diff --git a/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/contract/signUp/SignUpSideEffect.kt b/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/contract/signUp/SignUpSideEffect.kt index 10df5ed6..e67fef81 100644 --- a/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/contract/signUp/SignUpSideEffect.kt +++ b/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/contract/signUp/SignUpSideEffect.kt @@ -5,4 +5,5 @@ import com.easyhz.noffice.core.common.base.UiSideEffect sealed class SignUpSideEffect: UiSideEffect() { data object ClearFocus: SignUpSideEffect() data object NavigateToHome: SignUpSideEffect() + data object HideTermsBottomSheet: SignUpSideEffect() } \ No newline at end of file diff --git a/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/contract/signUp/SignUpState.kt b/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/contract/signUp/SignUpState.kt index 631ed6ad..44fb1a01 100644 --- a/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/contract/signUp/SignUpState.kt +++ b/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/contract/signUp/SignUpState.kt @@ -1,11 +1,11 @@ package com.easyhz.noffice.feature.sign.contract.signUp -import androidx.compose.ui.text.input.TextFieldValue import com.easyhz.noffice.core.common.base.UiState import com.easyhz.noffice.core.common.extension.toEnumMap import com.easyhz.noffice.core.common.util.Step import com.easyhz.noffice.core.common.util.toEnabledStepButton import com.easyhz.noffice.core.common.util.updateStepButton +import com.easyhz.noffice.core.design_system.util.terms.TermsType import com.easyhz.noffice.feature.sign.util.signUp.SignUpStep import com.easyhz.noffice.feature.sign.util.signUp.Terms import com.easyhz.noffice.feature.sign.util.signUp.toTermsMap @@ -17,6 +17,8 @@ data class SignUpState( val isCheckedAllTerms: Boolean, val termsStatusMap: EnumMap, val name: String, + val isShowTermsBottomSheet: Boolean, + val selectedTerms: TermsType ) : UiState() { companion object { fun init() = SignUpState( @@ -24,7 +26,9 @@ data class SignUpState( enabledStepButton = SignUpStep.entries.toEnabledStepButton(), isCheckedAllTerms = false, termsStatusMap = Terms.entries.toTermsMap(), - name = "" + name = "", + isShowTermsBottomSheet = false, + selectedTerms = TermsType.SERVICE_OF_TERMS ) } diff --git a/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/screen/signUp/SignUpScreen.kt b/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/screen/signUp/SignUpScreen.kt index 5a156b6d..86681867 100644 --- a/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/screen/signUp/SignUpScreen.kt +++ b/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/screen/signUp/SignUpScreen.kt @@ -11,7 +11,9 @@ import androidx.compose.animation.togetherWith import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size +import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon +import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier @@ -29,11 +31,13 @@ import com.easyhz.noffice.core.design_system.theme.Grey400 import com.easyhz.noffice.core.design_system.theme.White import com.easyhz.noffice.core.design_system.util.topBar.DetailTopBarMenu import com.easyhz.noffice.feature.sign.component.signUp.NameView +import com.easyhz.noffice.feature.sign.component.signUp.TermsDetailBottomSheet import com.easyhz.noffice.feature.sign.component.signUp.TermsView import com.easyhz.noffice.feature.sign.contract.signUp.SignUpIntent import com.easyhz.noffice.feature.sign.contract.signUp.SignUpSideEffect import com.easyhz.noffice.feature.sign.util.signUp.SignUpStep +@OptIn(ExperimentalMaterial3Api::class) @Composable fun SignUpScreen( viewModel: SignUpViewModel = hiltViewModel(), @@ -41,6 +45,7 @@ fun SignUpScreen( ) { val uiState by viewModel.uiState.collectAsStateWithLifecycle() val focusManager = LocalFocusManager.current + val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) BackHandler(onBack = { viewModel.postIntent(SignUpIntent.ClickBackButton) @@ -81,21 +86,39 @@ fun SignUpScreen( }.using(SizeTransform(clip = false)) }, label = "signUpFlow" ) { targetScreen -> - when(targetScreen) { + when (targetScreen) { SignUpStep.TERMS -> { TermsView(modifier = Modifier.screenHorizonPadding()) } + SignUpStep.NAME -> { NameView(modifier = Modifier.screenHorizonPadding()) } } } + + if (uiState.isShowTermsBottomSheet) { + TermsDetailBottomSheet( + sheetState = sheetState, + termsType = uiState.selectedTerms + ) { viewModel.postIntent(SignUpIntent.HideTermsBottomSheet) } + } } - viewModel.sideEffect.collectInSideEffectWithLifecycle {sideEffect -> - when(sideEffect) { - is SignUpSideEffect.ClearFocus -> { focusManager.clearFocus() } - is SignUpSideEffect.NavigateToHome -> { navigateToHome() } + viewModel.sideEffect.collectInSideEffectWithLifecycle { sideEffect -> + when (sideEffect) { + is SignUpSideEffect.ClearFocus -> { + focusManager.clearFocus() + } + + is SignUpSideEffect.NavigateToHome -> { + navigateToHome() + } + + is SignUpSideEffect.HideTermsBottomSheet -> { + sheetState.hide() + viewModel.postIntent(SignUpIntent.SetTermsBottomSheet(false)) + } } } } \ No newline at end of file diff --git a/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/screen/signUp/SignUpViewModel.kt b/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/screen/signUp/SignUpViewModel.kt index 41c18ce7..0d043643 100644 --- a/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/screen/signUp/SignUpViewModel.kt +++ b/feature/sign/src/main/java/com/easyhz/noffice/feature/sign/screen/signUp/SignUpViewModel.kt @@ -2,6 +2,7 @@ package com.easyhz.noffice.feature.sign.screen.signUp import com.easyhz.noffice.core.common.base.BaseViewModel import com.easyhz.noffice.core.common.util.updateStepButton +import com.easyhz.noffice.core.design_system.util.terms.TermsType import com.easyhz.noffice.feature.sign.contract.signUp.SignUpIntent import com.easyhz.noffice.feature.sign.contract.signUp.SignUpSideEffect import com.easyhz.noffice.feature.sign.contract.signUp.SignUpState @@ -21,9 +22,11 @@ class SignUpViewModel @Inject constructor( is SignUpIntent.ClickNextButton -> { onClickNextButton() } is SignUpIntent.ClickTermsAllCheck -> { onClickTermsAllCheck() } is SignUpIntent.ClickTermsCheck -> { onClickTermsCheck(intent.terms) } - is SignUpIntent.ClickTermsDetail -> { /* TODO */ } + is SignUpIntent.ClickTermsDetail -> { onClickTermsDetail(intent.terms) } is SignUpIntent.ChangeNameTextValue -> { onChangeNameTextValue(intent.text) } is SignUpIntent.ClearFocus -> { onClearFocus() } + is SignUpIntent.HideTermsBottomSheet -> { hideBottomSheet() } + is SignUpIntent.SetTermsBottomSheet -> { setBottomSheet(intent.isShow) } } } @@ -58,4 +61,18 @@ class SignUpViewModel @Inject constructor( private fun onClearFocus() { postSideEffect { SignUpSideEffect.ClearFocus } } + + private fun onClickTermsDetail(terms: Terms) { + val termsType = TermsType.valueOf(terms.name) + reduce { copy(selectedTerms = termsType) } + setBottomSheet(true) + } + + private fun setBottomSheet(isShow: Boolean) { + reduce { copy(isShowTermsBottomSheet = isShow) } + } + + private fun hideBottomSheet() { + postSideEffect { SignUpSideEffect.HideTermsBottomSheet } + } } \ No newline at end of file