Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UI/YAF-67] 온보딩 접근권한 설정 UI를 구현합니다. #38

Merged
merged 6 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package com.kms.onboarding

import androidx.compose.foundation.Image
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.wrapContentSize
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
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.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import com.yapp.designsystem.theme.OrbitTheme
import com.yapp.ui.utils.heightForScreenPercentage
import feature.onboarding.R

@Composable
fun OnboardingAccessScreen(
state: OnboardingContract.State,
currentStep: Int,
totalSteps: Int,
onNextClick: () -> Unit,
onBackClick: () -> Unit,
) {
// TODO: 추후 실제 시스템 알림 Alert 에서 선택한 값에 따른 변경
val isToggled = remember { mutableStateOf(false) }
OnboardingScreen(
currentStep = currentStep,
totalSteps = totalSteps,
isButtonEnabled = true,
onNextClick = {
isToggled.value = !isToggled.value
},
onBackClick = onBackClick,
) {
val (text, imageRes) = when (isToggled.value) {
true -> Pair(
stringResource(id = R.string.onboarding_step7_text_refuse_title),
core.designsystem.R.drawable.ic_onboarding_authorization_refusal,
)

false -> Pair(
stringResource(id = R.string.onboarding_step7_text_default_title),
core.designsystem.R.drawable.ic_onboarding_authorization_guide,
)
}

Column(
modifier = Modifier.fillMaxSize(),
) {
Spacer(modifier = Modifier.heightForScreenPercentage(0.05f))

Text(
text = text,
style = OrbitTheme.typography.heading1SemiBold,
color = OrbitTheme.colors.white,
modifier = Modifier.fillMaxWidth(),
textAlign = TextAlign.Center,
)

Spacer(modifier = Modifier.heightForScreenPercentage(0.123f))

Image(
painter = painterResource(id = imageRes),
contentDescription = null,
modifier = Modifier
.wrapContentSize()
.align(Alignment.CenterHorizontally),
)
}
}
}

