Skip to content

Commit

Permalink
[chore] #134 피그마에 맞춰 icon 변경, 수정 후 이동
Browse files Browse the repository at this point in the history
  • Loading branch information
cacaocoffee committed Oct 26, 2024
1 parent 752592e commit 8a6ccc0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
Binary file modified core/designsystem/src/main/res/drawable/img_profileedit.png
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
Expand Up @@ -46,7 +46,9 @@ import com.record.designsystem.component.button.RecordyButton
import com.record.designsystem.component.textfield.RecordyValidateTextfield
import com.record.designsystem.theme.RecordyTheme
import com.record.ui.extension.customClickable
import com.record.ui.lifecycle.LaunchedEffectWithLifecycle
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.collectLatest

@Composable
fun ProfileEditRoute(
Expand Down Expand Up @@ -85,6 +87,13 @@ fun ProfileScreen(
}
}

LaunchedEffectWithLifecycle {
viewModel.sideEffect.collectLatest {
when (it) {
ProfileEditSideEffect.BackToSetting -> { popBackStack() }
}
}
}
Column(
modifier = modifier
.fillMaxSize()
Expand Down Expand Up @@ -212,7 +221,6 @@ fun ProfileScreen(
onClick = {
uiState.value.profileImgUrl?.let {
viewModel.updateUserProfile()
popBackStack()
}
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ data class ProfileEditState(
val btnEnable: Boolean = false,
) : UiState

sealed interface ProfileEditSideEffect : SideEffect
sealed interface ProfileEditSideEffect : SideEffect {
data object BackToSetting : ProfileEditSideEffect
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ProfileEditViewModel @Inject constructor(
private val authRepository: AuthRepository,
) : BaseViewModel<ProfileEditState, ProfileEditSideEffect>(ProfileEditState()) {
init {
getProfile()
// getProfile()
}

private fun getProfile() = viewModelScope.launch {
Expand Down Expand Up @@ -56,7 +56,9 @@ class ProfileEditViewModel @Inject constructor(
}

fun updateUserProfile() = viewModelScope.launch {
userRepository.updateUser(uiState.value.username, uiState.value.profileImgUrl ?: "")
userRepository.updateUser(uiState.value.username, uiState.value.profileImgUrl ?: "").onSuccess {
postSideEffect(ProfileEditSideEffect.BackToSetting)
}
}

fun updateImgUrl(url: String?) = intent { copy(profileImgUrl = url) }
Expand Down

0 comments on commit 8a6ccc0

Please sign in to comment.