Skip to content

5주차 미션_종이#17

Open
jongheecode wants to merge 5 commits into
mainfrom
Week5
Open

5주차 미션_종이#17
jongheecode wants to merge 5 commits into
mainfrom
Week5

Conversation

@jongheecode

Copy link
Copy Markdown
Collaborator

📝 작업 내용

  • 어떤 기능을 구현했는지 간단히 설명해주세요.
  • ex) 유저 API 구현
  • ex) 프로필 UI 완성

📸 스크린샷

구현 결과를 확인할 수 있는 스크린샷을 첨부해주세요.

image

🙏 리뷰 요구사항 (선택)

리뷰어가 중점적으로 봐주었으면 하는 부분이 있다면 작성해주세요.

  • ex) 서비스 로직 구조가 괜찮은지 궁금합니다.
  • ex) 예외 처리 방식에 대한 피드백 부탁드립니다.

Copilot AI review requested due to automatic review settings April 17, 2026 13:49
@jongheecode jongheecode changed the title Week5 5주차 미션_종이 Apr 17, 2026

This comment was marked as spam.

@kimdoyeon1234 kimdoyeon1234 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

수고하셨습니다! 이번 PR에서 정말 인상적인 부분이 많았어요! 지금도 좋지만 개선해야할 부분들을 조금 남겨두었으니 참고해주세요!

  • repeatOnLifecycle 패턴을 HomeFragment와 MainActivity에도 동일하게 적용해보세요
  • ProductAdapter도 FollowingAdapter처럼 ListAdapter + DiffUtil로 바꾸면 일관성이 생겨요
  • 파일 구조를 역할별 패키지로 나눠두면 프로젝트가 커져도 관리하기 편합니다

수고하셨습니다!

Comment on lines +13 to +17
private const val API_KEY = "reqres_701d6373134941c7ba1e30b84be78104"

private val logging = HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

API 키가 하드코딩 되어있습니다! local.properties + BuildConfig로 분리해서 관리하는 것은 개발할때 중요한 요소이니 나중에 프로젝트 하실때 참고하세요!

로깅 레벨이 BODY로 무조건 켜져 있어요. 개발 중엔 편리하지만 실제 배포 빌드에서도 모든 네트워크 요청/응답 내용이 로그에 찍히면 개인정보나 민감한 데이터가 노출될 수 있어요. 아래처럼 디버그 빌드에서만 켜는 게 좋습니다!

private val logging = HttpLoggingInterceptor().apply {
    level = if (BuildConfig.DEBUG) {
        HttpLoggingInterceptor.Level.BODY
    } else {
        HttpLoggingInterceptor.Level.NONE
    }
}

Comment on lines +41 to +45
viewLifecycleOwner.lifecycleScope.launch {
sharedViewModel.homeProducts.collect { products ->
productAdapter.updateData(products)
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

WishlistFragment에서는 repeatOnLifecycle을 쓰셨는데 HomeFragment에서는 빠져 있어요. Fragment가 백그라운드에 있어도 계속 수집하게 되니 WishlistFragment와 동일한 패턴으로 맞춰주세요!

Comment on lines +33 to +46
lifecycleScope.launch {
sharedViewModel.navigateToDetail.collect {
supportFragmentManager.beginTransaction()
.replace(R.id.main_container, DetailFragment())
.addToBackStack(null)
.commit()
}
}

lifecycleScope.launch {
sharedViewModel.navigateToBuyTab.collect {
binding.mainBottomNav.selectedItemId = R.id.nav_buy
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lifecycleScope에서 바로 collect하면 Activity가 백그라운드로 가도 계속 수집해요! 화면이 안 보이는 상태에서 화면 전환이 트리거되면 예상치 못한 동작이 생길 수 있어요. repeatOnLifecycle(Lifecycle.State.STARTED)로 감싸주는 게 안전합니다!

참고로 WishlistFragment에서는 이미 repeatOnLifecycle을 올바르게 사용하고 계시니 그 패턴을 MainActivity에도 동일하게 적용하면 됩니다!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

모든 파일이 com.example.week5 패키지 하나에 몰려 있습니다..파일이 많아질수록 역할별로 패키지를 나눠두면 찾기도 쉽고 구조가 한눈에 보여요. 아래처럼 나눠보는 걸 추천드립니다!

com.example.week5
├── data
│   ├── model
│   │   ├── Product.kt
│   │   └── UserDto.kt
│   ├── remote
│   │   ├── ApiClient.kt
│   │   └── ReqResService.kt
│   └── repository
│       └── ProfileRepository.kt
├── ui
│   ├── home
│   │   └── HomeFragment.kt
│   ├── buy
│   │   └── BuyFragment.kt
│   ├── profile
│   │   ├── ProfileFragment.kt
│   │   ├── ProfileViewModel.kt
│   │   ├── ProfileEditActivity.kt
│   │   └── FollowingAdapter.kt
│   ├── wishlist
│   │   └── WishlistFragment.kt
│   ├── bag
│   │   └── BagFragment.kt
│   └── detail
│       └── DetailFragment.kt
├── shared
│   └── SharedViewModel.kt
├── adapter
│   └── ProductAdapter.kt
└── MainActivity.kt

@jongheecode

Copy link
Copy Markdown
Collaborator Author

감사합니다!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants