-
Notifications
You must be signed in to change notification settings - Fork 1
뱃지 상세 화면 구현 및 배지 실시간 알림 SSE 연동 #147
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
Merged
The head ref may contain hidden characters: "feat/#119-\uBC43\uC9C0-\uC0C1\uC138-\uD654\uBA74-\uAD6C\uD604-\uBC0F-sse-\uC5F0\uB3D9"
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
522614c
feat: 뱃지 시스템 고도화 및 실시간 이벤트 연동 (SSE)
moondev03 01db47c
refactor: 뱃지 SSE 스트림 구현 방식 개선 및 데이터 모델 정합성 확보
moondev03 9238675
feat: Merge develop -> feat/#119
moondev03 a53f120
feat: 배지 획득 알림 스낵바 개선 및 코드 정리
moondev03 fe05679
Merge branch 'develop' into feat/#119-뱃지-상세-화면-구현-및-sse-연동
moondev03 940ad58
feat: 뱃지 상세 정보 조회 기능 구현 및 UI 컴포넌트 구조 개선
moondev03 9996b53
refactor: 뱃지 상세 정보 UI 개선 및 로딩 상태 제거
moondev03 eb00b26
refactor: 스플래시 전환 로직 개선 및 마이페이지 배경색 추가
moondev03 5244265
refactor: BadgeDetailModal UI 컴포넌트 구조 개선 및 함수 추출
moondev03 588a8f6
fix: 스낵바 위치 결정을 위한 `shouldShowNavigationBar` 상태 참조 방식 개선
moondev03 6ef2f8f
refactor: 뱃지 이벤트 SSE 스트림 재연결 로직 개선 및 설정 조정
moondev03 c90fb81
refactor: badge 모듈 하드코딩 문자열 리소스화 및 UI 반영
moondev03 eb70c2e
refactor: 뱃지 상세 조회 실패 시 피드백 노출 로직 수정
moondev03 88e3fd8
feat: 뱃지 이미지 로드 실패 처리 및 상세 화면 UI 로직 개선
moondev03 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
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
66 changes: 66 additions & 0 deletions
66
Prezel/core/data/src/main/java/com/team/prezel/core/data/repository/BadgeRepositoryImpl.kt
This file contains hidden or 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,66 @@ | ||
| package com.team.prezel.core.data.repository | ||
|
|
||
| import com.team.prezel.core.data.error.mapDomainFailure | ||
| import com.team.prezel.core.domain.repository.badge.BadgeRepository | ||
| import com.team.prezel.core.model.badge.Badge | ||
| import com.team.prezel.core.model.badge.BadgeDetail | ||
| import com.team.prezel.core.model.badge.BadgeEvent | ||
| import com.team.prezel.core.network.datasource.BadgeRemoteDataSource | ||
| import com.team.prezel.core.network.model.badge.BadgeEventResponse | ||
| import com.team.prezel.core.network.model.badge.GetBadgeDetailResponse | ||
| import com.team.prezel.core.network.model.badge.GetBadgeResponse | ||
| import kotlinx.coroutines.flow.Flow | ||
| import kotlinx.coroutines.flow.map | ||
| import javax.inject.Inject | ||
|
|
||
| internal class BadgeRepositoryImpl @Inject constructor( | ||
| private val badgeRemoteDataSource: BadgeRemoteDataSource, | ||
| ) : BadgeRepository { | ||
| override suspend fun getBadges(): Result<List<Badge>> = | ||
| runCatching { | ||
| badgeRemoteDataSource.getBadges() | ||
| }.mapCatching { response -> | ||
| response.map(GetBadgeResponse::toDomain) | ||
| }.mapDomainFailure() | ||
|
|
||
| override suspend fun getBadgeDetail(badgeCode: String): Result<BadgeDetail> = | ||
| runCatching { | ||
| badgeRemoteDataSource.getBadgeDetail(badgeCode = badgeCode) | ||
| }.mapCatching(GetBadgeDetailResponse::toDomain) | ||
| .mapDomainFailure() | ||
|
|
||
| override fun connectBadgeEventStream(): Flow<BadgeEvent> = | ||
| badgeRemoteDataSource | ||
| .connectBadgeEventStream() | ||
| .map(BadgeEventResponse::toDomain) | ||
| } | ||
|
|
||
| private fun GetBadgeResponse.toDomain(): Badge = | ||
| Badge( | ||
| badgeCode = badgeCode, | ||
| badgeName = badgeName, | ||
| isUnlocked = isUnlocked, | ||
| imageUrl = imageUrl, | ||
| unlockedAt = unlockedAt, | ||
| ) | ||
|
|
||
| private fun GetBadgeDetailResponse.toDomain(): BadgeDetail = | ||
| BadgeDetail( | ||
| badgeCode = badgeCode, | ||
| badgeName = badgeName, | ||
| conditionText = conditionText, | ||
| detailDescription = detailDescription, | ||
| imageUrl = imageUrl, | ||
| isUnlocked = isUnlocked, | ||
| unlockedAt = unlockedAt, | ||
| ) | ||
|
|
||
| private fun BadgeEventResponse.toDomain(): BadgeEvent = | ||
| BadgeEvent( | ||
| badgeCode = badgeCode, | ||
| badgeName = badgeName, | ||
| introduction = introduction, | ||
| imageUrl = imageUrl, | ||
| message = message, | ||
| rawData = rawData, | ||
| ) |
14 changes: 14 additions & 0 deletions
14
...re/domain/src/main/kotlin/com/team/prezel/core/domain/repository/badge/BadgeRepository.kt
This file contains hidden or 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.team.prezel.core.domain.repository.badge | ||
|
|
||
| import com.team.prezel.core.model.badge.Badge | ||
| import com.team.prezel.core.model.badge.BadgeDetail | ||
| import com.team.prezel.core.model.badge.BadgeEvent | ||
| import kotlinx.coroutines.flow.Flow | ||
|
|
||
| interface BadgeRepository { | ||
| suspend fun getBadges(): Result<List<Badge>> | ||
|
|
||
| suspend fun getBadgeDetail(badgeCode: String): Result<BadgeDetail> | ||
|
|
||
| fun connectBadgeEventStream(): Flow<BadgeEvent> | ||
| } |
12 changes: 12 additions & 0 deletions
12
...c/main/kotlin/com/team/prezel/core/domain/usecase/badge/ConnectBadgeEventStreamUseCase.kt
This file contains hidden or 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.team.prezel.core.domain.usecase.badge | ||
|
|
||
| import com.team.prezel.core.domain.repository.badge.BadgeRepository | ||
| import com.team.prezel.core.model.badge.BadgeEvent | ||
| import kotlinx.coroutines.flow.Flow | ||
| import javax.inject.Inject | ||
|
|
||
| class ConnectBadgeEventStreamUseCase @Inject constructor( | ||
| private val badgeRepository: BadgeRepository, | ||
| ) { | ||
| operator fun invoke(): Flow<BadgeEvent> = badgeRepository.connectBadgeEventStream() | ||
| } |
11 changes: 11 additions & 0 deletions
11
...main/src/main/kotlin/com/team/prezel/core/domain/usecase/badge/FetchBadgeDetailUseCase.kt
This file contains hidden or 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.team.prezel.core.domain.usecase.badge | ||
|
|
||
| import com.team.prezel.core.domain.repository.badge.BadgeRepository | ||
| import com.team.prezel.core.model.badge.BadgeDetail | ||
| import javax.inject.Inject | ||
|
|
||
| class FetchBadgeDetailUseCase @Inject constructor( | ||
| private val badgeRepository: BadgeRepository, | ||
| ) { | ||
| suspend operator fun invoke(badgeCode: String): Result<BadgeDetail> = badgeRepository.getBadgeDetail(badgeCode = badgeCode) | ||
| } |
11 changes: 11 additions & 0 deletions
11
...re/domain/src/main/kotlin/com/team/prezel/core/domain/usecase/badge/FetchBadgesUseCase.kt
This file contains hidden or 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.team.prezel.core.domain.usecase.badge | ||
|
|
||
| import com.team.prezel.core.domain.repository.badge.BadgeRepository | ||
| import com.team.prezel.core.model.badge.Badge | ||
| import javax.inject.Inject | ||
|
|
||
| class FetchBadgesUseCase @Inject constructor( | ||
| private val badgeRepository: BadgeRepository, | ||
| ) { | ||
| suspend operator fun invoke(): Result<List<Badge>> = badgeRepository.getBadges() | ||
| } |
19 changes: 5 additions & 14 deletions
19
...domain/src/main/kotlin/com/team/prezel/core/domain/usecase/user/FetchUserBadgesUseCase.kt
This file contains hidden or 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,20 +1,11 @@ | ||
| package com.team.prezel.core.domain.usecase.user | ||
|
|
||
| import com.team.prezel.core.domain.usecase.badge.FetchBadgesUseCase | ||
| import com.team.prezel.core.model.badge.Badge | ||
| import com.team.prezel.core.model.badge.BadgeType | ||
| import javax.inject.Inject | ||
| import kotlin.random.Random | ||
|
|
||
| class FetchUserBadgesUseCase @Inject constructor() { | ||
| suspend operator fun invoke(): Result<List<Badge>> = | ||
| runCatching { | ||
| listOf( | ||
| BadgeType.FIRST_PRESENTATION, | ||
| BadgeType.SECOND_ANALYSIS, | ||
| BadgeType.FIRST_PRACTICE, | ||
| BadgeType.RETROSPECT_COMPLETED, | ||
| BadgeType.PERFECT_SCORE, | ||
| BadgeType.TEN_ANALYSIS, | ||
| ).map { type -> Badge(type = type, isAchieved = Random.nextBoolean()) } | ||
| } | ||
| class FetchUserBadgesUseCase @Inject constructor( | ||
| private val fetchBadgesUseCase: FetchBadgesUseCase, | ||
| ) { | ||
| suspend operator fun invoke(): Result<List<Badge>> = fetchBadgesUseCase() | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.