Skip to content

[Feat] Home api#138

Merged
kimjw2003 merged 8 commits into
developfrom
feat/#125-home-api
Jan 19, 2026
Merged

[Feat] Home api#138
kimjw2003 merged 8 commits into
developfrom
feat/#125-home-api

Conversation

@kimjw2003

@kimjw2003 kimjw2003 commented Jan 19, 2026

Copy link
Copy Markdown
Contributor

📮 관련 이슈

📌 작업 내용

  • 홈 api 연결

📸 스크린샷

스크린샷
스크린샷 2026-01-20 오전 4 46 52

😅 미구현

  • [ ]

🫛 To. 리뷰어

일단 급하게 Dto랑 Model 형식 맞추기 위해서 PR 올립니다.
웹뷰, 바텀시트 등 기타 로직은 별도 Issue에서 진행하겠습니다

Summary by CodeRabbit

  • 새 기능

    • 최근 컬렉션, 추천 컬렉션, 북마크된 콘텐츠 조회 및 검색 기능 추가
    • 홈 화면에 ViewModel 기반의 자동 데이터 로드 및 상태 반영 도입
  • 리팩터링

    • ID 타입을 숫자에서 문자열(String)로 통일하여 콜백·모델 인터페이스 정리
    • 컬렉션/콘텐츠 이미지 소스 및 연출 방식 조정
    • UI 프리뷰 및 샘플 데이터 문자열화
  • 기타

    • 사용자 역할에 NONE 값 추가
    • 기본 내비게이션 시작 지점이 홈으로 변경

✏️ Tip: You can customize this high-level summary in your review settings.

@kimjw2003 kimjw2003 self-assigned this Jan 19, 2026
@kimjw2003 kimjw2003 requested a review from a team as a code owner January 19, 2026 19:47
@kimjw2003 kimjw2003 added the 🔖 API feat - API 연동 label Jan 19, 2026
@coderabbitai

coderabbitai Bot commented Jan 19, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

홈 화면용 API/DTO/매퍼/레포지토리와 HomeViewModel 기반 상태 흐름이 추가되었고, 도메인 모델의 ID 타입들이 Long에서 String으로 변경되었습니다. UI 콜백 시그니처와 프리뷰 데이터, 네비게이션 시작점 및 TokenInterceptor의 Authorization 헤더가 수정되었습니다.

Changes

