Skip to content

Commit

Permalink
#39 [REFACTOR] 사진 저장 로직 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
youjin09222 committed Jan 23, 2025
1 parent d61cab0 commit 306c8fb
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class EditProfileViewModel @Inject constructor(

fun navigateToMyPage() {
saveNickname(_userInfoState.value.nickname)
saveProfileImage(_userInfoState.value.profileImage)
emitSideEffect(EditProfileSideEffect.NavigateToMyPage)
}

Expand Down Expand Up @@ -65,6 +66,12 @@ class EditProfileViewModel @Inject constructor(
}
}

private fun saveProfileImage(imageUri: String?) {
executeInScope {
imageUri?.let { userInfoRepository.saveProfileImage(it) }
}
}

fun updateGalleryPermissionState(isGranted: Boolean) {
_editProfileState.update { it.copy(isPermissionGranted = isGranted) }
}
Expand All @@ -80,7 +87,6 @@ class EditProfileViewModel @Inject constructor(
fun updateProfileImage(imageUri: String?) {
executeInScope {
_userInfoState.update { it.copy(profileImage = imageUri) }
imageUri?.let { userInfoRepository.saveProfileImage(it) }
validateChanges()
}
}
Expand Down

0 comments on commit 306c8fb

Please sign in to comment.