Skip to content

🔀 설문 페이지를 구현합니다. - #3

Merged
leehyeonbin merged 18 commits into
masterfrom
feature/survey-page
Aug 31, 2025
Merged

leehyeonbin merged 18 commits into
masterfrom
feature/survey-page

Conversation

@leehyeonbin

Copy link
Copy Markdown
Contributor

No description provided.

- 설문조사 페이지의 전체적인 흐름 및 UI 구현
- 각 설문 항목(성별, 키, 몸무게, 체형, 스타일) 입력 화면 구현
- ViewModel을 사용하여 상태 관리 및 로직 처리
- ProgressBar 컴포넌트 추가 및 애니메이션 적용
- Koin 모듈(`appModule`)을 정의하여 ViewModel, Repository, CoroutineScope 의존성 주입 설정
- Koin 초기화 함수(`initKoin`) 추가
- 각 플랫폼별 진입점(MainActivity, MainViewController, main)에서 `initKoin` 호출
- `SurveyViewModelFactory`를 Koin을 사용하도록 수정
- `SurveyPage`에서 Koin을 통해 `SurveyViewModel` 주입받도록 변경
- compose-multiplatform 버전을 1.7.3에서 1.8.2로 업데이트
- org-jetbrains-compose-ui-backhandler 라이브러리 추가 (버전 1.8.2)
- `ChipComponent` 추가하여 선택 UI 재사용성 향상
- `SurveyPage`에 페이지 번호 및 ProgressBar 표시 기능 추가
- 뒤로가기 버튼 처리 로직 개선 (`HandleBackPress` 인텐트 추가)
- `GenderSelectScreen` 및 `HeightInputScreen` 디자인 및 UX 개선
- `ViewModel`에서 `viewModelScope` 사용하도록 수정 및 CoroutineScope 의존성 제거
- `SurveyIntent`에 `HandleBackPress` 추가
- `SurveyEffect`에 `ExitSurvey` 추가
- 선택 시 300ms 딜레이 후 다음 페이지로 이동하도록 수정 (선택 피드백 개선)
- `MainActivity` 배경색 White로 설정
- ChipComponent 디자인 수정 및 `maxLines` 파라미터 추가
- HeightInputScreen, GenderSelectScreen UI 및 로직 수정
    - 기존 텍스트 기반 입력에서 ChipComponent 사용으로 변경
    - HeightInputScreen의 레이아웃을 FlowRow로 변경하여 반응형 UI 개선
- Gender, HeightRange enum 클래스 추가하여 설문 항목 관리 용이성 향상
- SurveyViewModel, SurveyIntent, SurveyState, SurveyData 모델 수정
    - 성별 및 키 정보를 String에서 각각 Gender, HeightRange enum으로 변경
    - SurveyData의 height 필드 타입을 Int에서 HeightRange로 변경
- canGoNext, isSurveyValid 함수 로직 수정 (변경된 모델 타입 반영)
- `WeightRange` enum 클래스 추가하여 몸무게 범위 옵션 정의
- `SurveyViewModel`에서 키 선택 시 자동으로 다음 페이지로 넘어가도록 수정
- `WeightInputScreen`에서 `ChipComponent`를 사용하여 몸무게 범위 선택 UI 구현
- `HeightRange` enum 클래스의 범위 수정
- `SurveyIntent`, `SurveyState`, `SurveyData`에서 몸무게 타입을 `String`에서 `WeightRange`로 변경
- `BodyType` enum 클래스 정의
- `BodyTypeScreen`에서 FlowRow를 사용하여 체형 옵션 Chip 형태로 표시
- `SurveyViewModel`에서 체형 선택 시 300ms 지연 후 다음 페이지로 이동하도록 수정
- `SurveyIntent`, `SurveyState`, `SurveyData`에서 체형 관련 타입 변경
- ProgressBar 애니메이션 시작 시 초기 너비를 0이 아닌 5%로 설정하여 초기 상태에서도 보이도록 수정
- SurveyPage에서 ProgressBar의 progress 계산 방식을 currentPage / 5f로 변경하여 0부터 시작하도록 수정
@github-actions

Copy link
Copy Markdown

🛠️ 이슈와 PR의 Labels 동기화를 스킵했어요.

@github-actions

Copy link
Copy Markdown