Cohort / File(s) 변경 요약
네트워크 - API 인터페이스
app/src/main/java/com/flint/data/api/CollectionApi.kt, app/src/main/java/com/flint/data/api/ContentApi.kt, app/src/main/java/com/flint/data/api/HomeApi.kt, app/src/main/java/com/flint/data/api/SearchApi.kt
Retrofit GET 메서드 추가: recent/recommended/bookmarks/search 관련 엔드포인트 메서드 추가
네트워크 - DTO 응답
app/src/main/java/com/flint/data/dto/collection/response/RecentCollectionListResponseDto.kt, app/src/main/java/com/flint/data/dto/content/response/BookmarkedContentListResponseDto.kt, app/src/main/java/com/flint/data/dto/home/response/RecommendCollectionResponseDto.kt, app/src/main/java/com/flint/data/dto/search/SearchBookmarkedContentsResponseDto.kt
신규 @Serializable 응답 DTO 클래스(아이템/메타 포함) 추가
도메인 - 매퍼
app/src/main/java/com/flint/domain/mapper/collection/CollectionMapper.kt, app/src/main/java/com/flint/domain/mapper/content/ContentMapper.kt
DTO → 도메인 모델 변환 확장함수 toModel() 추가
도메인 - 모델 변경
app/src/main/java/com/flint/domain/model/user/AuthorModel.kt, app/src/main/java/com/flint/domain/model/content/ContentModel.kt, app/src/main/java/com/flint/domain/model/collection/CollectionModel.kt
ID 타입 Long→String 변경(및 기본값 추가), CollectionModel에 thumbnailUrl/description/imageList/bookmarkCount/profileUrl 등 필드 추가
도메인 - 레포지토리
app/src/main/java/com/flint/domain/repository/HomeRepository.kt, app/src/main/java/com/flint/domain/repository/ContentRepository.kt, app/src/main/java/com/flint/domain/repository/CollectionRepository.kt, app/src/main/java/com/flint/domain/repository/SearchRepository.kt, app/src/main/java/com/flint/domain/repository/AuthRepository.kt
생성자 어노테이션 포맷 조정 및 신규 메서드 추가 (getRecommendedCollectionList, getBookmarkedContentList, getRecentCollectionList 등)
프리젠테이션 - 홈 상태/뷰모델
app/src/main/java/com/flint/presentation/home/HomeViewModel.kt, app/src/main/java/com/flint/presentation/home/uiState/HomeUiState.kt, app/src/main/java/com/flint/presentation/home/sideeffect/HomeSideEffect.kt
HomeViewModel, HomeUiState, HomeSideEffect 신규 추가 — 3개 로드 상태를 결합한 상태 흐름 제공
프리젠테이션 - 화면/컴포넌트 변경
app/src/main/java/com/flint/presentation/home/HomeScreen.kt, app/src/main/java/com/flint/presentation/collectiondetail/CollectionDetailScreen.kt, app/src/main/java/com/flint/presentation/profile/ProfileScreen.kt, app/src/main/java/com/flint/core/designsystem/component/...
HomeRoute → ViewModel 기반으로 변경(LaunchedEffect, collectAsStateWithLifecycle), 여러 콜백(contentId/userId) 타입 Long→String 변경 및 프리뷰 데이터 갱신
네비게이션/기타/인터셉터
app/src/main/java/com/flint/presentation/main/MainNavigator.kt, app/src/main/java/com/flint/presentation/login/LoginScreen.kt, app/src/main/java/com/flint/core/common/di/interceptor/TokenInterceptor.kt, app/src/main/java/com/flint/presentation/profile/ProfileUiState.kt
startDestination 변경(Splash → MainTabRoute.Home), TokenInterceptor에 하드코딩된 JWT 추가, 일부 임포트/샘플 값 업데이트

Sequence Diagram(s)

sequenceDiagram
    participant Route as HomeRoute
    participant VM as HomeViewModel
    participant RepoH as HomeRepository
    participant RepoC as ContentRepository
    participant RepoCol as CollectionRepository
    participant APIH as HomeApi
    participant APIC as ContentApi
    participant APICo as CollectionApi
    participant UI as HomeScreen

    Route->>VM: collectAsStateWithLifecycle()
    Route->>VM: LaunchedEffect -> getRecommendedCollectionList()
    Route->>VM: LaunchedEffect -> getBookmarkedContentList()
    Route->>VM: LaunchedEffect -> getRecentCollectionList()

    VM->>RepoH: getRecommendedCollectionList()
    VM->>RepoC: getBookmarkedContentList()
    VM->>RepoCol: getRecentCollectionList()

    RepoH->>APIH: getRecommendedCollections()
    RepoC->>APIC: getBookmarkedContentList()
    RepoCol->>APICo: getRecentCollectionList()

    APIH-->>RepoH: BaseResponse<RecommendCollectionResponseDto>
    APIC-->>RepoC: BaseResponse<BookmarkedContentListResponseDto>
    APICo-->>RepoCol: BaseResponse<RecentCollectionListResponseDto>

    RepoH-->>VM: Result<List<CollectionModel>>
    RepoC-->>VM: Result<List<ContentModel>>
    RepoCol-->>VM: Result<List<CollectionModel>>

    VM-->>Route: HomeUiState (combined)
    Route->>UI: Render HomeScreen with data
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

Feat ✨

Suggested reviewers

  • nahy-512
  • giovannijunseokim

Poem

🐰 당근 한 입에 코드를 씹네,
문자열 ID로 깡충깡충 뛰며,
ViewModel이 곡을 틀면 콜렉션이 춤추고,
북마크는 빛나며 토큰이 멀리 인사해요,
토끼도 박수 짝짝! 🎶

