-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #304 from Nexters/feature/Boolti-301
Feature/boolti 301 타인의 프로필 구현
- Loading branch information
Showing
25 changed files
with
241 additions
and
56 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
data/src/main/java/com/nexters/boolti/data/datasource/MemberDataSource.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,11 @@ | ||
package com.nexters.boolti.data.datasource | ||
|
||
import com.nexters.boolti.data.network.api.MemberService | ||
import com.nexters.boolti.data.network.response.MemberResponse | ||
import javax.inject.Inject | ||
|
||
internal class MemberDataSource @Inject constructor( | ||
private val memberService: MemberService, | ||
) { | ||
suspend fun getMember(userCode: String): MemberResponse = memberService.getMember(userCode) | ||
} |
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
12 changes: 12 additions & 0 deletions
12
data/src/main/java/com/nexters/boolti/data/network/api/MemberService.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,12 @@ | ||
package com.nexters.boolti.data.network.api | ||
|
||
import com.nexters.boolti.data.network.response.MemberResponse | ||
import retrofit2.http.GET | ||
import retrofit2.http.Path | ||
|
||
internal interface MemberService { | ||
@GET("/app/papi/v1/users/{userCode}") | ||
suspend fun getMember( | ||
@Path("userCode") userCode: String, | ||
): MemberResponse | ||
} |
22 changes: 22 additions & 0 deletions
22
data/src/main/java/com/nexters/boolti/data/network/response/MemberResponse.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,22 @@ | ||
package com.nexters.boolti.data.network.response | ||
|
||
import com.nexters.boolti.domain.model.User | ||
import com.nexters.boolti.domain.request.EditProfileRequest | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
internal data class MemberResponse( | ||
val nickname: String = "", | ||
val userCode: String = "", | ||
val imgPath: String = "", | ||
val introduction: String = "", | ||
val link: List<EditProfileRequest.LinkDto> = emptyList(), | ||
) { | ||
fun toDomain(): User.Others = User.Others( | ||
nickname = nickname, | ||
photo = imgPath, | ||
userCode = userCode, | ||
introduction = introduction, | ||
link = link.map { it.toDomain() }, | ||
) | ||
} |
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
14 changes: 14 additions & 0 deletions
14
data/src/main/java/com/nexters/boolti/data/repository/MemberRepositoryImpl.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,14 @@ | ||
package com.nexters.boolti.data.repository | ||
|
||
import com.nexters.boolti.data.datasource.MemberDataSource | ||
import com.nexters.boolti.domain.model.User | ||
import com.nexters.boolti.domain.repository.MemberRepository | ||
import javax.inject.Inject | ||
|
||
internal class MemberRepositoryImpl @Inject constructor( | ||
private val memberDataSource: MemberDataSource, | ||
) : MemberRepository { | ||
override suspend fun getMember(userCode: String): Result<User.Others> = runCatching { | ||
memberDataSource.getMember(userCode).toDomain() | ||
} | ||
} |
34 changes: 25 additions & 9 deletions
34
domain/src/main/java/com/nexters/boolti/domain/model/User.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 |
---|---|---|
@@ -1,11 +1,27 @@ | ||
package com.nexters.boolti.domain.model | ||
|
||
data class User( | ||
val id: String, | ||
val nickname: String = "", | ||
val email: String = "", | ||
val photo: String? = null, | ||
val userCode: String = "", | ||
val introduction: String = "", | ||
val link: List<Link> = emptyList(), | ||
) | ||
sealed interface User { | ||
val nickname: String | ||
val photo: String? | ||
val userCode: String | ||
val introduction: String | ||
val link: List<Link> | ||
|
||
class My( | ||
val id: String, | ||
override val nickname: String = "", | ||
val email: String = "", | ||
override val photo: String? = null, | ||
override val userCode: String = "", | ||
override val introduction: String = "", | ||
override val link: List<Link> = emptyList(), | ||
) : User | ||
|
||
class Others( | ||
override val nickname: String = "", | ||
override val photo: String? = null, | ||
override val userCode: String = "", | ||
override val introduction: String = "", | ||
override val link: List<Link> = emptyList(), | ||
) : User | ||
} |
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
7 changes: 7 additions & 0 deletions
7
domain/src/main/java/com/nexters/boolti/domain/repository/MemberRepository.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,7 @@ | ||
package com.nexters.boolti.domain.repository | ||
|
||
import com.nexters.boolti.domain.model.User | ||
|
||
interface MemberRepository { | ||
suspend fun getMember(userCode: String): Result<User.Others> | ||
} |
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 |
---|---|---|
|
@@ -82,7 +82,7 @@ fun MyScreen( | |
@Composable | ||
fun MyScreen( | ||
modifier: Modifier = Modifier, | ||
user: User? = null, | ||
user: User.My? = null, | ||
onClickHeaderButton: () -> Unit = {}, | ||
onClickAccountSetting: () -> Unit = {}, | ||
onClickReservations: () -> Unit = {}, | ||
|
@@ -176,7 +176,7 @@ fun MyScreen( | |
@Composable | ||
private fun MyHeader( | ||
modifier: Modifier = Modifier, | ||
user: User? = null, | ||
user: User.My? = null, | ||
onClickButton: () -> Unit, | ||
) { | ||
val shape = RoundedCornerShape( | ||
|
@@ -255,7 +255,7 @@ private fun MyMenu( | |
@Preview("로그인 한 유저 헤더") | ||
@Composable | ||
private fun MyHeaderUserPreview() { | ||
val user = User( | ||
val user = User.My( | ||
id = "", | ||
nickname = "일이삼사오육칠팔구십", | ||
email = "[email protected]", | ||
|
@@ -278,7 +278,7 @@ private fun MyHeaderGuestPreview() { | |
@Preview | ||
@Composable | ||
private fun MyScreenPreview() { | ||
val user = User( | ||
val user = User.My( | ||
id = "", | ||
nickname = "불티유저", | ||
email = "[email protected]", | ||
|
@@ -295,7 +295,7 @@ private fun MyScreenPreview() { | |
@Preview(device = "spec:parent=pixel_5,orientation=landscape") | ||
@Composable | ||
private fun MyScreenLandscapePreview() { | ||
val user = User( | ||
val user = User.My( | ||
id = "", | ||
nickname = "불티유저", | ||
email = "[email protected]", | ||
|
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
6 changes: 6 additions & 0 deletions
6
presentation/src/main/java/com/nexters/boolti/presentation/screen/profile/ProfileEvent.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,6 @@ | ||
package com.nexters.boolti.presentation.screen.profile | ||
|
||
sealed interface ProfileEvent { | ||
data object Invalid : ProfileEvent | ||
data object WithdrawUser : ProfileEvent | ||
} |
Oops, something went wrong.