-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] 마이페이지 회원정보 조회 api 연동 #52
Merged
Merged
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2025ff0
[chore] #35 AuthInterceptor 수정
jooyyoo ca3ab1b
Merge branch 'develop' into feat-mypageinfo-api-connection
jooyyoo 16b5981
[feat] #35 마이페이 회원정보 api 연동 - 수정 필요
jooyyoo ea00e83
Merge branch 'develop' into feat-mypageinfo-api-connection
jooyyoo 1700915
[del] #35 마이페이지 회원정보 조회 api 파일 통일을 위한 삭제
jooyyoo 2d86697
[feat] #35 마이페이지 회원정보 조희 api 연결
jooyyoo 045d752
[chore] #35 klint 적용
jooyyoo 8e9bae5
[mod] #35 불필요한 코드 수정
jooyyoo 86dbad3
Merge branch 'develop' into feat-mypageinfo-api-connection
jooyyoo 2978448
[chore] #35 klint 적용
jooyyoo b19c825
Merge branch 'develop' into feat-mypageinfo-api-connection
jooyyoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
app/src/main/java/com/sopt/geonppang/data/datasource/remote/MypageDataSource.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
app/src/main/java/com/sopt/geonppang/data/model/response/ResponseMypageInfo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.sopt.geonppang.data.model.response | ||
|
||
import com.sopt.geonppang.domain.model.BreadType | ||
import com.sopt.geonppang.domain.model.Profile | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ResponseMypageInfo( | ||
val code: Int, | ||
val data: Data, | ||
val message: String | ||
) { | ||
@Serializable | ||
data class Data( | ||
val memberNickname: String, | ||
val mainPurpose: String, | ||
val breadType: BreadType | ||
) { | ||
@Serializable | ||
data class BreadType( | ||
val breadTypeId: Int, | ||
val breadTypeName: String, | ||
val isGlutenFree: Boolean, | ||
val isNutFree: Boolean, | ||
val isSugarFree: Boolean, | ||
val isVegan: Boolean | ||
) | ||
} | ||
|
||
fun toMypageInfo() = Profile( | ||
memberNickname = data.memberNickname, | ||
mainPurpose = data.mainPurpose, | ||
breadType = BreadType( | ||
breadTypeId = data.breadType.breadTypeId, | ||
breadTypeName = data.breadType.breadTypeName, | ||
isGlutenFree = data.breadType.isGlutenFree, | ||
isVegan = data.breadType.isVegan, | ||
isNutFree = data.breadType.isNutFree, | ||
isSugarFree = data.breadType.isSugarFree | ||
) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
app/src/main/java/com/sopt/geonppang/data/service/MypageService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ class MyPageFragment : BindingFragment<FragmentMyPageBinding>(R.layout.fragment_ | |
binding.viewModel = viewModel | ||
binding.lifecycleOwner = this | ||
|
||
viewModel.fetchMypageInfo() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 뷰모델 init{} 블록으로 이동 |
||
|
||
addListeners() | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ package com.sopt.geonppang.presentation.mypage | |
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import com.sopt.geonppang.domain.model.Bakery | ||
import com.sopt.geonppang.domain.model.BreadType | ||
import com.sopt.geonppang.domain.model.MyReview | ||
import com.sopt.geonppang.domain.model.Profile | ||
import com.sopt.geonppang.domain.repository.MypageRepository | ||
|
@@ -19,27 +18,18 @@ import javax.inject.Inject | |
class MyPageViewModel @Inject constructor( | ||
private val mypageRepository: MypageRepository, | ||
) : ViewModel() { | ||
private val _profile = Profile( | ||
memberNickname = "안빵이들", | ||
mainPurpose = "맛 . 다이어트", | ||
breadType = BreadType( | ||
breadTypeId = 1, | ||
breadTypeName = "글루텐프리", | ||
isGlutenFree = true, | ||
isVegan = true, | ||
isNutFree = false, | ||
isSugarFree = true | ||
) | ||
) | ||
val profile = _profile | ||
private var _mypageInfoState = MutableStateFlow(Profile()) | ||
val mypageInfoState get() = _mypageInfoState.asStateFlow() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 뭔가 이상한데...? |
||
|
||
private var _mypageReviewListState = MutableStateFlow<UiState<List<MyReview>>>(UiState.Loading) | ||
private var _mypageReviewListState = | ||
MutableStateFlow<UiState<List<MyReview>>>(UiState.Loading) | ||
val mypageReviewListState get() = _mypageReviewListState.asStateFlow() | ||
|
||
private var _myReviewCount = MutableStateFlow<Int?>(null) | ||
val myReviewCount get() = _myReviewCount.asStateFlow() | ||
|
||
private var _mypageBookmarkListState = MutableStateFlow<UiState<List<Bakery>>>(UiState.Loading) | ||
private var _mypageBookmarkListState = | ||
MutableStateFlow<UiState<List<Bakery>>>(UiState.Loading) | ||
val mypageBookmarkListState get() = _mypageBookmarkListState.asStateFlow() | ||
|
||
private var _myBookmarkCount = MutableStateFlow<Int?>(null) | ||
|
@@ -50,6 +40,17 @@ class MyPageViewModel @Inject constructor( | |
fetchMypageBookmarkList() | ||
} | ||
|
||
fun fetchMypageInfo() { | ||
viewModelScope.launch { | ||
mypageRepository.fetchMypageInfo() | ||
.onSuccess { myInfo -> | ||
myInfo.let { | ||
_mypageInfoState.value = myInfo | ||
} | ||
} | ||
} | ||
} | ||
|
||
private fun fetchMypageReviewList() { | ||
viewModelScope.launch { | ||
mypageRepository.fetchMyReview().onSuccess { myReviewList -> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this?