🚥 Pre-merge checks | ✅ 2 | ❌ 3
❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning 범위를 벗어난 변경이 다수 발견됨: TokenInterceptor에 하드코딩된 JWT 추가, AuthorModel/ContentModel의 userId/contentId 타입 변경(Long→String), CollectionItem의 이미지 소스 변경 등 API 연결과 무관한 수정사항들. TokenInterceptor 하드코딩 제거, 모델 타입 변경 사항을 별도 PR로 분리, 이미지 소스 변경 사유 명확히 하세요. API 기능 구현에만 집중한 체계적인 PR로 재작성이 필요합니다.
Docstring Coverage ⚠️ Warning Docstring coverage is 12.12% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive 제목이 '[Feat] Home api'로 매우 간단하고 모호한 용어를 사용하여 변경 사항을 명확히 전달하지 못함. 제목을 구체적으로 수정하여 API 연결, DTO/Model 형식 정렬 등 주요 변경 사항을 명확히 표현하세요. 예: '[Feat] 홈 화면 API 연결 및 DTO/Model 형식 정렬'
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed PR 설명이 템플릿을 따르며 관련 이슈, 작업 내용, 스크린샷, 리뷰어 메모를 포함하고 있음.
Linked Issues check ✅ Passed PR의 변경 사항이 #125 이슈의 '홈 화면 api 연결' 요구사항을 완전히 충족함. API 엔드포인트 추가, DTO 정의, Repository 메서드 구현, ViewModel 및 화면 통합이 모두 포함됨.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/src/main/java/com/flint/presentation/collectiondetail/CollectionDetailScreen.kt (1)

78-79: userId 타입 불일치 확인됨 - 수정 필요

AuthorModel.userIdString 타입이지만, CollectionDetailScreenuserId 파라미터는 Long 타입으로 정의되어 있습니다. CollectionDetailRoute에서 userId = 1L로 전달되고 있으며, CollectionDetailScreenpeople: ImmutableList<AuthorModel> 파라미터와 타입 불일치가 발생합니다. 일관성을 위해 CollectionDetailScreenCollectionDetailRouteuserId 파라미터를 String 타입으로 변경해야 합니다.

🤖 Fix all issues with AI agents
In `@app/src/main/java/com/flint/core/common/di/interceptor/TokenInterceptor.kt`:
- Around line 29-30: The code contains a hardcoded JWT string and a sample
header call that overwrites the real Authorization header; remove the sample
line that sets the literal token and stop hardcoding credentials in
TokenInterceptor (delete the requestBuilder.header("Authorization", "...")
sample), instead obtain the bearer token from a secure source (e.g., an injected
TokenProvider/getAuthToken(), encrypted storage, or BuildConfig for
non-sensitive dev flags) and set it once via
requestBuilder.header("Authorization", "Bearer " + token) inside
TokenInterceptor.intercept; also ensure conditional logic checks for a non-empty
token before adding the header so you don't overwrite valid headers, and if the
exposed token was real, revoke it and rotate credentials and consider cleaning
git history.

In `@app/src/main/java/com/flint/domain/mapper/content/ContentMapper.kt`:
- Around line 9-18: In BookmarkedContentListResponseDto.toModel(), avoid calling
OttType.valueOf(ottSimple.ottName) directly — make the ottName -> OttType
conversion exception-safe by replacing the valueOf usage in the ottSimpleList
mapping (inside toModel) with a safe lookup that returns a sensible default or
null instead of throwing (e.g., find matching enum by name or use
try/catch/runCatching and fallback to OttType.UNKNOWN or filter out invalid
entries), and ensure the resulting list type (for ContentModel.ottSimpleList) is
adjusted accordingly.

