Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
a02ed2e
fix: 프로필 화면, 프로필 수정 화면 프로필 이미지 안 나오는 문제 수정
1971123-seongmin Apr 21, 2025
8c95aac
mod: 프로필 수정 시 생년월일 선택 사항으로 변경
1971123-seongmin Apr 21, 2025
e817b45
mod: 홈 화면 filter에서 25분 이상, 5만원 이상 선택하면 서버 통신 실패하는 문제 수정
1971123-seongmin Apr 21, 2025
e1eae3c
Merge branch 'develop' into #fix-close-test-update-4
1971123-seongmin Apr 21, 2025
cce0ed5
feat: WalkingTimeType 20분 이상이면 값 null로 설정
1971123-seongmin Apr 22, 2025
69ce875
mod: SpotList fetchSpots 함수 성공시 상태 업데이트 로직 변경
1971123-seongmin Apr 22, 2025
e062fc2
mod: SpotList 일치하는 맛집 없을 때 조건 변경
1971123-seongmin Apr 22, 2025
210b44a
mod: 프로필 수정 버튼 활성화 조건 수정
1971123-seongmin Apr 22, 2025
09c9bb6
fix: 프로필 수정 닉네임 텍스트 필드 수정 (특수 문자 입력시 입력은 안되고, 에러 문구 표시)
1971123-seongmin Apr 22, 2025
424c54f
mod: 프로필 수정 화면 이미지 로드 로직 원상복귀 (이것도 제대로 동작하는 것은 아님, 고쳐야 함)
1971123-seongmin Apr 22, 2025
75cc442
feat: 버전 코드 증가
1971123-seongmin Apr 22, 2025
ebc0b89
Merge branch 'develop' into #fix-close-test-update-4
ThirFir Apr 23, 2025
ef2c4d0
Merge branch 'develop' into #fix-close-test-update-4
1971123-seongmin Apr 23, 2025
0db552e
Merge remote-tracking branch 'origin/#fix-close-test-update-4' into #…
1971123-seongmin Apr 23, 2025
36c921b
Merge branch 'develop' into #fix-close-test-update-4
1971123-seongmin Apr 24, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.acon.acon.domain.type.SpotType
data class Condition(
val spotType: SpotType?,
val filterList: List<Filter>?,
val walkingTime: Int,
val walkingTime: Int?,
val priceRange: Int?
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.vectorResource
import coil3.compose.AsyncImage
import coil3.compose.rememberAsyncImagePainter
import com.acon.acon.core.designsystem.noRippleClickable
import com.acon.acon.feature.profile.R
Expand Down Expand Up @@ -52,12 +53,13 @@ fun ProfilePhotoBox(
)
}

