Skip to content

Conversation

l5x5l
Copy link
Contributor

@l5x5l l5x5l commented Aug 7, 2025

[ PR Content ]

감정 구슬과 관련된 아래 문제점을 수정합니다.

  • 감정구슬 선택 후 즉시 홈 화면에 반영되지 않는 문제 수정
  • 감정구슬 선택 후 루틴 목록에서 다시 뒤로 돌아갈 때 감정 구슬을 선택할 수 없는 문제
  • 감정구슬 관련 데이터 통일

Related issue

Screenshot 📸

KakaoTalk_Video_2025-08-07-19-10-19.mp4

Work Description

  • 감정구슬 변경 이벤트를 홈 화면에서 감지하여 감정구슬 선택 후 바로 반영되도록 수정
  • 감정구슬 선택 후 추틴 선택 화면에서 뒤로가기 버튼 및 프로그래스바 제거
  • 감정구슬 관련 데이터 통일

To Reviewers 📢

  • 감정 구슬 이미지는 서버에서 받아온걸 사용하되, 에러 발생시 기존 로컬에 존재하는 asset 을 사용하도록 구현했습니다!
  • 이외 궁금한 점 있다면 코멘트 부탁드립니다!

Summary by CodeRabbit

  • 신규 기능

    • 감정 변경 이벤트를 실시간으로 감지할 수 있는 플로우 및 관련 유스케이스가 추가되었습니다.
    • Coil 라이브러리를 도입하여 감정 이미지가 URL 기반으로 네트워크에서 비동기 로드됩니다.
  • 기능 개선

    • 감정 데이터 구조가 enum에서 데이터 클래스로 변경되어 유연하게 확장 가능합니다.
    • 감정 선택 및 등록 방식이 enum 기반에서 문자열 기반으로 변경되었습니다.
    • 감정 추천 루틴 화면 및 감정 화면 UI가 개선되고, 이미지 로딩이 향상되었습니다.
  • 버그 수정

    • 감정 관련 데이터 매핑 및 상태 관리가 일관성 있게 동작하도록 개선되었습니다.
  • 기타

    • 불필요한 enum 및 데이터 클래스, 유스케이스 파일이 삭제되었습니다.
    • 의존성 및 빌드 설정에 Coil 번들이 추가되었습니다.

@l5x5l l5x5l requested a review from wjdrjs00 August 7, 2025 10:19
@l5x5l l5x5l self-assigned this Aug 7, 2025
@l5x5l l5x5l added 🔨 Refactor 기존 기능 개선 🐞 Fix 버그 수정 세환 labels Aug 7, 2025
Copy link

coderabbitai bot commented Aug 7, 2025

Walkthrough

감정 구슬(Emotion Marble) 관련 데이터 모델, 도메인, 프레젠테이션 계층 전반에 걸쳐 대대적인 구조 변경이 이루어졌습니다. 감정 구슬 API 응답 구조가 통합되고, enum 기반 감정 모델이 data class 기반으로 변경되었으며, 감정 변경 이벤트 플로우가 도입되었습니다. UI에서는 Coil 이미지 로딩 라이브러리 도입과 감정 구슬 선택/등록 및 추천 루틴 화면 흐름이 수정되었습니다.

Changes