In `@app/src/main/java/com/flint/presentation/home/HomeViewModel.kt`:
- Around line 39-43: The combine lambda parameter names (userInfo, recommended,
favorite) do not match the HomeUiState fields they’re assigned to; update the
lambda parameters and/or assignments so each param clearly corresponds to its
target field (e.g., rename parameters to userInfoLoadState,
recommendedCollectionListLoadState, bookmarkedContentListLoadState or rename to
recommendedLoadState/bookmarkedLoadState/recentLoadState) and then assign them
to HomeUiState(recommendedCollectionListLoadState =
recommendedCollectionListLoadState, bookmarkedContentListLoadState =
bookmarkedContentListLoadState, recentCollectionListLoadState =
recentCollectionListLoadState) so names are consistent with HomeUiState and
improve readability.
- Around line 56-81: The current ViewModel methods
(getRecommendedCollectionList, getBookmarkedContentList,
getRecentCollectionList) only log failures and never update the corresponding
state flows, causing the UI to remain in Loading; update each repository call so
its onFailure handler emits an error state to the appropriate MutableStateFlow
(emit UiState.Error with the exception or its message to
_recommendCollectionListLoadState, _bookmarkedContentListLoadState, and
_recentCollectionListLoadState) and add a missing onFailure handler for
getBookmarkedContentList to mirror the others.
🧹 Nitpick comments (12)
app/src/main/java/com/flint/presentation/main/MainNavigator.kt (1)

35-35: 시작 목적지 변경에 따른 초기 플로우 보장 여부를 확인해주세요.

Line 35에서 Home으로 시작점을 바꾸면서 스플래시/인증/온보딩 게이트가 여전히 다른 경로에서 보장되는지 확인이 필요합니다. 그렇지 않다면 앱 상태(인증/온보딩 여부)에 따라 startDestination을 결정하도록 분기하는 구성을 권장합니다.

app/src/main/java/com/flint/core/designsystem/component/listItem/CollectionItem.kt (1)

52-56: thumbnailUrl 공백 대비 fallback을 고려해주세요.
백엔드/레거시 데이터에서 thumbnailUrl이 비어있을 경우 이미지를 유지하려면 기존 collectionImageUrl로 대체하는 처리가 안전합니다.

