Skip to content

Feature/6 2 repeat day routine UI #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Benjamin8282
Copy link
Collaborator

[#6-2] 요일 반복 루틴 UI 구현 #17

이 PR은 특정 요일에 반복되는 루틴 기능과 공휴일 제외 옵션을 지원하기 위한 기능을 추가합니다.
UI, ViewModel, 단위 테스트가 함께 업데이트되어 해당 기능을 완성합니다.

기능 추가: 특정 요일 선택 및 공휴일 제외 옵션

  • AddRoutineScreenSpecificDaysContent 컴포저블을 추가하여 요일 선택과 공휴일 제외 토글 기능을 구현
    • FilterChip를 활용한 요일 선택 UI
    • Switch를 통한 공휴일 제외 옵션 UI
  • AddRoutineScreen에 상태 변수 selectedDays, excludeHolidays를 추가하고, 이를 UI에 반영

ViewModel 개선

  • AddRoutineViewModelselectedDays, excludeHolidays 상태 및 상태 변경 함수(onSelectedDaysChange, onExcludeHolidayToggle) 추가
  • saveRoutine 함수에서 요일 선택 검증과 공휴일 제외 옵션 반영 로직 추가
  • 사용자의 선택에 따라 RepeatTypeHolidayType을 적절히 설정

단위 테스트 추가

  • 요일 반복 탭에서 선택된 요일이 없을 때 에러 콜백이 호출되는지 테스트
  • 올바른 요일 선택 시 루틴이 정상 저장되고 성공 콜백이 호출되는지 테스트

close #6-2

- `AddRoutineViewModel`:
    - `selectedDays` (선택된 요일 목록) StateFlow 추가
    - `excludeHolidays` (공휴일 제외 여부) StateFlow 추가
    - 요일 선택 및 공휴일 제외 옵션 변경 함수 추가
    - 루틴 저장 시 요일 반복 유형 및 공휴일 제외 설정 로직 추가

- `AddRoutineScreen.kt`:
    - `SpecificDaysContent` Composable 함수 추가:
        - 요일 선택 FilterChip 및 공휴일 제외 Switch 구현
        - 공휴일 제외 시 안내 문구 표시
    - 탭에 따라 "요일 반복" 또는 "특정 날짜" 콘텐츠 표시 로직 수정
- 요일 반복 탭에서 선택된 요일이 없을 경우 에러 콜백 호출 검증 테스트 추가
- 요일 반복 탭에서 유효한 요일 선택 시 루틴 저장 및 성공 콜백 호출 검증 테스트 추가
@Benjamin8282 Benjamin8282 requested a review from Copilot June 19, 2025 14:57
@Benjamin8282 Benjamin8282 self-assigned this Jun 19, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements a UI feature for routines that repeat on specific weekdays with an option to exclude holidays.

  • Updates the AddRoutineScreen composable to include a SpecificDaysContent section for day selection and a holiday exclusion toggle.
  • Enhances the AddRoutineViewModel with state management and validation logic for selected days and holiday exclusion.
  • Adds or updates unit tests in AddRoutineViewModelTest for error handling and successful routine saving.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
app/src/test/java/com/example/myroutine/AddRoutineViewModelTest.kt Added unit tests verifying error callbacks when no day is selected and proper routine saving when valid days are chosen.
app/src/main/java/com/example/myroutine/features/add/AddRoutineViewModel.kt Added state flows and functions for managing the selected days and holiday exclusion; updated the saveRoutine logic for weekly routines.
app/src/main/java/com/example/myroutine/features/add/AddRoutineScreen.kt Introduced the SpecificDaysContent composable to render weekday filter chips and holiday exclusion options.

@@ -106,6 +122,20 @@ class AddRoutineViewModel @Inject constructor(
startDate = null
}

1 -> {
Copy link
Preview

Copilot AI Jun 19, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider defining a constant for the tab index (currently the literal value '1') to improve code clarity and maintainability.

Suggested change
1 -> {
TAB_INDEX_WEEKLY -> {

Copilot uses AI. Check for mistakes.

@@ -106,6 +122,20 @@ class AddRoutineViewModel @Inject constructor(
startDate = null
}

1 -> {
repeatDays = _selectedDays.value
Copy link
Preview

Copilot AI Jun 19, 2025

Choose a reason for hiding this comment

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

Consider sorting the selected days list before assigning it to repeatDays to ensure consistent ordering and prevent potential issues when users select days in varying orders.

Copilot uses AI. Check for mistakes.

@Benjamin8282 Benjamin8282 requested a review from f-lab-Toru June 19, 2025 14:58
Copy link

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.

[#6] AddRoutine 화면 UI 구현
1 participant