Skip to content

[FEAT/#155] 뒤로가기 백핸들러 구현#156

Merged
nhyeonii merged 3 commits intodevelopfrom
feat/#155-back-handler
Jan 23, 2026
Merged

[FEAT/#155] 뒤로가기 백핸들러 구현#156
nhyeonii merged 3 commits intodevelopfrom
feat/#155-back-handler

Conversation

@nhyeonii
Copy link
Contributor

@nhyeonii nhyeonii commented Jan 23, 2026

Related issue 🛠

Work Description ✏️

  • 뒤로가기 연속 2번 클릭 시 앱 종료되도록 백핸들러 구현했어요

Uncompleted Tasks 😅

  • N/A

To Reviewers 📢

끗 ~~

Summary by CodeRabbit

릴리스 노트

  • 새 기능
    • 뒤로 가기 버튼을 2초 내에 두 번 누르면 앱이 종료되는 기능 추가
  • 버그 수정
    • 절차 선택 및 다음 단계 이동 시 발생하던 불안정 동작 개선
    • 검색/필터 결과 처리 오류 감소
  • 리팩터
    • UI 상태 업데이트와 비동기 흐름 처리가 안정화되어 전반적 성능과 응답성 향상

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

@nhyeonii nhyeonii self-assigned this Jan 23, 2026
@nhyeonii nhyeonii requested a review from a team as a code owner January 23, 2026 09:55
@nhyeonii nhyeonii added FEAT✨ 새로운 기능 구현 나현🍒 나현 담당 labels Jan 23, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 23, 2026

Warning

Rate limit exceeded

@nhyeonii has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 24 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

MainScreen에 이중 백 버튼으로 앱 종료하는 핸들러를 추가하고, ProcedureViewModel의 여러 UI 상태 갱신 로직을 update 기반으로 리팩터링하고 절차 조회/필터 흐름을 비동기 처리로 변경합니다.

Changes

Cohort / File(s) Summary
백 네비게이션 처리
app/src/main/java/com/cherrish/android/presentation/main/MainScreen.kt
신규 private composable HandleBackPressToExit(enabled: Boolean = true, backPressInterval: Long = 2000L) 추가. BackHandler와 LocalActivity 사용, mutableLongStateOf로 마지막 백프레스 타임스탬프 보존, 2000ms 내 재클릭 시 activity?.finish() 호출.
ProcedureViewModel 리팩터링 및 비동기 흐름 개선
app/src/main/java/com/cherrish/android/presentation/calendar/procedure/ProcedureViewModel.kt
다수의 직접 _uiState.value = 할당을 _uiState.update { ... } 패턴으로 변환. onNextClick 흐름 재구성(Entry/NoTreat/Treat 분기 처리), 절차 조회(fetchProcedures) 비동기 호출 추가 및 로딩/성공/실패 상태 처리, 검색·필터링 로직 통합 및 아이템 표시모드(Basic/Selectable) 명시적 설정, 일부 조기 반환 및 상태 안전성 개선. kotlinx.coroutines.flow.update import 추가, ProceduresQuery 삭제.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant UI as "Compose UI\n(MainScreen / Screen)"
    participant VM as "ProcedureViewModel"
    participant Repo as "ProcedureRepository"
    participant Activity as "Activity"

    User->>UI: 버튼 클릭(onNextClick) / 백버튼 누름
    alt 백버튼 흐름
        UI->>Activity: BackHandler -> 첫 클릭 타임스탬프 저장
        UI->>Activity: 두번째 클릭(<=2000ms) -> activity.finish()
    end
    alt 절차 흐름 (onNextClick)
        UI->>VM: onNextClick()
        VM->>VM: 현재 uiState 검사 (currentStateOrNull)
        alt 요구 시 비동기 절차 조회 필요
            VM->>Repo: fetchProcedures(keyword?)
            Repo-->>VM: Result.Success / Result.Failure
            VM->>VM: _uiState.update { emit Loading / Success with items or revert }
            VM-->>UI: 상태(성공/실패) 반영
        else 간단 단계 전진
            VM->>VM: _uiState.update { advance step, adjust lists }
            VM-->>UI: 상태 업데이트
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • sohee6989
  • hyeminililo
🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning MainScreen.kt의 백핸들러 구현은 이슈 #155와 직접 관련있으나, ProcedureViewModel.kt의 변경사항은 이슈와 무관해 보입니다. ProcedureViewModel.kt의 상태 관리 리팩토링 변경사항이 이슈 #155 범위를 벗어나는지 확인하고 필요시 별도 PR로 분리하세요.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 핵심 변경사항인 백핸들러 구현을 명확하게 요약하고 있어 주요 변경사항을 잘 나타냅니다.
Description check ✅ Passed PR 설명이 템플릿 구조를 따르고 있으며, 관련 이슈, 작업 내용, 미완료 항목이 모두 포함되어 있습니다.
Linked Issues check ✅ Passed PR의 코드 변경사항(백핸들러 구현으로 연속 2회 백 버튼 클릭 시 앱 종료)이 이슈 #155의 요구사항을 충족합니다.

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


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@nhyeonii nhyeonii merged commit c5c5505 into develop Jan 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FEAT✨ 새로운 기능 구현 나현🍒 나현 담당

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] 뒤로 가기 백핸들러 구현

1 participant