♻️ 제안하는 수정
-        NetworkImage(
-            imageUrl = collectionModel.thumbnailUrl,
+        val imageUrl =
+            if (collectionModel.thumbnailUrl.isNotBlank()) {
+                collectionModel.thumbnailUrl
+            } else {
+                collectionModel.collectionImageUrl
+            }
+        NetworkImage(
+            imageUrl = imageUrl,
             contentDescription = null,
             contentScale = ContentScale.Crop,
             modifier = Modifier.fillMaxSize(),
         )
app/src/main/java/com/flint/data/dto/content/response/BookmarkedContentListResponseDto.kt (1)

12-21: getOttSimpleList JSON 키/누락 여부 확인

백엔드에서 키명이 다르거나 필드가 누락되면 kotlinx.serialization 역직렬화가 실패할 수 있습니다. 스펙 확인 후 누락 가능성이 있으면 기본값/nullable 처리를 고려해주세요.

♻️ 제안 변경
-    val getOttSimpleList: List<OttSimpleResponseDto>
+    val getOttSimpleList: List<OttSimpleResponseDto> = emptyList()
app/src/main/java/com/flint/data/dto/home/response/RecommendCollectionResponseDto.kt (1)

20-33: imageList 누락 가능성 확인

백엔드가 imageList를 누락하거나 null로 내려보낼 수 있다면 역직렬화 실패 가능성이 있습니다. 스펙 확인 후 기본값/nullable 처리를 검토해주세요.

♻️ 제안 변경
-    val imageList: List<String>,
+    val imageList: List<String> = emptyList(),
app/src/main/java/com/flint/domain/model/collection/CollectionModel.kt (1)

8-18: thumbnailUrlcollectionImageUrl 역할 분리 필요

이미지 필드가 2개라 사용처 혼동 가능성이 있습니다. 한쪽을 명확히 용도 주석/네이밍(또는 deprecate)로 정리하면 유지보수성이 좋아집니다.

app/src/main/java/com/flint/domain/model/content/ContentModel.kt (1)

7-18: bookmarkId 기본값 0은 상태 구분에 모호

비북마크 상태를 0으로 표현하면 실제 ID와 충돌할 수 있습니다. Long?로 명확히 구분하는 편이 안전합니다.

♻️ 제안 변경
-    val bookmarkId: Long = 0,
+    val bookmarkId: Long? = null,
app/src/main/java/com/flint/presentation/home/uiState/HomeUiState.kt (1)

7-28: 상태 집계 로직이 잘 구현되었습니다.

세 개의 로드 상태를 하나의 loadState로 집계하는 로직이 명확합니다. 현재 구현은 모든 데이터가 성공적으로 로드되어야 Success를 반환하므로, 홈 화면에서 모든 섹션이 필요한 경우에 적합합니다.

향후 부분적 성공(일부 섹션만 로드 성공)을 지원해야 한다면, 각 섹션별로 독립적인 로딩/에러 처리를 고려해볼 수 있습니다:

💡 부분적 성공 처리 예시 (선택사항)
// 개별 섹션의 성공 데이터를 추출하는 헬퍼 프로퍼티 추가
val recommendedCollections: List<CollectionModel>?
    get() = (recommendedCollectionListLoadState as? UiState.Success)?.data

val bookmarkedContents: List<ContentModel>?
    get() = (bookmarkedContentListLoadState as? UiState.Success)?.data

val recentCollections: List<CollectionModel>?
    get() = (recentCollectionListLoadState as? UiState.Success)?.data
app/src/main/java/com/flint/data/api/SearchApi.kt (1)

9-14: LGTM!

Retrofit API 엔드포인트가 올바르게 정의되었습니다. 커서 기반 페이지네이션과 검색 키워드를 지원합니다.

size 파라미터에 기본값을 추가하면 호출 측에서 매번 지정하지 않아도 되어 편리할 수 있습니다:

💡 기본값 추가 예시
 `@GET`("api/v1/search/bookmarked-contents")
 suspend fun getBookmarkedContentList(
     `@Query`("keyword") keyword: String,
     `@Query`("cursor") cursor: Int,
-    `@Query`("size") size: Int
+    `@Query`("size") size: Int = 20
 ) : BaseResponse<SearchBookmarkedContentsResponseDto>
app/src/main/java/com/flint/domain/mapper/collection/CollectionMapper.kt (1)

8-44: 코드 중복 고려.

RecommendCollectionResponseDto.toModel()RecentCollectionListResponseDto.toModel() 함수의 매핑 로직이 거의 동일합니다. DTO 타입이 다르기 때문에 현재 구현도 괜찮지만, 향후 공통 인터페이스나 헬퍼 함수를 통해 중복을 줄일 수 있습니다.

♻️ 선택적 리팩토링 제안

공통 매핑 로직을 private 헬퍼 함수로 추출할 수 있습니다:

private fun mapToCollectionModel(
    id: String,
    thumbnailUrl: String,
    title: String,
    description: String,
    imageList: List<String>,
    bookmarkCount: Int,
    isBookmarked: Boolean,
    userId: String,
    nickname: String,
    profileUrl: String?
) = CollectionModel(
    collectionId = id,
    thumbnailUrl = thumbnailUrl,
    collectionTitle = title,
    description = description,
    imageList = imageList,
    bookmarkCount = bookmarkCount,
    isBookmarked = isBookmarked,
    author = AuthorModel(
        userId = userId,
        nickname = nickname,
        profileUrl = profileUrl ?: ""
    )
)
app/src/main/java/com/flint/presentation/home/HomeViewModel.kt (1)

24-25: 사용되지 않는 의존성.

preferencesManager가 주입되었지만 현재 사용되지 않습니다. 향후 사용 예정이라면 TODO 주석을 추가하거나, 불필요하다면 제거해 주세요.

app/src/main/java/com/flint/presentation/home/HomeScreen.kt (2)

35-36: 사용되지 않는 import.

delaylaunch가 import되었지만 사용되지 않습니다.

🔧 수정 제안
-import kotlinx.coroutines.delay
-import kotlinx.coroutines.launch

55-87: Loading 및 Error 상태에 대한 UI 처리가 없습니다.

현재 else -> {}로 Loading과 Error 상태를 무시하고 있어, 사용자가 로딩 중이거나 에러 발생 시 빈 화면을 보게 됩니다. PR 설명에 따르면 다른 UI 로직은 별도 이슈로 처리한다고 하니, TODO 주석을 추가하거나 최소한의 로딩 인디케이터를 고려해 주세요.

♻️ 개선 제안
 when (uiState.loadState) {
     is UiState.Success -> {
         // ... existing success handling
     }
-    else -> {}
+    is UiState.Loading -> {
+        // TODO: 로딩 인디케이터 추가
+        Box(
+            modifier = Modifier.fillMaxSize().padding(paddingValues),
+            contentAlignment = Alignment.Center
+        ) {
+            CircularProgressIndicator()
+        }
+    }
+    is UiState.Error -> {
+        // TODO: 에러 UI 추가
+    }
 }

Comment on lines +29 to +30
// sample
requestBuilder.header("Authorization", "Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VySWQiOjgwMDAyMTcxMTM1NzExODE5MSwicm9sZSI6IkZMSU5HIiwidHlwZSI6IkFDQ0VTUyIsImlhdCI6MTc2ODgzODU0MCwiZXhwIjoxNzcwMDQ4MTQwfQ.A2XYyu24IoGAXNSQHJ1S-iudWmg8II2_ivI4EdyyWw9KS9oJlxHKOAhcKrsLpLkc9kllZyxwaTJO1t4vI7oZlg")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🚨 보안 취약점: 하드코딩된 JWT 토큰이 소스 코드에 노출되었습니다.

이 코드에는 두 가지 심각한 문제가 있습니다:

  1. 자격 증명 유출: 실제 JWT 토큰이 코드베이스에 커밋되었습니다. 이 토큰에는 userId, role 등 민감한 정보가 포함되어 있으며, 만료 시간이 아직 유효합니다. 저장소에 접근할 수 있는 누구나 이 토큰을 악용할 수 있습니다.

  2. 로직 오류: header() 메서드는 동일한 헤더 이름에 대해 값을 덮어씁니다. 따라서 26-28번 라인에서 설정한 정상적인 Bearer 토큰이 30번 라인의 샘플 토큰으로 항상 덮어써져서, 조건부 로직이 무의미해집니다.

이 디버그/개발용 코드는 병합 전에 반드시 제거해야 합니다.

🔐 수정 제안
            if (accessToken.isNotEmpty()) {
                requestBuilder.header("Authorization", "Bearer $accessToken")
            }
-            // sample
-            requestBuilder.header("Authorization", "Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VySWQiOjgwMDAyMTcxMTM1NzExODE5MSwicm9sZSI6IkZMSU5HIiwidHlwZSI6IkFDQ0VTUyIsImlhdCI6MTc2ODgzODU0MCwiZXhwIjoxNzcwMDQ4MTQwfQ.A2XYyu24IoGAXNSQHJ1S-iudWmg8II2_ivI4EdyyWw9KS9oJlxHKOAhcKrsLpLkc9kllZyxwaTJO1t4vI7oZlg")

추가 조치: 이 토큰이 프로덕션 환경에서 사용 중인 실제 토큰이라면, 즉시 해당 토큰을 무효화(revoke)하고 새 토큰을 발급받아야 합니다. Git 히스토리에도 이 토큰이 남아있으므로, 필요시 히스토리 정리도 고려하세요.

🧰 Tools
🪛 Gitleaks (8.30.0)

[high] 30-30: Uncovered a JSON Web Token, which may lead to unauthorized access to web applications and sensitive user data.

(jwt)

🤖 Prompt for AI Agents
In `@app/src/main/java/com/flint/core/common/di/interceptor/TokenInterceptor.kt`
around lines 29 - 30, The code contains a hardcoded JWT string and a sample
header call that overwrites the real Authorization header; remove the sample
line that sets the literal token and stop hardcoding credentials in
TokenInterceptor (delete the requestBuilder.header("Authorization", "...")
sample), instead obtain the bearer token from a secure source (e.g., an injected
TokenProvider/getAuthToken(), encrypted storage, or BuildConfig for
non-sensitive dev flags) and set it once via
requestBuilder.header("Authorization", "Bearer " + token) inside
TokenInterceptor.intercept; also ensure conditional logic checks for a non-empty
token before adding the header so you don't overwrite valid headers, and if the
exposed token was real, revoke it and rotate credentials and consider cleaning
git history.

Comment thread app/src/main/java/com/flint/domain/mapper/content/ContentMapper.kt
Comment thread app/src/main/java/com/flint/presentation/home/HomeViewModel.kt Outdated
Comment on lines +56 to +81
fun getRecommendedCollectionList() = viewModelScope.launch {
homeRepository.getRecommendedCollectionList()
.onSuccess {
_recommendCollectionListLoadState.emit(UiState.Success(it))
}
.onFailure {
Log.d("Logd", it.message.toString())
}
}

fun getBookmarkedContentList() = viewModelScope.launch {
contentRepository.getBookmarkedContentList()
.onSuccess {
_bookmarkedContentListLoadState.emit(UiState.Success(it))
}
}

fun getRecentCollectionList() = viewModelScope.launch {
collectionRepository.getRecentCollectionList()
.onSuccess {
_recentCollectionListLoadState.emit(UiState.Success(it))
}
.onFailure {
Log.d("Logd", it.message.toString())
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

실패 시 에러 상태가 UI에 전달되지 않습니다.

onFailure에서 로그만 남기고 에러 상태를 emit하지 않아, 실패 시 UI가 Loading 상태에 머무릅니다. 또한 getBookmarkedContentList()onFailure 핸들러가 없습니다.

🔧 수정 제안
 fun getRecommendedCollectionList() = viewModelScope.launch {
     homeRepository.getRecommendedCollectionList()
         .onSuccess {
             _recommendCollectionListLoadState.emit(UiState.Success(it))
         }
         .onFailure {
-            Log.d("Logd", it.message.toString())
+            _recommendCollectionListLoadState.emit(UiState.Error(it))
         }
 }

 fun getBookmarkedContentList() = viewModelScope.launch {
     contentRepository.getBookmarkedContentList()
         .onSuccess {
             _bookmarkedContentListLoadState.emit(UiState.Success(it))
         }
+        .onFailure {
+            _bookmarkedContentListLoadState.emit(UiState.Error(it))
+        }
 }

 fun getRecentCollectionList() = viewModelScope.launch {
     collectionRepository.getRecentCollectionList()
         .onSuccess {
             _recentCollectionListLoadState.emit(UiState.Success(it))
         }
         .onFailure {
-            Log.d("Logd", it.message.toString())
+            _recentCollectionListLoadState.emit(UiState.Error(it))
         }
 }
🤖 Prompt for AI Agents
In `@app/src/main/java/com/flint/presentation/home/HomeViewModel.kt` around lines
56 - 81, The current ViewModel methods (getRecommendedCollectionList,
getBookmarkedContentList, getRecentCollectionList) only log failures and never
update the corresponding state flows, causing the UI to remain in Loading;
update each repository call so its onFailure handler emits an error state to the
appropriate MutableStateFlow (emit UiState.Error with the exception or its
message to _recommendCollectionListLoadState, _bookmarkedContentListLoadState,
and _recentCollectionListLoadState) and add a missing onFailure handler for
getBookmarkedContentList to mirror the others.

@nahy-512 nahy-512 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

고생하셨습니다~!

Comment on lines +68 to +70
.onSuccess {
_bookmarkedContentListLoadState.emit(UiState.Success(it))
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

p3
이거 여기서만 .onFailure 없는 이유 있나요?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

다른곳은 테스트 용도로 추가했었는데 여기는 깜빡했네여. 추가하겠습니다~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔖 API feat - API 연동

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] Home Api

2 participants