else -> {
Icon(
photoUri.startsWith("https://") -> {
AsyncImage(
model = photoUri,
contentDescription = "선택한 프로필 사진",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null인게 나을거같네요.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contentDescription 말 하시는 건가요??

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네네

modifier = Modifier.fillMaxSize(),
imageVector = ImageVector.vectorResource(R.drawable.img_profile_basic_80),
contentDescription = "Profile Image",
tint = Color.Unspecified,
contentScale = ContentScale.Crop,
alignment = Alignment.Center
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ fun ProfileScreen(

val snackBarText = stringResource(R.string.snackbar_profile_save_success)
val success = stringResource(R.string.success)

LaunchedEffect(profileUpdateResult) {
if (profileUpdateResult == success) {
snackbarHostState.showSnackbar(snackBarText)
Expand Down Expand Up @@ -100,7 +101,7 @@ fun ProfileScreen(
modifier = Modifier
.padding(vertical = 32.dp)
) {
if (state.profileImage.isNotEmpty()) {
if (state.profileImage.isEmpty()) {
Image(
imageVector = ImageVector.vectorResource(com.acon.acon.core.designsystem.R.drawable.ic_default_profile_40),
contentDescription = stringResource(R.string.content_description_default_profile_image),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,27 @@ class ProfileModViewModel @Inject constructor(
val filteredText = text.filter { it.isAllowedChar() }

var nicknameCount = 0
var limitedText = ""
for (char in filteredText) {
nicknameCount += if (char.isKorean()) 2 else 1
if (nicknameCount > 16) break
val weight = if (char.isKorean()) 2 else 1
if (nicknameCount + weight > 16) break
limitedText += char
nicknameCount += weight
}

val updatedNicknameStatus = when {
filteredText.isEmpty() -> NicknameStatus.Empty
text.isEmpty() -> NicknameStatus.Empty
else -> NicknameStatus.Typing
}

val updatedFieldStatus = when {
filteredText.isEmpty() -> TextFieldStatus.Empty
text.isEmpty() -> TextFieldStatus.Empty
else -> state.nickNameFieldStatus
}

reduce {
state.copy(
nickNameState = filteredText,
nickNameState = limitedText,
nicknameCount = nicknameCount,
nicknameStatus = updatedNicknameStatus,
nickNameFieldStatus = updatedFieldStatus
Expand All @@ -134,23 +137,23 @@ class ProfileModViewModel @Inject constructor(

val errors = mutableListOf<NicknameErrorType>()

if (filteredText.any { it in "!@#$%^&*()-=+[]{};:'\",<>/?\\|" }) {
if (text.any { it in "!@#$%^&*()-=+[]{};:'\",<>/?\\|" }) {
errors.add(NicknameErrorType.InvalidChar)
}

val allowedChars = (33..126).map { it.toChar() } +
('가'..'힣') + ('ㄱ'..'ㅎ') + ('ㅏ'..'ㅣ')
if (filteredText.any { it !in allowedChars }) {
if (text.any { it !in allowedChars }) {
errors.add(NicknameErrorType.InvalidLang)
}
Comment on lines +140 to 148
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정규식을 사용하지 않은 이유가 있나요 ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이것도 원래 되어있던 코드를 그대로 활용한건데 다른 것들 고치느라 바빠서 정규식을 생각해볼 겨를이 없었네요.
Regex 이용해서 정규식으로 바꾸면 될 것 같네요.
감사합니다 ~~


validateNickname(nickname = filteredText, errors = errors)
validateNickname(nickname = limitedText, errors = errors)

intent {
reduce {
state.copy(
nicknameStatus = when {
filteredText.isBlank() -> NicknameStatus.Empty
limitedText.isBlank() -> NicknameStatus.Empty
errors.isNotEmpty() -> NicknameStatus.Error(errors)
else -> NicknameStatus.Valid
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import com.acon.acon.feature.profile.composable.utils.BirthdayTransformation
import com.acon.acon.feature.profile.composable.utils.isAllowedChar
import com.acon.acon.feature.profile.composable.utils.isKorean
import org.orbitmvi.orbit.compose.collectAsState
import org.orbitmvi.orbit.compose.collectSideEffect

@Composable
fun ProfileModScreenContainer(
Expand All @@ -82,42 +83,39 @@ fun ProfileModScreenContainer(
val context = LocalContext.current

LaunchedEffect(selectedPhotoId) {
selectedPhotoId.let {
viewModel.updateProfileImage(selectedPhotoId)
}
viewModel.updateProfileImage(selectedPhotoId)
}

LaunchedEffect(Unit) {
viewModel.container.sideEffectFlow.collect { effect ->
when (effect) {
is ProfileModSideEffect.NavigateToSettings -> {
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
data = Uri.fromParts("package", effect.packageName, null)
}
context.startActivity(intent)
}

is ProfileModSideEffect.NavigateBack -> {
backToProfile()
viewModel.collectSideEffect { effect ->
when (effect) {
is ProfileModSideEffect.NavigateToSettings -> {
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
data = Uri.fromParts("package", effect.packageName, null)
}
context.startActivity(intent)
}

is ProfileModSideEffect.NavigateToCustomGallery -> {
onNavigateToCustomGallery()
}
is ProfileModSideEffect.NavigateBack -> {
backToProfile()
}

is ProfileModSideEffect.UpdateProfileImage -> {
selectedPhotoId.let {
viewModel.updateProfileImage(selectedPhotoId)
}
}
is ProfileModSideEffect.NavigateToCustomGallery -> {
onNavigateToCustomGallery()
}

is ProfileModSideEffect.NavigateToProfileSuccess -> {
onNavigateToProfile(ProfileUpdateResult.SUCCESS)
is ProfileModSideEffect.UpdateProfileImage -> {
selectedPhotoId.let {
viewModel.updateProfileImage(selectedPhotoId)
}
Comment on lines +108 to 110
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여긴 왜 let으로 감싸져 있나요 ?

Copy link
Copy Markdown
Member Author

@1971123-seongmin 1971123-seongmin Apr 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ProfileModScreen은 제가 만든 화면은 아니라 질문하신 부분은 원래 만들어져 있던 그대로 놔뒀어요 (따로 손 안대고 그대로 뒀어요!) 바뀐거로 나온건 코드 정리 최적화 기능 때문에 된 것 같아요

}

is ProfileModSideEffect.NavigateToProfileFailed -> {
onNavigateToProfile(ProfileUpdateResult.FAILURE)
}
is ProfileModSideEffect.NavigateToProfileSuccess -> {
onNavigateToProfile(ProfileUpdateResult.SUCCESS)
}

is ProfileModSideEffect.NavigateToProfileFailed -> {
onNavigateToProfile(ProfileUpdateResult.FAILURE)
}
}
}
Expand Down Expand Up @@ -326,22 +324,23 @@ fun ProfileModScreen(
onTextChanged = { fieldValue ->
val inputText = fieldValue.text
var count = 0
var textLimit = false

val validText = buildString {
val displayText = buildString {
for (char in inputText) {
if (!char.isAllowedChar()) continue
val weight = if (char.isKorean()) 2 else 1
if (count + weight > 16) break
append(char)
count += weight
if (count + weight > 16) {
textLimit = true
break
}
if (char.isAllowedChar()) {
append(char)
count += weight
}
}
}

if (validText.length < inputText.length) {
// 초과된 입력이므로 무시하고 아무것도 하지 않음 (16자 이상은 입력 무시(불가능))
} else {
// 정상적인 입력만 가능
nicknameText = fieldValue
if (!textLimit || displayText.length <= nicknameText.text.length) {
nicknameText = fieldValue.copy(text = displayText)
onNicknameChanged(inputText)
}
},
Expand Down Expand Up @@ -486,9 +485,11 @@ fun ProfileModScreen(
enabledTextColor = AconTheme.color.White,
onClick = onSaveClicked,
isEnabled = (state.nicknameStatus == NicknameStatus.Valid) &&
(state.birthdayStatus != BirthdayStatus.Invalid("정확한 생년월일을 입력해주세요")) &&
((state.nickNameState != state.originalNickname || state.birthdayState != state.originalBirthday || state.selectedPhotoUri != state.originalPhotoUri)
&& state.birthdayState.isNotEmpty())
(
(state.nickNameState != state.originalNickname) ||
(state.birthdayState != state.originalBirthday && state.birthdayStatus == BirthdayStatus.Valid) ||
(state.selectedPhotoUri != state.originalPhotoUri)
)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class SpotListViewModel @Inject constructor(
fun googleLogin(socialRepository: SocialRepository, location: Location) = intent {
socialRepository.googleLogin()
.onSuccess {
if(it.hasVerifiedArea) {
if (it.hasVerifiedArea) {
fetchSpots(location)
} else {
postSideEffect(SpotListSideEffect.NavigateToAreaVerification)
Expand All @@ -72,7 +72,8 @@ class SpotListViewModel @Inject constructor(
spotRepository.fetchSpotList(
latitude = location.latitude,
longitude = location.longitude,
condition = Condition.Default,
condition = (state as? SpotListUiState.Success)?.currentCondition?.toCondition()
?: Condition.Default,
)
}

Expand All @@ -92,10 +93,18 @@ class SpotListViewModel @Inject constructor(
spotListResult.reduceResult(
syntax = this,
onSuccess = {
SpotListUiState.Success(
(state as? SpotListUiState.Success)?.copy(
spotList = it,
isRefreshing = false,
userType = userType.value,
legalAddressName = legalArea.area,
isFilteredResultFetching = it.isEmpty()
) ?: SpotListUiState.Success(
spotList = it,
isRefreshing = false,
userType = userType.value,
legalAddressName = legalArea.area,
isFilteredResultFetching = it.isEmpty()
)
}, onFailure = {
when (it) {
Expand Down
Loading