-
Notifications
You must be signed in to change notification settings - Fork 0
feat - (남성)여자 매칭 조회 및 수락거절 작업 #78
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
Conversation
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.
Pull request overview
This PR adds male matching functionality to complement the existing female matching features. Males can now view pending match requests from females and accept or reject them through dedicated API endpoints.
Key changes:
- Introduced
HomeMatchingdata model as a unified representation for both male and female matching data - Added new API endpoints and response models for male pending matchings
- Implemented gender-based conditional UI that shows different actions (confirm for females, accept/reject for males)
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| HomeMatching.kt | New unified data model to represent matching data regardless of user gender |
| MalePendingMatchingResponse.kt | New API response model for male pending matchings |
| MatchingService.kt | Added three new API endpoints for male matching operations (get, accept, reject) |
| HomeViewModel.kt | Added gender-based fetching logic, accept/reject methods, and data transformation functions |
| HomeScreen.kt | Updated UI to conditionally show accept/reject buttons for males or confirm button for females |
| MainRouteScreen.kt | Wired gender-based matching fetch on gender state change and connected accept/reject callbacks |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private const val FEMALE_GENDER = "JAPANESE_FEMALE" | ||
| private const val MALE_GENDER = "KOREAN_MALE" | ||
| } | ||
| } | ||
|
|
Copilot
AI
Jan 8, 2026
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.
The FEMALE_GENDER constant is duplicated between this file and HomeViewModel. This duplication can lead to maintenance issues if the value needs to be changed. Consider moving these gender constants to a shared constants file or object to maintain a single source of truth.
| private const val FEMALE_GENDER = "JAPANESE_FEMALE" | |
| private const val MALE_GENDER = "KOREAN_MALE" | |
| } | |
| } | |
| private const val FEMALE_GENDER = GenderConstants.FEMALE_GENDER | |
| private const val MALE_GENDER = GenderConstants.MALE_GENDER | |
| } | |
| } | |
| object GenderConstants { | |
| const val FEMALE_GENDER = "JAPANESE_FEMALE" | |
| const val MALE_GENDER = "KOREAN_MALE" | |
| } |
| private fun fetchMalePendingMatchings() { | ||
| if (_uiState.value.isWaiting) return | ||
|
|
||
| viewModelScope.launch { | ||
| _uiState.update { it.copy(isLoading = true) } | ||
| runCatching { | ||
| matchingService.getMalePendingMatchings().awaitResponse() | ||
| }.onSuccess { response -> | ||
| Log.d( | ||
| TAG, | ||
| "getMalePendingMatchings success=${response.isSuccessful} code=${response.code()}" | ||
| ) | ||
| if (response.isSuccessful) { | ||
| val body = response.body().orEmpty() | ||
| Log.d(TAG, "getMalePendingMatchings body=$body") | ||
| val data = body.map { it.toHomeMatching() } | ||
| if (data.isEmpty()) { | ||
| _uiState.update { | ||
| it.copy( | ||
| isLoading = false, | ||
| matchings = emptyList(), | ||
| selectedMatching = null, | ||
| isWaiting = true | ||
| ) | ||
| } | ||
| } else { | ||
| _uiState.update { | ||
| it.copy( | ||
| isLoading = false, | ||
| matchings = data, | ||
| selectedMatching = null, | ||
| isWaiting = false | ||
| ) | ||
| } | ||
| } | ||
| } else { | ||
| _uiState.update { | ||
| it.copy( | ||
| isLoading = false, | ||
| matchings = emptyList(), | ||
| selectedMatching = null, | ||
| isWaiting = true | ||
| ) | ||
| } | ||
| } | ||
| }.onFailure { throwable -> | ||
| Log.e(TAG, "getMalePendingMatchings failed", throwable) | ||
| _uiState.update { | ||
| it.copy( | ||
| isLoading = false, | ||
| matchings = emptyList(), | ||
| selectedMatching = null, | ||
| isWaiting = true | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } |
Copilot
AI
Jan 8, 2026
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.
This function has significant code duplication with fetchFemaleMatchings. The logic for handling loading states, empty data, success, and failure cases is identical. Consider extracting the common logic into a reusable helper function that accepts the API call and data transformation as parameters to improve maintainability and reduce duplication.
작업내용