Skip to content

Commit

Permalink
Merge pull request #52 from Nexters/feature/fix-qa-final
Browse files Browse the repository at this point in the history
Feature/fix qa final
  • Loading branch information
bywindow authored Aug 23, 2024
2 parents 50de963 + f805af9 commit ce866e4
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import com.goalpanzi.mission_mate.feature.board.model.MissionDetail
import com.goalpanzi.mission_mate.feature.board.model.MissionState
import com.goalpanzi.mission_mate.feature.onboarding.component.StableImage
import com.goalpanzi.mission_mate.feature.onboarding.model.VerificationTimeType
import com.goalpanzi.mission_mate.feature.onboarding.util.getStringId

@Composable
fun BoardBottomView(
Expand All @@ -52,9 +51,7 @@ fun BoardBottomView(
) {
StableImage(drawableResId = com.goalpanzi.mission_mate.core.designsystem.R.drawable.ic_time)
Text(
text = missionDetail.missionDays.map {
stringResource(id = it.getStringId())
}.joinToString(" ") + " | " + when(VerificationTimeType.valueOf(missionDetail.timeOfDay)){
text = missionDetail.missionDaysOfWeekTextLocale.joinToString(" ") + " | " + when(VerificationTimeType.valueOf(missionDetail.timeOfDay)){
VerificationTimeType.MORNING -> stringResource(id = R.string.board_verification_am_time_limit)
VerificationTimeType.AFTERNOON -> stringResource(id = R.string.board_verification_pm_time_limit)
VerificationTimeType.EVERYDAY -> stringResource(id = R.string.board_verification_all_day_time_limit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.layout.wrapContentSize
Expand Down Expand Up @@ -274,23 +275,13 @@ fun ProfileCreateSuccessDialog(
textAlign = TextAlign.Center,
color = ColorGray2_FF4F505C
)
Image(
painter = painterResource(
id = when (character) {
CharacterType.RABBIT -> designSystemResource.drawable.img_rabbit_selected
CharacterType.CAT -> designSystemResource.drawable.img_cat_selected
CharacterType.DOG -> designSystemResource.drawable.img_dog_selected
CharacterType.PANDA -> designSystemResource.drawable.img_panda_selected
CharacterType.BEAR -> designSystemResource.drawable.img_bear_selected
CharacterType.BIRD -> designSystemResource.drawable.img_bird_selected
}
),
contentDescription = null,
Box(
modifier = Modifier
.padding(vertical = 32.dp)
.size(180.dp)
.paint(
painter = painterResource(
when (character) {
id = when (character) {
CharacterType.RABBIT -> designSystemResource.drawable.background_rabbit
CharacterType.CAT -> designSystemResource.drawable.background_cat
CharacterType.DOG -> designSystemResource.drawable.background_dog
Expand All @@ -301,7 +292,26 @@ fun ProfileCreateSuccessDialog(
),
contentScale = ContentScale.FillWidth,
)
)
) {
Image(
painter = painterResource(
id = when (character) {
CharacterType.RABBIT -> designSystemResource.drawable.img_rabbit_default
CharacterType.CAT -> designSystemResource.drawable.img_cat_default
CharacterType.DOG -> designSystemResource.drawable.img_dog_default
CharacterType.PANDA -> designSystemResource.drawable.img_panda_default
CharacterType.BEAR -> designSystemResource.drawable.img_bear_default
CharacterType.BIRD -> designSystemResource.drawable.img_bird_default
}
),
contentDescription = null,
contentScale = ContentScale.FillWidth,
modifier = Modifier
.fillMaxSize()
.padding(18.dp)
.align(Alignment.Center)
)
}
}
}
}
Expand All @@ -327,7 +337,7 @@ fun OnboardingScreenPreview() {
fun ProfileCreateSuccessDialogPreview() {
ProfileCreateSuccessDialog(
nickname = "Test",
character = CharacterType.CAT,
character = CharacterType.RABBIT,
onClickOk = {}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package com.goalpanzi.mission_mate.feature.onboarding.screen
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.goalpanzi.core.model.UserProfile
import com.goalpanzi.core.model.base.NetworkResult
import com.goalpanzi.mission_mate.core.domain.usecase.GetJoinedMissionsUseCase
import com.goalpanzi.mission_mate.core.domain.usecase.GetMissionJoinedUseCase
import com.goalpanzi.mission_mate.core.domain.usecase.ProfileUseCase
import com.goalpanzi.mission_mate.feature.onboarding.isAfterProfileCreateArg
import com.goalpanzi.mission_mate.feature.onboarding.model.OnboardingResultEvent
import com.goalpanzi.mission_mate.feature.onboarding.model.OnboardingUiModel
import com.goalpanzi.core.model.base.NetworkResult
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableSharedFlow
Expand All @@ -20,8 +21,6 @@ import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.launch
import javax.inject.Inject

Expand All @@ -38,21 +37,20 @@ class OnboardingViewModel @Inject constructor(
val onboardingUiModel: StateFlow<OnboardingUiModel> = _onboardingUiModel.asStateFlow()

private val _onboardingResultEvent = MutableSharedFlow<OnboardingResultEvent>()
val onboardingResultEvent: SharedFlow<OnboardingResultEvent> = _onboardingResultEvent.asSharedFlow()
val onboardingResultEvent: SharedFlow<OnboardingResultEvent> =
_onboardingResultEvent.asSharedFlow()

val profileCreateSuccessEvent = savedStateHandle
.getStateFlow(isAfterProfileCreateArg, false)
.flatMapLatest {
flow {
emit(
if (it) {
profileUseCase.getProfile()
} else {
null
}
)
val profileCreateSuccessEvent = MutableSharedFlow<UserProfile?>()

init {
viewModelScope.launch {
savedStateHandle.get<Boolean>(isAfterProfileCreateArg)?.let {
if (it) {
profileCreateSuccessEvent.emit(profileUseCase.getProfile())
}
}
}
}

fun getJoinedMissions() {
viewModelScope.launch {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.goalpanzi.mission_mate.feature.profile

import android.app.Activity
import android.content.res.Configuration
import android.widget.Toast
import androidx.annotation.DrawableRes
import androidx.compose.foundation.Image
Expand Down Expand Up @@ -39,6 +40,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.paint
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
Expand Down Expand Up @@ -130,8 +132,7 @@ fun ProfileRoute(
viewModel.saveProfile(it)
},
onBackClick = onBackClick,
isNicknameDuplicated = isNicknameDuplicated,
resetNicknameErrorState = { viewModel.resetNicknameErrorState() },
isNicknameDuplicated = isNicknameDuplicated
)
}
}
Expand All @@ -145,8 +146,7 @@ fun ProfileContent(
onClickCharacter: (CharacterListItem) -> Unit = {},
onClickSave: (String) -> Unit = {},
onBackClick: (() -> Unit)? = null,
isNicknameDuplicated: Boolean,
resetNicknameErrorState: () -> Unit
isNicknameDuplicated: Boolean
) {
Column(
modifier = modifier
Expand Down Expand Up @@ -174,7 +174,7 @@ fun ProfileContent(
isNotChangedProfileInput = isNotChangedProfileInput,
onClickCharacter = onClickCharacter,
onClickSave = onClickSave,
isNicknameDuplicated = isNicknameDuplicated,
isNicknameDuplicated = isNicknameDuplicated
)
}
}
Expand All @@ -196,6 +196,7 @@ fun ColumnScope.ProfileScreen(
val scrollState = rememberScrollState()
val regex = Regex("^[가-힣ㅏ-ㅣㄱ-ㅎa-zA-Z0-9]{1,6}$")
var invalidNicknameError by remember { mutableStateOf(false) }
val configuration = LocalConfiguration.current

LaunchedEffect(nicknameInput) {
if (nicknameInput.isEmpty()) return@LaunchedEffect
Expand Down Expand Up @@ -228,7 +229,7 @@ fun ColumnScope.ProfileScreen(
Box(
modifier = modifier
.padding(top = 32.dp)
.size(220.dp)
.size(configuration.screenWidthDp.dp * 0.55f)
.align(Alignment.CenterHorizontally)
) {
CharacterLargeImage(
Expand All @@ -239,6 +240,7 @@ fun ColumnScope.ProfileScreen(
}
CharacterRow(
characters = characters,
configuration = configuration,
onClick = onClickCharacter
)

Expand Down Expand Up @@ -304,6 +306,7 @@ fun CharacterLargeImage(
@Composable
fun CharacterRow(
modifier: Modifier = Modifier,
configuration: Configuration,
characters: List<CharacterListItem>,
onClick: (CharacterListItem) -> Unit
) {
Expand All @@ -325,6 +328,7 @@ fun CharacterRow(
items(items = characters, key = { it.imageResId }) {
CharacterElement(
character = it,
configuration = configuration,
onClick = onClick
)
}
Expand All @@ -335,11 +339,15 @@ fun CharacterRow(
fun CharacterElement(
modifier: Modifier = Modifier,
character: CharacterListItem,
configuration: Configuration = LocalConfiguration.current,
onClick: (CharacterListItem) -> Unit = {}
) {
Box(
modifier = modifier
.size(width = 100.dp, height = 124.dp)
.size(
width = configuration.screenWidthDp.dp * 100f / 390f,
height = configuration.screenWidthDp.dp * 100f / 390f * 1.24f
)
.alpha(if (character.isSelected) 1f else 0.3f)
.clickable(
indication = null,
Expand Down Expand Up @@ -411,7 +419,7 @@ fun ColumnScope.ProfileScreenPreview() {
onClickCharacter = {},
onClickSave = {},
isNicknameDuplicated = false,
isNotChangedProfileInput = false,
isNotChangedProfileInput = false
)
}

Expand Down

0 comments on commit ce866e4

Please sign in to comment.