✅ PR의 Assign 자동 지정을 성공했어요!

@leehyeonbin

- `PreferredStyle` enum 클래스를 추가하여 선호하는 스타일 목록을 관리합니다.
- `SurveyState`, `SurveyIntent`, `SurveyModel`에서 스타일 관련 타입을 `String`에서 `PreferredStyle`로 변경합니다.
- 스타일 선택 화면(`StylePreferenceScreen`) UI를 개선합니다.
    - 기존 `Card` 기반 UI를 `CheckBox`와 텍스트를 사용한 목록 형태로 변경합니다.
    - `CTALargeButton` 컴포넌트를 추가하여 "N개 선택" 또는 "선택하기" 버튼을 구현합니다.
- `CheckBox` 컴포넌트를 추가합니다. (체크 상태에 따라 아이콘 및 배경색 변경)
- 체크 아이콘(`ic_check_16.xml`)을 추가합니다.
- 설문 완료 시 ProgressBar가 100%로 채워지는 애니메이션 추가
- ProgressBar 애니메이션 완료 후 다음 화면으로 이동하도록 지연 시간 추가
- `StylePreferenceScreen`에서 "완료하기" 버튼 클릭 시 `SubmitSurvey` 인텐트 전달
- 설문 제출 실패 시 `isCompleted` 상태를 `false`로 설정하여 ProgressBar가 롤백되도록 수정
@leehyeonbin
leehyeonbin marked this pull request as ready for review August 23, 2025 06:49
@leehyeonbin leehyeonbin changed the title Feature/survey page 🔀 설문 페이지를 구현합니다. Aug 23, 2025
super.onCreate(savedInstanceState)

// Koin 초기화
initKoin()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

application oncreate에서 초기화 하는게 어떨까욥

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

제가 koin 관련 지식이 없어서 activity oncreate 시점에 하는게 맞다면 알려주시면 감사하겠습니다

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.

딱히 뭐 그런 건 아니고 SingleActicity로 작업하는지라 그냥 onCreate에서 선언한거라 application 단에서 추가하는 편이 좀 더 좋아보이네요

Comment on lines +23 to +24
private val _effects = mutableListOf<SurveyEffect>()
val effects: List<SurveyEffect> get() = _effects.toList()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이펙트 처리에 채널이나 플로우 사용하는건 어떨까요?

@leehyeonbin leehyeonbin Aug 23, 2025 •

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.

어떤 차이가 있을까요?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

현재 구조는 effects를 LaunchedEffect의 key로 사용하고 있기 때문에, effects 값이 변경될 때마다 LaunchedEffect 블록이 다시 실행되면서 이펙트를 처리하게 되는 구조인것 같습니다.

LaunchedEffect는 내부적으로 이전 코루틴을 취소하고 새 코루틴을 생성하여 실행하는 방식으로 동작하는 것으로 알고 있습니다. 제가 알고있는 지식이 맞다면 이펙트를 처리할 때마다 코루틴이 계속 제거되고 다시 생성되는데, 이 동작이 조금 불필요하다고 생각했습니다.

반면에 flow나 channel을 사용하면 하나의 코루틴에서 지속적으로 collect를 수행하면서 이펙트를 받아 처리할 수 있습니다. 이 경우 매번 코루틴을 새로 만들 필요도 없고, 처리된 이펙트를 직접 clear해줄 필요도 없어 코드가 더 단순해지고 효율적이게 바뀔 수 있지 않을까 라고 생각했습니닷

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.

때엠;;;;;; 확인이요

- `OnmipApp` Application 클래스를 생성하여 앱 전역에서 Koin을 초기화하도록 변경
- `AndroidManifest.xml`에 `android:name=".OnmipApp"` 추가
- `MainActivity`에서 Koin 초기화 코드 제거
- SurveyViewModel에서 SurveyEffect를 List에서 Channel로 변경
- Channel의 send와 receiveAsFlow를 사용하여 Effect 처리
- SurveyPage에서 effects를 collect하여 처리하고, clearEffects() 호출 제거
@leehyeonbin
leehyeonbin merged commit 8c90ee8 into master Aug 31, 2025
@leehyeonbin
leehyeonbin deleted the feature/survey-page branch August 31, 2025 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Feature 신규 기능

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants