Skip to content

feat:5주차 미션_제로#37

Open
jeongkyueun wants to merge 3 commits intomainfrom
zero-m5
Open

feat:5주차 미션_제로#37
jeongkyueun wants to merge 3 commits intomainfrom
zero-m5

Conversation

@jeongkyueun
Copy link
Copy Markdown
Collaborator

@jeongkyueun jeongkyueun commented Apr 28, 2026

📌 feat:5주차 미션_제로

🔗 관련 이슈

Closes #36

✨ 변경 사항

마이페이지 화면 만들기

  • 마이페이지 UI 전부 구현하기

  • 서버에서 데이터를 받아와서 마이페이지 연결하기

    ReqRes에서 api를 활용하여 1번 유저의 정보를 가져와 이미지, 닉네임(first name + last name)을 표시

  • 마이페이지 팔로잉 리스트 구현하기

    RecyclerView로 제작하여 user list를 가져와 연결 후 프로필 이미지 보여주기

  1. 의존성 추가: Retrofit, Glide, OkHttp를 libs.versions.toml 및 build.gradle.kts에 추가하고 동기화했습니다.
  2. 권한 설정: 인터넷 통신을 위해 AndroidManifest.xml에 INTERNET 권한을 추가했습니다.
  3. 데이터 모델 및 서비스: ReqRes API 연동을 위한 Models.kt와 ReqResService.kt를 생성했습니다. (API Key 헤더 포함)
  4. UI 구현: fragment_profile.xml을 요구사항에 맞춰 디자인했습니다. (주문, 패스, 이벤트, 설정 아이콘 및 팔로잉 리스트 포함)
  5. 기능 구현:
  • ProfileFragment.kt에서 1번 유저 정보를 가져와 닉네임과 프로필 이미지를 설정했습니다.
  • FollowingAdapter를 통해 유저 리스트를 가로 스크롤 RecyclerView로 구현했습니다.
  1. API키는 보안을 위해 local.properties에 키 추가

🔍 테스트

  • 테스트 완료
  • 에러 없음

📸 스크린샷 (선택)

마이페이지
Screenshot_20260429_041808

🚨 추가 이슈

  1. 마이페이지는 잘 되는데 상품들이 아이콘 이미지로 바뀌는 오류
    원인: 상품 이미지가 아이콘으로 바뀐 이유는 안드로이드가 리소스(이미지, 아이콘 등)를 관리할 때 부여하는 고유 번호(Resource ID) 때문이다.
    DataStoreManager에서 imageResId를 저장하고 있는데, 프로젝트에 새로운 리소스(아이콘들)가 추가되면서 리소스의 고유 번호(ID)들이 재할당되었다. DataStore에 저장된 이전의 번호가 이제는 새로운 아이콘의 번호를 가리키게 되어 다른 이미지가 출력됨.
    해결방법:
    먼저 DataStoreManager.kt를 수정하여 리소스 ID가 아닌 고정된 초기 데이터를 사용하게 했다.
    동시에 DataStore에 저장된 데이터의 imageResId가 틀어졌을 수 있으므로, DataStoreManager.kt의 productsFlow에서 무조건 getInitialProducts()를 호출하게 하여 이미지를 복구함.
    이미지를 복구한 후, 나중에는 리소스 ID(Int) 대신 리소스 이름(String, 예: "img_nike_air_force")을 저장하는 방식으로 변경하는 것이 리소스 추가 시 이미지 꼬임을 방지함.
    이제 저장된 위시리스트 상태는 유지하면서, 이미지 리소스 ID만은 현재 프로젝트의 최신 번호로 항상 갱신하도록 로직을 개선했다.

  2. api 키값을 쌍따옴표가 두 번 들어가서 오류남.
    \zero\week5\app\build\generated\source\buildConfig\debug\com\example\week2\BuildConfig.java:13: error: ';' expected
    public static final String REQRES_API_KEY = "".."";
    원인: buildConfigField는 사용자가 입력한 값을 자바 소스 코드에 글자 그대로 복사해서 붙여넣는 도구이기 때문에 local.properties에 적힌 키값과 build.gradle.kts에서 추가하는 따옴표가 합쳐져서 따옴표가 두 번(""..."") 들어갔기 때문이다.
    해결방법: app/build.gradle.kts 수정

        // local.properties에서 키를 가져와서 정제한 뒤 등록합니다.
        val rawApiKey = localProperties.getProperty("REQRES_API_KEY") ?: ""
        val apiKey = rawApiKey.trim().replace("\"", "").replace("'", "")
        buildConfigField("String", "REQRES_API_KEY", "\"$apiKey\"")

@jeongkyueun jeongkyueun self-assigned this Apr 28, 2026
@jeongkyueun jeongkyueun added the enhancement New feature or request label Apr 28, 2026

class FollowingViewHolder(private val binding: ItemFollowingBinding) : RecyclerView.ViewHolder(binding.root) {
fun bind(user: UserData) {
Glide.with(binding.root.context)
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.

요 위치가 맞는지는 모르겠는데 팔로잉 목록에 본인(1번) 은 제외시켜도 좋을 것 같아요!

Copy link
Copy Markdown
Collaborator

@sua710 sua710 left a comment

Choose a reason for hiding this comment

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

너무 잘하셨어요!

android:padding="16dp"
android:text="회원 가입일: 2025년 9월"
android:textColor="#9E9E9E"
android:textSize="12sp"
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.

항상 생각하는 건데 ui 깔끔하게 구현 잘하시는 것 같아요....!

android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#000000"
android:strokeLineCap="round"/>
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.

Ui 가 이쁜것같아요

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] 5주차 미션_제로

4 participants