Cohort / File(s) Change Summary
데이터 계층: 감정 구슬 API/모델 통합
data/src/main/java/com/threegap/bitnagil/data/emotion/datasource/EmotionDataSource.kt, data/src/main/java/com/threegap/bitnagil/data/emotion/datasourceImpl/EmotionDataSourceImpl.kt, data/src/main/java/com/threegap/bitnagil/data/emotion/model/response/GetEmotionResponse.kt, data/src/main/java/com/threegap/bitnagil/data/emotion/service/EmotionService.kt
감정 구슬 조회 메서드 명칭 및 반환 타입 변경(getMyEmotionMarblegetEmotionMarble, DTO 통일), 응답 DTO 클래스명 및 구조 변경, 서비스 인터페이스 시그니처 일치화
도메인 계층: 모델/이벤트/유스케이스 리팩토링
domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/Emotion.kt, domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/EmotionChangeEvent.kt, domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/MyEmotion.kt, domain/src/main/java/com/threegap/bitnagil/domain/emotion/repository/EmotionRepository.kt, domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/GetEmotionChangeEventFlowUseCase.kt, domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/GetEmotionUseCase.kt, domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/GetMyEmotionUseCase.kt, domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/RegisterEmotionUseCase.kt
감정 enum → data class로 변경, 감정 변경 이벤트 도입, 감정 구슬/등록 관련 유스케이스 및 레포지토리 메서드 시그니처 변경, MyEmotion 관련 코드 삭제, 이벤트 플로우 유스케이스 추가
레포지토리 구현 및 이벤트 흐름
data/src/main/java/com/threegap/bitnagil/data/emotion/repositoryImpl/EmotionRepositoryImpl.kt
감정 등록/조회 메서드 시그니처 및 내부 로직 변경, 감정 변경 이벤트 SharedFlow 도입 및 노출
프레젠테이션 계층: 모델/상태/인텐트/뷰모델/스크린 리팩토링
presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionScreen.kt, presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt, presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/Emotion.kt, presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/EmotionUiModel.kt, presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/mvi/EmotionIntent.kt, presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/mvi/EmotionState.kt
Emotion enum 삭제, EmotionUiModel 도입 및 UI 데이터 구조/상태/인텐트 전환, 감정 선택 콜백 타입 변경, Coil 이미지 로딩 적용, UI 흐름(뒤로가기 등) 및 추천루틴 화면 구조 수정
홈 화면 감정 구슬 반영 및 이벤트 구독
presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeViewModel.kt, presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/EmotionBallType.kt
감정 구슬 변경 이벤트 플로우 구독 및 즉시 반영, 감정 구슬 타입 변환 함수 파라미터 변경
Coil 의존성 추가
gradle/libs.versions.toml, presentation/build.gradle.kts
Coil 라이브러리 버전/번들 추가 및 프레젠테이션 모듈에 의존성 적용
DTO → 도메인 변환 함수 추가
data/src/main/java/com/threegap/bitnagil/data/emotion/model/dto/EmotionDto.kt
EmotionDto에서 도메인 모델로 변환하는 toDomain() 함수 추가

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant EmotionScreen
    participant EmotionViewModel
    participant RegisterEmotionUseCase
    participant EmotionRepositoryImpl
    participant EmotionDataSourceImpl
    participant EmotionService

    User->>EmotionScreen: 감정 구슬 클릭
    EmotionScreen->>EmotionViewModel: onClickEmotion(emotionType)
    EmotionViewModel->>RegisterEmotionUseCase: invoke(emotionType)
    RegisterEmotionUseCase->>EmotionRepositoryImpl: registerEmotion(emotionType)
    EmotionRepositoryImpl->>EmotionDataSourceImpl: registerEmotion(emotionType)
    EmotionDataSourceImpl->>EmotionService: registerEmotion API 호출
    EmotionService-->>EmotionDataSourceImpl: 응답 반환
    EmotionDataSourceImpl-->>EmotionRepositoryImpl: 결과 반환
    EmotionRepositoryImpl-->>RegisterEmotionUseCase: 결과 반환 및 EmotionChangeEvent 발행
    RegisterEmotionUseCase-->>EmotionViewModel: 결과 반환
    EmotionViewModel-->>EmotionScreen: 상태 업데이트
    EmotionRepositoryImpl-->>EmotionChangeEventFlow: ChangeEmotion 이벤트 발행
    EmotionChangeEventFlow-->>HomeViewModel: 감정 구슬 변경 이벤트 감지
    HomeViewModel->>EmotionRepositoryImpl: getEmotionMarble(오늘 날짜)
    EmotionRepositoryImpl->>EmotionDataSourceImpl: getEmotionMarble(오늘 날짜)
    EmotionDataSourceImpl->>EmotionService: getEmotionMarble API 호출
    EmotionService-->>EmotionDataSourceImpl: 응답 반환
    EmotionDataSourceImpl-->>EmotionRepositoryImpl: 결과 반환
    EmotionRepositoryImpl-->>HomeViewModel: 결과 반환
    HomeViewModel-->>UI: 감정 구슬 즉시 반영
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Assessment against linked issues

Objective Addressed Explanation
감정구슬 선택 후 즉시 홈 화면에 반영하도록 수정 (#73)
추천루틴을 등록/건너뛰지 않고 다시 돌아온 경우 감정구슬 선택이 가능하거나, 뒤로가기 흐름 제거 (#73)
감정 구슬 조회 API 응답을 홈 화면의 감정 구슬 조회 API 응답 구조로 통일 (#73)

Assessment against linked issues: Out-of-scope changes

(해당 사항 없음)

Possibly related PRs

Suggested reviewers

  • wjdrjs00

Poem

감정 구슬이 반짝반짝
enum은 안녕, data class 등장!
Coil로 이미지는 쏙쏙
이벤트 흐름도 반영 착착
홈 화면엔 감정이 즉시 뿅!
토끼는 오늘도 코드를 뚝딱
🐰✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/#73-motion

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (8)
presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/EmotionBallType.kt (1)

45-46: 메서드 시그니처 변경 승인 및 예외 처리 고려

도메인 Emotion enum에서 String 파라미터로 변경한 것이 새로운 도메인 모델 구조와 일치합니다. 파라미터명 emotionMarbleType도 더 명확합니다.

다만 valueOf(it)는 유효하지 않은 문자열에 대해 IllegalArgumentException을 발생시킬 수 있습니다. 예외 처리를 고려해보세요:

fun fromDomainEmotion(emotionMarbleType: String?): EmotionBallType? =
-    emotionMarbleType?.let { valueOf(it) }
+    emotionMarbleType?.let { 
+        try { 
+            valueOf(it) 
+        } catch (e: IllegalArgumentException) { 
+            null 
+        }
+    }
data/src/main/java/com/threegap/bitnagil/data/emotion/model/response/GetEmotionResponse.kt (1)

17-27: 안전한 null 처리가 적용된 도메인 매핑 함수입니다.

모든 필드가 non-null일 때만 Emotion 객체를 생성하는 보수적인 접근 방식이 적용되었습니다. 이는 안전한 프로그래밍 방식입니다.

다만, PR 설명에 따르면 "서버에서 이미지를 가져오지만 오류 발생 시 로컬 에셋을 사용"한다고 했는데, imageUrl이 null인 경우에도 다른 필드들이 유효하다면 객체를 생성하고 이미지는 프레젠테이션 레이어에서 폴백 처리하는 방법도 고려해볼 수 있습니다.

domain/src/main/java/com/threegap/bitnagil/domain/emotion/repository/EmotionRepository.kt (1)

12-12: Flow 반환 타입 재고려 필요

getEmotionChangeEventFlow()Flow를 반환하는데, 구독자가 여러 개일 경우를 고려하면 SharedFlowStateFlow를 반환하는 것이 더 적절할 수 있습니다. Repository 구현체에서 이미 SharedFlow를 사용하고 있으므로 인터페이스도 이를 명시하는 것이 좋습니다.

-    suspend fun getEmotionChangeEventFlow(): Flow<EmotionChangeEvent>
+    fun getEmotionChangeEventFlow(): SharedFlow<EmotionChangeEvent>
data/src/main/java/com/threegap/bitnagil/data/emotion/repositoryImpl/EmotionRepositoryImpl.kt (1)

23-33: 이벤트 발행 로직 개선 가능

also 블록 대신 더 명확한 방식으로 성공 시 이벤트를 발행하는 것이 좋습니다.

 override suspend fun registerEmotion(emotionMarbleType: String): Result<List<EmotionRecommendRoutine>> {
-    return emotionDataSource.registerEmotion(emotionMarbleType).map {
-        it.recommendedRoutines.map {
-                emotionRecommendedRoutineDto ->
-            emotionRecommendedRoutineDto.toEmotionRecommendRoutine()
-        }
-    }.also {
-        if (it.isSuccess) {
-            _emotionChangeEventFlow.emit(EmotionChangeEvent.ChangeEmotion(emotionMarbleType))
-        }
+    val result = emotionDataSource.registerEmotion(emotionMarbleType).map {
+        it.recommendedRoutines.map { dto ->
+            dto.toEmotionRecommendRoutine()
+        }
     }
+    
+    result.onSuccess {
+        _emotionChangeEventFlow.emit(EmotionChangeEvent.ChangeEmotion(emotionMarbleType))
+    }
+    
+    return result
 }
presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeViewModel.kt (1)

245-252: 날짜 처리 로직 검토 필요

감정 변경 이벤트 발생 시 항상 LocalDate.now()를 사용하는데, 사용자가 과거 날짜를 보고 있을 때도 오늘 날짜의 감정을 갱신합니다. 현재 선택된 날짜와 비교하는 로직이 필요할 수 있습니다.

 private fun observeEmotionChangeEvent() {
     viewModelScope.launch {
         getEmotionChangeEventFlowUseCase().collect {
             val currentDate = LocalDate.now()
-            getMyEmotion(currentDate)
+            // 현재 선택된 날짜가 오늘인 경우에만 갱신
+            if (stateFlow.value.selectedDate == currentDate) {
+                getMyEmotion(currentDate)
+            }
         }
     }
 }
presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionScreen.kt (3)

128-136: 이미지 로딩 구현이 좋지만 URL 검증 추가를 고려하세요

AsyncImage 구현과 오프라인 백업 이미지 폴백이 잘 되어 있습니다. 하지만 imageUrl이 null이거나 빈 문자열일 경우를 대비한 검증을 추가하면 더 안정적일 것 같습니다.

 AsyncImage(
     model = ImageRequest.Builder(LocalContext.current)
-        .data(emotion.imageUrl)
+        .data(emotion.imageUrl.takeIf { it.isNotBlank() })
         .crossfade(true)
         .build(),

186-194: forEach 사용을 고려해보세요

for 루프도 동작하지만, Kotlin 관례상 forEach를 사용하는 것이 더 관용적입니다.

-for (recommendRoutine in state.recommendRoutines) {
+state.recommendRoutines.forEach { recommendRoutine ->
     BitnagilSelectButton(
         title = recommendRoutine.name,
         description = recommendRoutine.description,
         onClick = { onClickRoutine(recommendRoutine.id) },
         selected = recommendRoutine.selected,
         modifier = Modifier.padding(bottom = 12.dp),
     )
 }

227-240: Preview에서 실제 URL 대신 로컬 리소스 사용을 고려하세요

Preview 렌더링 시 네트워크 요청을 피하기 위해 로컬 drawable 리소스나 더미 URL을 사용하는 것이 좋습니다.

 EmotionUiModel(
     emotionType = "emotionType",
-    imageUrl = "https://bitnagil-s3.s3.ap-northeast-2.amazonaws.com/home_satisfaction.png",
+    imageUrl = "", // Preview에서는 offlineBackupImageResourceId 사용
     emotionMarbleName = "emotionMarbleName",
-    offlineBackupImageResourceId = null,
+    offlineBackupImageResourceId = R.drawable.ic_emotion_placeholder,
 ),

Also applies to: 257-264

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between af43a04 and e615480.

📒 Files selected for processing (24)
  • data/src/main/java/com/threegap/bitnagil/data/emotion/datasource/EmotionDataSource.kt (1 hunks)
  • data/src/main/java/com/threegap/bitnagil/data/emotion/datasourceImpl/EmotionDataSourceImpl.kt (2 hunks)
  • data/src/main/java/com/threegap/bitnagil/data/emotion/model/dto/EmotionDto.kt (2 hunks)
  • data/src/main/java/com/threegap/bitnagil/data/emotion/model/response/GetEmotionResponse.kt (2 hunks)
  • data/src/main/java/com/threegap/bitnagil/data/emotion/repositoryImpl/EmotionRepositoryImpl.kt (1 hunks)
  • data/src/main/java/com/threegap/bitnagil/data/emotion/service/EmotionService.kt (2 hunks)
  • domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/Emotion.kt (1 hunks)
  • domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/EmotionChangeEvent.kt (1 hunks)
  • domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/MyEmotion.kt (0 hunks)
  • domain/src/main/java/com/threegap/bitnagil/domain/emotion/repository/EmotionRepository.kt (1 hunks)
  • domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/GetEmotionChangeEventFlowUseCase.kt (1 hunks)
  • domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/GetEmotionUseCase.kt (1 hunks)
  • domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/GetMyEmotionUseCase.kt (0 hunks)
  • domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/RegisterEmotionUseCase.kt (1 hunks)
  • gradle/libs.versions.toml (3 hunks)
  • presentation/build.gradle.kts (1 hunks)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionScreen.kt (7 hunks)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt (4 hunks)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/Emotion.kt (0 hunks)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/EmotionUiModel.kt (1 hunks)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/mvi/EmotionIntent.kt (1 hunks)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/mvi/EmotionState.kt (1 hunks)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeViewModel.kt (5 hunks)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/home/model/EmotionBallType.kt (1 hunks)
💤 Files with no reviewable changes (3)
  • domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/GetMyEmotionUseCase.kt
  • presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/Emotion.kt
  • domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/MyEmotion.kt
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: in the bitnagil android project's mvi architecture, intent classes like `loadmypagesuccess` are name...
Learnt from: l5x5l
PR: YAPP-Github/Bitnagil-Android#41
File: presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/model/MyPageIntent.kt:6-6
Timestamp: 2025-07-23T13:32:26.263Z
Learning: In the Bitnagil Android project's MVI architecture, Intent classes like `LoadMyPageSuccess` are named to represent successful API response results that carry loaded data, not just user actions. This naming convention is used for future API integration where the intent will be triggered when my page data loading succeeds from the server.

Applied to files:

  • presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt
  • presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/mvi/EmotionIntent.kt
📚 Learning: in the bitnagil android project, mvistate interface extends parcelable, so any class implementing mv...
Learnt from: l5x5l
PR: YAPP-Github/Bitnagil-Android#41
File: presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/model/MyPageState.kt:6-14
Timestamp: 2025-07-23T13:31:46.809Z
Learning: In the Bitnagil Android project, MviState interface extends Parcelable, so any class implementing MviState automatically implements Parcelable. Therefore, Parcelize annotation works correctly without explicitly adding Parcelable implementation.

Applied to files:

  • presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/mvi/EmotionState.kt
  • presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/EmotionUiModel.kt
🧬 Code Graph Analysis (3)
presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt (1)
presentation/src/main/java/com/threegap/bitnagil/presentation/common/mviviewmodel/MviViewModel.kt (1)
  • sendIntent (30-37)
data/src/main/java/com/threegap/bitnagil/data/emotion/datasourceImpl/EmotionDataSourceImpl.kt (1)
data/src/main/java/com/threegap/bitnagil/data/common/SafeApiCall.kt (1)
  • safeApiCall (10-25)
presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionScreen.kt (2)
core/designsystem/src/main/java/com/threegap/bitnagil/designsystem/component/atom/BitnagilSelectButton.kt (1)
  • BitnagilSelectButton (30-96)
core/designsystem/src/main/java/com/threegap/bitnagil/designsystem/component/atom/BitnagilTextButton.kt (1)
  • BitnagilTextButton (33-83)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (24)
gradle/libs.versions.toml (1)

55-55: Coil 라이브러리 의존성 추가가 적절합니다.

이미지 로딩 기능을 위한 Coil3 라이브러리 의존성이 올바르게 추가되었습니다. 버전 3.3.0은 최신 안정 버전이며, compose 통합과 네트워크 지원을 위한 두 라이브러리와 번들 구성이 적절합니다.

Also applies to: 119-121, 179-182

presentation/build.gradle.kts (1)

22-22: Coil 번들 의존성 추가가 올바릅니다.

프레젠테이션 모듈에 Coil 이미지 로딩 라이브러리 번들이 적절하게 추가되었습니다. 감정 구슬 이미지 로딩 기능에 필요한 의존성입니다.

data/src/main/java/com/threegap/bitnagil/data/emotion/model/dto/EmotionDto.kt (1)

3-3: 도메인 변환 메서드 구현이 적절합니다.

EmotionDto에서 도메인 Emotion 모델로 변환하는 toDomain() 메서드가 올바르게 구현되었습니다. 필드 매핑이 명확하고 데이터 무결성을 유지합니다.

Also applies to: 15-22

domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/RegisterEmotionUseCase.kt (1)

10-11: 매개변수 타입 변경이 아키텍처 개선과 일치합니다.

Emotion enum에서 String emotionType으로의 매개변수 변경이 적절합니다. 전체 리팩토링과 일관성을 유지하며, 유스케이스의 단일 책임을 유지합니다.

domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/Emotion.kt (1)

3-7: enum에서 data class로의 모델 변경이 아키텍처를 크게 개선합니다.

고정된 enum 상수에서 유연한 data class 모델로의 변경은 탁월한 아키텍처 개선입니다. 이 변경으로 다음과 같은 이점을 얻습니다:

  • 서버 주도의 동적 감정 타입 지원
  • 감정별 이미지 URL을 통한 시각적 표현 향상
  • 다국어 지원 및 커스터마이징 가능성 확대
  • 컴파일 타임 제약에서 런타임 유연성으로 전환

data class 설계가 깔끔하고 모든 필드가 non-nullable로 설정되어 데이터 무결성을 보장합니다.

presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/mvi/EmotionIntent.kt (2)

5-5: 적절한 import 변경

도메인 계층의 Emotion에서 프레젠테이션 계층의 EmotionUiModel로 import가 변경된 것이 올바릅니다. 프레젠테이션 계층이 도메인 모델에 직접 의존하지 않고 UI 전용 모델을 사용하는 것은 좋은 아키텍처 패턴입니다.


8-8: UI 모델로의 타입 변경 승인

EmotionListLoadSuccess의 프로퍼티 타입이 List<Emotion>에서 List<EmotionUiModel>로 변경된 것이 적절합니다. 프로퍼티명 emotionTypeUiModels도 UI 모델임을 명확히 나타내어 가독성이 좋습니다.

domain/src/main/java/com/threegap/bitnagil/domain/emotion/model/EmotionChangeEvent.kt (1)

3-5: 이벤트 기반 아키텍처 도입 승인

감정 변경을 위한 이벤트 시스템 도입이 적절합니다. Sealed interface를 사용한 것은 타입 안전성과 exhaustive when 표현식을 가능하게 하는 좋은 선택입니다. String 기반의 emotionType도 새로운 도메인 모델 구조와 일관성 있게 맞춰져 있습니다.

presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/mvi/EmotionState.kt (2)

7-7: 적절한 import 업데이트

EmotionUiModel import 추가가 타입 변경과 일치합니다.


13-13: 프로퍼티명 및 타입 변경 승인

emotions에서 emotionTypeUiModels로 프로퍼티명이 변경되어 더 명확하고 구체적입니다. List<EmotionUiModel> 타입 변경도 전체 리팩토링과 일관성 있게 진행되었으며, 컴패니언 객체의 초기값도 올바르게 업데이트되었습니다.

Also applies to: 20-20

data/src/main/java/com/threegap/bitnagil/data/emotion/datasource/EmotionDataSource.kt (2)

4-4: 적절한 import 변경

MyEmotionResponseDto에서 GetEmotionResponse로의 import 변경이 리턴 타입 변경과 일치합니다.


10-10: 모든 구현체에서 getEmotionMarble 일관 적용 확인

  • 이전 getMyEmotionMarble 호출은 더 이상 존재하지 않습니다.
  • EmotionDataSourceImpl, EmotionService, EmotionRepositoryImpl, UseCase 등 모든 계층에서 getEmotionMarble(currentDate: String): Result<…>로 일관되게 적용된 것을 확인했습니다.
    인터페이스 변경에 따른 누락된 구현체나 메서드 불일치가 없습니다.
domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/GetEmotionUseCase.kt (1)

7-12: 간단하고 명확한 유스케이스 구현입니다.

클린 아키텍처 패턴을 잘 따르고 있으며, nullable 반환 타입 Emotion?도 특정 날짜에 감정 구슬이 없을 수 있다는 비즈니스 로직을 적절히 반영하고 있습니다.

data/src/main/java/com/threegap/bitnagil/data/emotion/datasourceImpl/EmotionDataSourceImpl.kt (1)

28-31: 메서드명과 반환 타입 변경이 일관되게 적용되었습니다.

getMyEmotionMarble에서 getEmotionMarble로의 이름 변경과 GetEmotionResponse 타입 사용이 전체 레이어에 걸쳐 일관성 있게 적용되었습니다. safeApiCall을 통한 안전한 API 호출 처리도 적절합니다.

domain/src/main/java/com/threegap/bitnagil/domain/emotion/usecase/GetEmotionChangeEventFlowUseCase.kt (1)

8-12: 감정 변경 이벤트의 반응형 처리를 위한 적절한 유스케이스입니다.

이 유스케이스는 PR의 주요 목표 중 하나인 "감정 구슬 선택 후 홈 화면에 즉시 반영"을 위한 반응형 아키텍처를 지원합니다. Flow 패턴을 활용한 이벤트 스트림 처리가 적절하게 구현되었습니다.

data/src/main/java/com/threegap/bitnagil/data/emotion/service/EmotionService.kt (1)

23-25: API 인터페이스 업데이트가 일관성 있게 적용되었습니다.

메서드명 변경과 응답 타입 업데이트가 데이터 레이어의 다른 컴포넌트들과 일관되게 적용되었습니다. REST 엔드포인트는 그대로 유지되어 API 호환성을 보장합니다.

presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionViewModel.kt (1)

11-11: 변경 사항이 적절합니다!

도메인 모델 리팩토링에 따라 EmotionUiModel로의 전환이 올바르게 구현되었습니다.

Also applies to: 39-39, 53-53

presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/model/EmotionUiModel.kt (1)

8-14: 데이터 클래스 구조가 적절합니다!

Parcelable 구현과 nullable 오프라인 백업 이미지 리소스 ID 사용이 적절합니다.

data/src/main/java/com/threegap/bitnagil/data/emotion/repositoryImpl/EmotionRepositoryImpl.kt (1)

17-21: 간결한 매핑 구현이 좋습니다!

toDomain() 확장 함수를 사용한 매핑이 깔끔합니다.

presentation/src/main/java/com/threegap/bitnagil/presentation/home/HomeViewModel.kt (1)

317-319: nullable 처리가 적절합니다!

GetEmotionUseCase 사용과 nullable emotion 처리가 올바르게 구현되었습니다.

presentation/src/main/java/com/threegap/bitnagil/presentation/emotion/EmotionScreen.kt (4)

8-8: import 변경사항이 적절합니다

Coil 라이브러리를 사용한 네트워크 이미지 로딩과 새로운 데이터 모델 구조에 필요한 import들이 올바르게 추가되었습니다.

Also applies to: 25-25, 32-34, 44-44


71-76: 루틴 추천 화면에서 뒤로가기 버튼 제거가 적절합니다

사용자가 루틴을 선택하지 않고 뒤로 가는 것을 방지하여 감정 구슬 재선택 불가 문제를 해결합니다. 사용자는 이제 명시적으로 "건너뛰기"를 선택해야 합니다.


84-84: 콜백 파라미터 타입 변경이 적절합니다

enum에서 String 기반으로 변경되어 서버에서 동적으로 감정 타입을 받을 수 있게 되었습니다.


159-217: 루틴 추천 화면 UI 개선이 잘 되었습니다

프로그레스 바 제거와 정적 텍스트로의 변경이 적절합니다. 스크롤 가능한 리스트와 건너뛰기 버튼의 시각적 구분(밑줄)도 UX 측면에서 좋은 선택입니다.

Copy link
Member

@wjdrjs00 wjdrjs00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다~!

@l5x5l l5x5l merged commit 7de8c13 into develop Aug 7, 2025
2 checks passed
@l5x5l l5x5l deleted the fix/#73-motion branch August 7, 2025 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
세환 🐞 Fix 버그 수정 🔨 Refactor 기존 기능 개선
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FIX] 감정 구슬 관련 기능 수정
2 participants