@Composable
@Preview
fun OnboardingAccessScreenPreview() {
OnboardingAccessScreen(
state = OnboardingContract.State(),
currentStep = 1,
totalSteps = 5,
onNextClick = {},
onBackClick = {},
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ fun OnboardingGenderScreen(
UserInfoBottomSheet(
isSheetOpen = state.isBottomSheetOpen,
onDismissRequest = { toggleBottomSheet() },
onNextClick = onNextClick,
name = "오르비",
gender = "남성",
birthDate = "1999년 7월 8일",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ fun UserInfoBottomSheet(
sheetState: SheetState = rememberModalBottomSheetState(),
isSheetOpen: Boolean,
onDismissRequest: () -> Unit,
onNextClick: () -> Unit,
name: String,
gender: String,
birthDate: String,
Expand Down Expand Up @@ -90,7 +91,7 @@ fun UserInfoBottomSheet(
OrbitButton(
label = stringResource(R.string.onboarding_step6_bs_btn_confirm),
modifier = Modifier.weight(1f),
onClick = onDismissRequest,
onClick = onNextClick,
enabled = true,
pressedContainerColor = OrbitTheme.colors.main.copy(alpha = 0.8f),
pressedContentColor = OrbitTheme.colors.gray_600,
Expand Down Expand Up @@ -135,6 +136,7 @@ fun UserInfoBottomSheetPreview() {
UserInfoBottomSheet(
isSheetOpen = true,
onDismissRequest = { },
onNextClick = { },
name = "홍길동",
gender = "남성",
birthDate = "1990년 1월 1일",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ sealed class OnboardingDestination(val route: String) {
data object TimeOfBirth : OnboardingDestination(Routes.TIME_OF_BIRTH)
data object Name : OnboardingDestination(Routes.NAME)
data object Gender : OnboardingDestination(Routes.GENDER)
data object Access : OnboardingDestination(Routes.ACCESS)

companion object {
private val routes = listOf(Explain, AlarmTimeSelection, Birthday, TimeOfBirth, Name, Gender)
private val routes = listOf(Explain, AlarmTimeSelection, Birthday, TimeOfBirth, Name, Gender, Access)

fun nextRoute(currentStep: Int): String? {
return routes.getOrNull(currentStep)?.route
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.kms.onboarding.navigation
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.kms.onboarding.OnboardingAccessScreen
import com.kms.onboarding.OnboardingAlarmTimeSelectionScreen
import com.kms.onboarding.OnboardingBirthdayScreen
import com.kms.onboarding.OnboardingContract
Expand All @@ -29,7 +30,7 @@ fun NavGraphBuilder.onboardingNavGraph(
OnboardingAlarmTimeSelectionScreen(
state = stateProvider(),
currentStep = 1,
totalSteps = 5,
totalSteps = 6,
onNextClick = {
eventDispatcher(OnboardingContract.Action.NextStep)
},
Expand All @@ -43,7 +44,7 @@ fun NavGraphBuilder.onboardingNavGraph(
OnboardingBirthdayScreen(
state = stateProvider(),
currentStep = 2,
totalSteps = 5,
totalSteps = 6,
onNextClick = {
eventDispatcher(OnboardingContract.Action.NextStep)
},
Expand All @@ -58,7 +59,7 @@ fun NavGraphBuilder.onboardingNavGraph(
OnboardingTimeOfBirthScreen(
state = stateProvider(),
currentStep = 3,
totalSteps = 5,
totalSteps = 6,
onNextClick = {
eventDispatcher(OnboardingContract.Action.NextStep)
eventDispatcher(OnboardingContract.Action.Reset)
Expand All @@ -76,7 +77,7 @@ fun NavGraphBuilder.onboardingNavGraph(
OnboardingNameScreen(
state = stateProvider(),
currentStep = 4,
totalSteps = 5,
totalSteps = 6,
onNextClick = {
eventDispatcher(OnboardingContract.Action.NextStep)
},
Expand All @@ -92,8 +93,9 @@ fun NavGraphBuilder.onboardingNavGraph(
OnboardingGenderScreen(
state = stateProvider(),
currentStep = 5,
totalSteps = 5,
totalSteps = 6,
onNextClick = {
eventDispatcher(OnboardingContract.Action.NextStep)
},
onBackClick = {
eventDispatcher(OnboardingContract.Action.PreviousStep)
Expand All @@ -106,4 +108,15 @@ fun NavGraphBuilder.onboardingNavGraph(
},
)
}
composable(OnboardingDestination.Access.route) {
OnboardingAccessScreen(
state = stateProvider(),
currentStep = 6,
totalSteps = 6,
onNextClick = {},
onBackClick = {
eventDispatcher(OnboardingContract.Action.PreviousStep)
},
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ object Routes {
const val TIME_OF_BIRTH = "onboarding_time_of_birth"
const val NAME = "onboarding_name"
const val GENDER = "onboarding_gender"
const val ACCESS = "onboarding_access"
}
11 changes: 2 additions & 9 deletions feature/onboarding/src/main/res/values/values.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@
<string name="onboarding_step6_bs_btn_confirm">맞아요</string>
<string name="onboarding_step6_bs_btn_dismiss">아니에요</string>

<string name="onboarding_step7_text_title">알람을 받으려면 꼭 필요해요\n다음 화면에서 ‘허용’을 눌러주세요</string>
<string name="onboarding_step7_alert_title">‘오르비’에서 알림을 보내고자 합니다</string>
<string name="onboarding_step7_alert_message">알림 기능이 꺼져있으면\n알람이 울릴 때 확인에 어려움이 있어요</string>
<string name="onboarding_step7_alert_btn_confirm">허용</string>
<string name="onboarding_step7_alert_btn_dismiss">허용안함</string>


<!--<string name="onboarding_text_bottom_subtitle">서비스 시작 시 이용약관 및 개인정보처리방침에 동의하게 됩니다.</string>-->

<string name="onboarding_step7_text_default_title">알람을 받으려면 꼭 필요해요\n다음 화면에서 ‘허용’을 눌러주세요</string>
<string name="onboarding_step7_text_refuse_title">알람을 허용하지 않으면\n알림이 울리지 못해요</string>
</resources>
Loading