Skip to content
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
22 changes: 22 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_google_logo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="28dp"
android:height="28dp"
android:viewportWidth="28"
android:viewportHeight="28">
<path
android:pathData="M23.6,14.227C23.6,13.518 23.536,12.836 23.418,12.182H14V16.05H19.382C19.15,17.3 18.445,18.359 17.386,19.068V21.577H20.618C22.509,19.836 23.6,17.273 23.6,14.227Z"
android:fillColor="#4285F4"
android:fillType="evenOdd"/>
<path
android:pathData="M14,24C16.7,24 18.963,23.104 20.618,21.577L17.386,19.068C16.491,19.668 15.345,20.023 14,20.023C11.395,20.023 9.191,18.264 8.404,15.9H5.063V18.491C6.709,21.759 10.091,24 14,24Z"
android:fillColor="#34A853"
android:fillType="evenOdd"/>
<path
android:pathData="M8.405,15.9C8.205,15.3 8.091,14.659 8.091,14C8.091,13.341 8.205,12.7 8.405,12.1V9.509H5.064C4.386,10.859 4,12.386 4,14C4,15.614 4.386,17.141 5.064,18.491L8.405,15.9Z"
android:fillColor="#FBBC05"
android:fillType="evenOdd"/>
<path
android:pathData="M14,7.977C15.468,7.977 16.786,8.482 17.823,9.473L20.691,6.605C18.959,4.991 16.695,4 14,4C10.091,4 6.709,6.241 5.063,9.509L8.404,12.1C9.191,9.736 11.395,7.977 14,7.977Z"
android:fillColor="#EA4335"
android:fillType="evenOdd"/>
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ data class PatchUserInfoRequestDto(
@SerialName("selectedTownId")
val selectedTownId: Long,

@SerialName("favoriteTownIdList")
val favoriteTownIdList: List<Long>,

@SerialName("persona")
val persona: String,

@SerialName("nickname")
val nickname: String
val nickname: String,

@SerialName("policyAgreementInfos")
val policyAgreementInfos: List<PolicyAgreementInfoDto>
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.teamsolply.solply.onboarding.dto.request

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class PolicyAgreementInfoDto(
@SerialName("policyId")
val policyId: Long,

@SerialName("isAgree")
val isAgree: Boolean
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ data class TownDto(
val townId: Long,
@SerialName("townName")
val townName: String,
@SerialName("parentTownId")
val parentTownId: Long? = null,
@SerialName("subTowns")
val subTowns: List<TownDto>? = null
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.teamsolply.solply.onboarding.mapper

import com.teamsolply.solply.onboarding.dto.request.PolicyAgreementInfoDto
import com.teamsolply.solply.onboarding.model.PolicyAgreementInfoEntity

fun PolicyAgreementInfoEntity.toDto(): PolicyAgreementInfoDto =
PolicyAgreementInfoDto(
policyId = this.policyId,
isAgree = this.isAgree
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,44 @@ package com.teamsolply.solply.onboarding.mapper

import com.teamsolply.solply.onboarding.dto.response.GetAllTownResponseDto
import com.teamsolply.solply.onboarding.dto.response.TownDto
import com.teamsolply.solply.onboarding.model.ParentTownEntity
import com.teamsolply.solply.onboarding.model.SubTownEntity
import com.teamsolply.solply.onboarding.model.TownEntity

fun GetAllTownResponseDto.toEntity(): TownEntity {
val parentTowns = towns.filter { it.parentTownId == null }

val grouped = parentTowns.map { parent ->
ParentTownEntity(
townId = parent.townId,
townName = parent.townName,
subTowns = towns
.filter { it.parentTownId == parent.townId }
.map { dto ->
SubTownEntity(
townId = dto.townId,
townName = dto.townName
)
}
)
}

return TownEntity(
towns = towns.map { it.toSubEntity() }
parentTowns = grouped
)
}

fun TownDto.toParentEntity(): ParentTownEntity {
return ParentTownEntity(
townId = townId,
townName = townName,
subTowns = subTowns?.map { it.toSubEntity() } ?: emptyList()
)
}

fun TownDto.toSubEntity(): SubTownEntity {
return SubTownEntity(
townId = this.townId,
townName = this.townName,
subTowns = this.subTowns?.map { it.toSubEntity() }
townId = townId,
townName = townName
)
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.teamsolply.solply.onboarding.repository

import com.teamsolply.solply.onboarding.dto.request.PatchUserInfoRequestDto
import com.teamsolply.solply.onboarding.mapper.toDto
import com.teamsolply.solply.onboarding.mapper.toEntity
import com.teamsolply.solply.onboarding.model.PersonaEntity
import com.teamsolply.solply.onboarding.model.PolicyAgreementInfoEntity
import com.teamsolply.solply.onboarding.model.TownEntity
import com.teamsolply.solply.onboarding.model.UserInfoEntity
import com.teamsolply.solply.onboarding.source.remote.OnBoardingRemoteDataSource
Expand All @@ -29,16 +31,16 @@ class OnBoardingRepositoryImpl @Inject constructor(

override suspend fun patchUserInfo(
selectedTownId: Long,
favoriteTownIdList: List<Long>,
persona: String,
nickname: String
nickname: String,
policyAgreementInfos: List<PolicyAgreementInfoEntity>
): Result<UserInfoEntity> = runCatching {
onBoardingRemoteDataSource.patchUserInfo(
PatchUserInfoRequestDto(
selectedTownId = selectedTownId,
favoriteTownIdList = favoriteTownIdList,
persona = persona,
nickname = nickname
nickname = nickname,
policyAgreementInfos = policyAgreementInfos.map { it.toDto() }
)
)
}.mapCatching {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.teamsolply.solply.onboarding.model

data class PolicyAgreementInfoEntity(
val policyId: Long,
val isAgree: Boolean
)
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
package com.teamsolply.solply.onboarding.model

data class TownEntity(
val towns: List<SubTownEntity>
val parentTowns: List<ParentTownEntity>
)

data class SubTownEntity(
data class ParentTownEntity(
val townId: Long,
val townName: String,
val subTowns: List<SubTownEntity>? = null
val subTowns: List<SubTownEntity>
)

data class SubTownEntity(
val townId: Long,
val townName: String
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.teamsolply.solply.onboarding.repository

import com.teamsolply.solply.onboarding.model.PersonaEntity
import com.teamsolply.solply.onboarding.model.PolicyAgreementInfoEntity
import com.teamsolply.solply.onboarding.model.TownEntity
import com.teamsolply.solply.onboarding.model.UserInfoEntity

Expand All @@ -10,8 +11,8 @@ interface OnBoardingRepository {
suspend fun checkNicknameDuplicate(nickname: String): Result<Boolean>
suspend fun patchUserInfo(
selectedTownId: Long,
favoriteTownIdList: List<Long>,
persona: String,
nickname: String
nickname: String,
policyAgreementInfos: List<PolicyAgreementInfoEntity>
): Result<UserInfoEntity>
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fun OauthScreen(
Column(
modifier.fillMaxSize()
) {
Spacer(modifier = Modifier.height(115.dp))
Spacer(modifier = Modifier.height(180.dp))
Image(
painter = painterResource(R.drawable.ic_logo_full_vector),
contentDescription = "app_logo",
Expand Down Expand Up @@ -151,7 +151,7 @@ fun OauthScreen(
.height(52.dp)
.padding(start = 20.dp, end = 20.dp)
.background(
color = SolplyTheme.colors.black,
color = SolplyTheme.colors.white,
shape = RoundedCornerShape(12.dp)
)
.customClickable(
Expand All @@ -163,16 +163,16 @@ fun OauthScreen(
horizontalArrangement = Arrangement.Start
) {
Icon(
painter = painterResource(R.drawable.ic_apple_logo),
contentDescription = "kakao_logo",
painter = painterResource(R.drawable.ic_google_logo),
contentDescription = "google_logo",
tint = Color.Unspecified,
modifier = Modifier
.padding(start = 16.dp, end = 12.dp, top = 12.dp, bottom = 12.dp)
)
Text(
text = stringResource(com.teamsolply.solply.oauth.R.string.apple_login),
text = stringResource(com.teamsolply.solply.oauth.R.string.google_login),
style = SolplyTheme.typography.button16M,
color = SolplyTheme.colors.white
color = SolplyTheme.colors.black
)
}
Spacer(modifier = Modifier.height(48.dp))
Expand Down
2 changes: 1 addition & 1 deletion feature/oauth/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="kakao_login">카카오로 계속하기</string>
<string name="apple_login">Apple로 계속하기</string>
<string name="google_login">Google로 계속하기</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,25 @@ import com.teamsolply.solply.ui.base.UiState

data class OnBoardingState(
val currentPage: Int = 0,
val totalPageCount: Int = 3,
val totalPageCount: Int = 4,
val townList: TownEntity = TownEntity(
towns = emptyList()
parentTowns = emptyList()
),

val selectedRegionId: Long? = 1,
val selectedTownId: Long? = null,
val townBottomSheetShown: Boolean = false,

val personaList: PersonaEntity = PersonaEntity(personaList = emptyList()),
val selectedPersona: String? = null,

val userNickname: String = "",
val isNicknameDuplicate: Boolean = false,
val showStartingScreen: Boolean = false,
val isOnBoardingSuccess: Boolean = false
val isOnBoardingSuccess: Boolean = false,
val agree14: Boolean = false,
val agreeService: Boolean = false,
val agreePrivacy: Boolean = false
) : UiState

sealed interface OnBoardingIntent : UiIntent {
Expand All @@ -40,6 +44,9 @@ sealed interface OnBoardingIntent : UiIntent {
) : OnBoardingIntent

data object ShowStartingScreen : OnBoardingIntent
data class ChangeAgree14(val isChecked: Boolean) : OnBoardingIntent
data class ChangeAgreeService(val isChecked: Boolean) : OnBoardingIntent
data class ChangeAgreePrivacy(val isChecked: Boolean) : OnBoardingIntent
}

sealed interface OnBoardingSideEffect : SideEffect {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.teamsolply.solply.onboarding

import androidx.lifecycle.viewModelScope
import com.teamsolply.solply.onboarding.model.PolicyAgreementInfoEntity
import com.teamsolply.solply.onboarding.repository.OnBoardingRepository
import com.teamsolply.solply.ui.base.BaseViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
Expand Down Expand Up @@ -83,6 +84,17 @@ class OnBoardingViewModel @Inject constructor(
is OnBoardingIntent.ShowStartingScreen -> {
patchUserInfo()
}
is OnBoardingIntent.ChangeAgree14 -> {
reduce { copy(agree14 = intent.isChecked) }
}

is OnBoardingIntent.ChangeAgreeService -> {
reduce { copy(agreeService = intent.isChecked) }
}

is OnBoardingIntent.ChangeAgreePrivacy -> {
reduce { copy(agreePrivacy = intent.isChecked) }
}
}
}

Expand Down Expand Up @@ -118,11 +130,18 @@ class OnBoardingViewModel @Inject constructor(
viewModelScope.launch {
uiState.value.selectedTownId?.let { selectedTownId ->
uiState.value.selectedPersona?.let { selectedPersona ->

val policyInfos = listOf(
PolicyAgreementInfoEntity(1, uiState.value.agree14),
PolicyAgreementInfoEntity(2, uiState.value.agreeService),
PolicyAgreementInfoEntity(3, uiState.value.agreePrivacy)
)

onBoardingRepository.patchUserInfo(
selectedTownId = selectedTownId,
favoriteTownIdList = uiState.value.townList.towns.map { it.townId },
persona = selectedPersona,
nickname = uiState.value.userNickname
nickname = uiState.value.userNickname,
policyAgreementInfos = policyInfos
).onSuccess {
reduce { copy(showStartingScreen = true) }
}
Expand Down
Loading