From 429a3aaa5e153543d3422cc8d1e32496f0f1a8c9 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sun, 8 Sep 2024 16:00:11 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[FEAT/#226]=20DEFAULT=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=20=EC=9E=AC=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/main/java/com/terning/core/type/ProfileImage.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/com/terning/core/type/ProfileImage.kt b/core/src/main/java/com/terning/core/type/ProfileImage.kt index f4836df27..8ccc58040 100644 --- a/core/src/main/java/com/terning/core/type/ProfileImage.kt +++ b/core/src/main/java/com/terning/core/type/ProfileImage.kt @@ -24,7 +24,7 @@ enum class ProfileImage( "glass" -> GLASS "calendar" -> CALENDAR "passion" -> PASSION - else -> BASIC + else -> DEFAULT } fun toIndex(profileImage: ProfileImage): Int = From 8d630a478aefc23d98616b43b324d9374e4d4460 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sun, 8 Sep 2024 23:03:28 +0900 Subject: [PATCH 2/6] =?UTF-8?q?[FEAT/#226]=20=EB=A7=88=EC=9D=B4=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EC=A0=95=EB=B3=B4=20=EB=B6=88=EB=9F=AC?= =?UTF-8?q?=EC=98=A4=EB=8A=94=20=ED=83=80=EC=9D=B4=EB=B0=8D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/terning/feature/mypage/mypage/MyPageRoute.kt | 4 ++++ .../com/terning/feature/mypage/mypage/MyPageViewModel.kt | 6 +----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt index 4ec22dbcc..10f4479af 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageRoute.kt @@ -73,6 +73,10 @@ fun MyPageRoute( } } + LaunchedEffect(true) { + viewModel.getProfile() + } + LaunchedEffect(viewModel.sideEffects, lifecycleOwner) { viewModel.sideEffects.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle) .collect { sideEffect -> diff --git a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageViewModel.kt b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageViewModel.kt index 535cf4b6d..485419852 100644 --- a/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageViewModel.kt +++ b/feature/src/main/java/com/terning/feature/mypage/mypage/MyPageViewModel.kt @@ -31,10 +31,6 @@ class MyPageViewModel @Inject constructor( private val tokenRepository: TokenRepository ) : ViewModel() { - init { - getProfile() - } - private val _state: MutableStateFlow = MutableStateFlow(MyPageState()) val state: StateFlow get() = _state.asStateFlow() @@ -98,7 +94,7 @@ class MyPageViewModel @Inject constructor( } } - private fun getProfile() { + fun getProfile() { viewModelScope.launch { myPageRepository.getProfile() .onSuccess { response -> From 2b389c8659f24a3f78ed5360edaa5a8b39bd53c7 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sun, 8 Sep 2024 23:35:08 +0900 Subject: [PATCH 3/6] =?UTF-8?q?[FEAT/#226]=20=ED=94=84=EB=A1=9C=ED=95=84?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/data/datasourceimpl/MyPageDataSourceImpl.kt | 2 +- .../src/main/java/com/terning/data/service/MyPageService.kt | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/data/src/main/java/com/terning/data/datasourceimpl/MyPageDataSourceImpl.kt b/data/src/main/java/com/terning/data/datasourceimpl/MyPageDataSourceImpl.kt index bc96ce7b0..a1560963c 100644 --- a/data/src/main/java/com/terning/data/datasourceimpl/MyPageDataSourceImpl.kt +++ b/data/src/main/java/com/terning/data/datasourceimpl/MyPageDataSourceImpl.kt @@ -19,5 +19,5 @@ class MyPageDataSourceImpl @Inject constructor( override suspend fun editProfile( request: MyPageProfileEditRequestDto - ): NonDataBaseResponse = myPageService.editProfile() + ): NonDataBaseResponse = myPageService.editProfile(request) } \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/service/MyPageService.kt b/data/src/main/java/com/terning/data/service/MyPageService.kt index 6ce2d16ae..9b7a62b61 100644 --- a/data/src/main/java/com/terning/data/service/MyPageService.kt +++ b/data/src/main/java/com/terning/data/service/MyPageService.kt @@ -2,7 +2,9 @@ package com.terning.data.service import com.terning.data.dto.BaseResponse import com.terning.data.dto.NonDataBaseResponse +import com.terning.data.dto.request.MyPageProfileEditRequestDto import com.terning.data.dto.response.MyPageResponseDto +import retrofit2.http.Body import retrofit2.http.DELETE import retrofit2.http.GET import retrofit2.http.PATCH @@ -19,5 +21,7 @@ interface MyPageService { suspend fun getProfile(): BaseResponse @PATCH("api/v1/mypage/profile") - suspend fun editProfile(): NonDataBaseResponse + suspend fun editProfile( + @Body body: MyPageProfileEditRequestDto + ): NonDataBaseResponse } \ No newline at end of file From 2a6e3dff15f77e1b7a539c27ec946cbf1b681ee9 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Sun, 8 Sep 2024 23:48:00 +0900 Subject: [PATCH 4/6] =?UTF-8?q?[FEAT/#226]=20=ED=94=84=EB=A1=9C=ED=95=84?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20=ED=99=9C=EC=84=B1=ED=99=94=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/mypage/profileedit/ProfileEditState.kt | 1 + .../terning/feature/mypage/profileedit/ProfileEditViewModel.kt | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt index a8f1d2b96..7048e20a7 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt @@ -4,6 +4,7 @@ data class ProfileEditState( val name: String = "", val initialName: String = "", val profile: String = "", + val initialProfile: String = "", val initialView: Boolean = true, val isButtonValid: Boolean = false, val authType: String = "", diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt index 5516b79c2..2ed62c6ce 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt @@ -37,6 +37,7 @@ class ProfileEditViewModel @Inject constructor( name = initialName, initialName = initialName, profile = initialProfile, + initialProfile = initialProfile ) } @@ -50,7 +51,7 @@ class ProfileEditViewModel @Inject constructor( fun updateProfile(profile: String) { _state.value = _state.value.copy( profile = profile, - initialView = false + initialView = profile == _state.value.initialProfile ) } From 67de6b4eaea6542abbbaffedee9be15de840b7d8 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Mon, 9 Sep 2024 00:20:07 +0900 Subject: [PATCH 5/6] =?UTF-8?q?[FEAT/#226]=20=ED=94=84=EB=A1=9C=ED=95=84?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20=ED=99=9C=EC=84=B1=ED=99=94=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/mypage/profileedit/ProfileEditState.kt | 1 + .../feature/mypage/profileedit/ProfileEditViewModel.kt | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt index 7048e20a7..41d811f37 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditState.kt @@ -6,6 +6,7 @@ data class ProfileEditState( val profile: String = "", val initialProfile: String = "", val initialView: Boolean = true, + val isModified: Boolean = false, val isButtonValid: Boolean = false, val authType: String = "", val showBottomSheet: Boolean = false diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt index 2ed62c6ce..a12f19733 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt @@ -44,14 +44,19 @@ class ProfileEditViewModel @Inject constructor( fun updateName(name: String) { _state.value = _state.value.copy( name = name, - initialView = false + initialView = false, + isModified = true ) } fun updateProfile(profile: String) { + val isSameAsInitial = profile == _state.value.initialProfile + val isSameAsPrevious = profile == _state.value.profile + _state.value = _state.value.copy( profile = profile, - initialView = profile == _state.value.initialProfile + initialView = !_state.value.isModified && isSameAsInitial, + isModified = if (isSameAsPrevious) _state.value.isModified else !isSameAsInitial ) } From c967ca5382c8a36af1af011eb6b22df2599d1945 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Mon, 9 Sep 2024 21:55:06 +0900 Subject: [PATCH 6/6] =?UTF-8?q?[FEAT/#226]=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/data/datasourceimpl/TokenReissueDataSourceImpl.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/src/main/java/com/terning/data/datasourceimpl/TokenReissueDataSourceImpl.kt b/data/src/main/java/com/terning/data/datasourceimpl/TokenReissueDataSourceImpl.kt index d4bae4bf0..3c7bebdfd 100644 --- a/data/src/main/java/com/terning/data/datasourceimpl/TokenReissueDataSourceImpl.kt +++ b/data/src/main/java/com/terning/data/datasourceimpl/TokenReissueDataSourceImpl.kt @@ -12,5 +12,5 @@ class TokenReissueDataSourceImpl @Inject constructor( override suspend fun postReissueToken( authorization: String ): BaseResponse = - tokenReissueService.postReissueToken(authorization) + tokenReissueService.postReissueToken("Bearer $authorization") } \ No newline at end of file