Skip to content

[Feat] 토스트 메시지 뷰 구현 #41

Merged
taipaise merged 1 commit intodevelopfrom
feat/toast-message
Aug 7, 2025
Merged

[Feat] 토스트 메시지 뷰 구현 #41
taipaise merged 1 commit intodevelopfrom
feat/toast-message

Conversation

@taipaise
Copy link
Copy Markdown
Collaborator

@taipaise taipaise commented Aug 7, 2025

🌁 Background

  • 토스트 메시지 뷰 구현

📱 Screenshot

iPhone SE3 iPhone 13 mini iPhone 16 Pro
se3 13nmini Simulator Screen Recording - iPhone 16 Pro - 2025-08-08 at 00 13 04

📝 Review Note

사용 방법

  1. 사용할 View에 ToastMessageView를 추가합니다.
  2. 다음과 같이 layout을 잡아줍니다.
        toastMessageView.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.bottom.equalTo(safeArea.snp.bottom).offset(-Layout.toastMessageBottomSpacing)
        }
  1. 사용 시, 체크이미지 여부, 메시지, 너비와 높이를 지정합니다.
toastMessageView.showToast(
            withCheckImage: true,
            message: "선택한 감정 구슬이 이미 반영되었어요.",
            width: 265,
            height: 44)

Summary by CodeRabbit

  • 신규 기능
    • 토스트 메시지 UI가 추가되어, 사용자에게 안내 메시지를 화면 하단에 표시할 수 있습니다.
    • Home 화면에서 이미 적용된 감정 오브를 선택하면 토스트 메시지로 안내가 표시됩니다.
    • 추천 루틴 화면에도 토스트 메시지 컴포넌트가 추가되었습니다.

@taipaise taipaise requested a review from choijungp August 7, 2025 15:15
@taipaise taipaise self-assigned this Aug 7, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 7, 2025

Walkthrough

Toast 메시지 UI 컴포넌트(ToastMessageView)가 새롭게 추가되어, 홈 뷰와 추천 루틴 뷰에 통합되었습니다. 해당 뷰들은 Toast 메시지 뷰를 서브뷰로 추가하고, 적절한 위치에 배치하는 레이아웃을 구성했습니다. SnapKit 사용을 위해 관련 파일에 import 문이 추가되었습니다.

Changes

Cohort / File(s) Change Summary
ToastMessageView 컴포넌트 추가
Projects/Presentation/Sources/Common/Component/ToastMessageView.swift
ToastMessageView 클래스 신설. 체크마크 아이콘, 메시지 라벨, 애니메이션 토스트 표시 및 자동 사라짐 기능 구현.
SnapKit 임포트 추가
Projects/Presentation/Sources/Common/Protocol/BaseViewController.swift
SnapKit 라이브러리 import 문 추가.
HomeView에 ToastMessageView 적용
Projects/Presentation/Sources/Home/View/HomeView.swift
toastMessageView 프로퍼티 및 하위 뷰 추가, 레이아웃 설정, 감정 오브 업데이트 시 토스트 메시지 표시 기능 적용.
RecommendedRoutineView에 ToastMessageView 적용
Projects/Presentation/Sources/RecommendedRoutine/View/RecommendedRoutineView.swift
toastMessageView 프로퍼티 및 하위 뷰 추가, 레이아웃 설정. 동작 로직은 아직 미구현.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant HomeView
    participant ToastMessageView

    User->>HomeView: 감정 오브 클릭
    HomeView->>ToastMessageView: showToast(withCheckImage: true, message: ...)
    ToastMessageView->>ToastMessageView: 메시지 설정 및 애니메이션 표시
    Note over ToastMessageView: 일정 시간 후 자동으로 사라짐
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Poem

🥕
토스트 메시지 뷰가 왔어요,
체크마크와 함께 반짝이며
감정 오브 눌렀을 때
살포시 인사 건네죠.
홈과 루틴 모두에 자리 잡고
스르륵 나타났다 사라지는
토스트의 마법, 오늘도 완성!

( - ˘ ᵕ ˘ - )ノ🍞

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between db3e31a and 9c26fe7.

📒 Files selected for processing (4)
  • Projects/Presentation/Sources/Common/Component/ToastMessageView.swift (1 hunks)
  • Projects/Presentation/Sources/Common/Protocol/BaseViewController.swift (1 hunks)
  • Projects/Presentation/Sources/Home/View/HomeView.swift (5 hunks)
  • Projects/Presentation/Sources/RecommendedRoutine/View/RecommendedRoutineView.swift (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • Projects/Presentation/Sources/Common/Protocol/BaseViewController.swift
🚧 Files skipped from review as they are similar to previous changes (3)
  • Projects/Presentation/Sources/Home/View/HomeView.swift
  • Projects/Presentation/Sources/RecommendedRoutine/View/RecommendedRoutineView.swift
  • Projects/Presentation/Sources/Common/Component/ToastMessageView.swift
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/toast-message

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or @coderabbitai 요약 to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
Projects/Presentation/Sources/Common/Component/ToastMessageView.swift (1)

87-114: 토스트 표시 메서드에서 너비 조정값 확인 필요

메서드 구현이 전반적으로 잘 되어있고 가드문으로 중복 표시를 방지하는 점이 좋습니다. 하지만 104번 줄에서 너비에 임의로 10을 더하는 부분이 의도가 명확하지 않습니다.

-        widthConstraint?.update(offset: width + 10)
+        widthConstraint?.update(offset: width)

만약 추가 패딩이 필요하다면 Layout 상수로 정의하는 것이 더 명확할 것 같습니다:

static let additionalWidthPadding: CGFloat = 10
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7726a5a and db3e31a.

📒 Files selected for processing (4)
  • Projects/Presentation/Sources/Common/Component/ToastMessageView.swift (1 hunks)
  • Projects/Presentation/Sources/Common/Protocol/BaseViewController.swift (1 hunks)
  • Projects/Presentation/Sources/Home/View/HomeView.swift (5 hunks)
  • Projects/Presentation/Sources/RecommendedRoutine/View/RecommendedRoutineView.swift (4 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: taipaise
PR: YAPP-Github/Bitnagil-iOS#33
File: Projects/DataSource/Sources/Repository/RoutineRepository.swift:45-46
Timestamp: 2025-08-04T23:43:28.527Z
Learning: taipaise는 디버깅을 위해 명시적인 에러 처리를 선호함. nil 체크 시 조용히 실패하는 것보다 에러를 던지는 방식을 추후 디버깅에 도움이 된다고 생각함.
📚 Learning: baseviewcontroller의 viewdidload() 메서드에서 이미 configureattribute(), configurelayout(), bind()를 호출하므로, 하...
Learnt from: choijungp
PR: YAPP-Github/Bitnagil-iOS#19
File: Projects/Presentation/Sources/Login/View/TermsAgreementView.swift:44-46
Timestamp: 2025-07-16T09:09:13.869Z
Learning: BaseViewController의 viewDidLoad() 메서드에서 이미 configureAttribute(), configureLayout(), bind()를 호출하므로, 하위 클래스에서 super.viewDidLoad()를 호출하면 이 메서드들이 자동으로 호출된다. 따라서 하위 클래스에서 추가로 호출할 필요가 없다.

Applied to files:

  • Projects/Presentation/Sources/Common/Protocol/BaseViewController.swift
  • Projects/Presentation/Sources/RecommendedRoutine/View/RecommendedRoutineView.swift
🧬 Code Graph Analysis (1)
Projects/Presentation/Sources/Home/View/HomeView.swift (1)
Projects/Presentation/Sources/Common/Component/ToastMessageView.swift (1)
  • showToast (87-114)
🔇 Additional comments (12)
Projects/Presentation/Sources/Common/Protocol/BaseViewController.swift (1)

8-8: SnapKit import 추가 승인

토스트 메시지 뷰 구현을 위해 필요한 SnapKit 의존성 추가입니다. 프로젝트 전반에서 일관된 레이아웃 제약 조건 설정을 위한 적절한 변경사항입니다.

Projects/Presentation/Sources/RecommendedRoutine/View/RecommendedRoutineView.swift (2)

35-35: 레이아웃 상수 추가 승인

토스트 메시지 뷰의 하단 간격을 위한 상수가 적절히 추가되었습니다.


54-54: 토스트 메시지 뷰 프로퍼티 추가 승인

ToastMessageView 인스턴스가 적절히 선언되었습니다.

Projects/Presentation/Sources/Home/View/HomeView.swift (4)

55-55: 레이아웃 상수 추가 승인

토스트 메시지 뷰의 하단 간격을 위한 상수가 적절히 추가되었습니다.


73-73: 토스트 메시지 뷰 프로퍼티 추가 승인

ToastMessageView 인스턴스가 적절히 선언되었습니다.


220-220: 토스트 뷰 레이아웃 설정 승인

토스트 메시지 뷰가 뷰 계층에 추가되고 적절한 레이아웃 제약 조건이 설정되었습니다. 화면 중앙에 정렬되고 안전 영역 하단에서 적절한 간격으로 배치됩니다.

Also applies to: 315-318


418-422: 토스트 메시지 사용 구현 승인

감정 구슬이 이미 반영된 경우 사용자에게 알림을 제공하는 토스트 메시지 구현이 적절합니다. 체크 이미지와 함께 명확한 메시지를 표시하여 좋은 UX를 제공합니다.

Projects/Presentation/Sources/Common/Component/ToastMessageView.swift (5)

11-20: 레이아웃 상수 정의 승인

토스트 메시지 뷰의 레이아웃 상수들이 적절히 정의되었습니다. 각 요소의 크기와 간격이 일관성 있게 설정되어 있습니다.


28-36: 초기화 메서드 구현 승인

표준적인 UIView 초기화 패턴을 따르고 있으며, 설정 메서드들을 적절히 호출하고 있습니다.


38-53: 속성 설정 메서드 승인

뷰의 초기 상태를 투명하고 숨김 상태로 설정하는 것이 적절하며, 체크 이미지와 레이블의 스타일링이 일관성 있게 구성되었습니다.


55-85: 레이아웃 설정 메서드 승인

SnapKit을 사용한 제약 조건 설정이 명확하고 체크 이미지와 레이블의 배치가 적절합니다. 제약 조건 참조를 저장하여 동적 업데이트가 가능하도록 구현된 점이 좋습니다.


116-123: 토스트 숨김 메서드 구현 승인

3.2초 지연 후 자동으로 토스트를 숨기는 구현이 적절합니다. 애니메이션 duration과 delay 값이 합리적이고, 완료 후 isHidden = true 설정으로 상태를 정확히 관리하고 있습니다.

view.addSubview(floatingMenu)
view.addSubview(floatingButton)

view.addSubview(toastMessageView)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

토스트 뷰 레이아웃 설정 완료, 사용 코드 확인 필요

토스트 메시지 뷰가 뷰 계층에 추가되고 적절한 레이아웃 제약 조건이 설정되었습니다. 하지만 HomeView와 달리 실제 토스트를 표시하는 showToast 호출 코드가 보이지 않습니다.

토스트 메시지 기능이 실제로 사용되는지 확인하기 위해 다음 스크립트를 실행하여 showToast 메서드 호출을 검색해보겠습니다:

Also applies to: 186-189


🏁 Script executed:

#!/bin/bash
# RecommendedRoutineView에서 showToast 메서드 사용 확인
rg -A 3 "showToast" Projects/Presentation/Sources/RecommendedRoutine/View/RecommendedRoutineView.swift

Length of output: 102


전체 프로젝트에서 showToast 호출을 재확인하기 위해 아래 스크립트를 실행해 주세요:


🏁 Script executed:

#!/bin/bash
# 전체 프로젝트에서 showToast 메서드 호출 검색
rg -n "showToast"

Length of output: 205


RecommendedRoutineView에 showToast 호출 추가 필요
토스트 메시지 뷰는 뷰 계층에 추가되었지만, 실제로 표시하기 위한 showToast 호출이 없습니다. HomeView에서는 다음과 같이 호출되지만:

  • Projects/Presentation/Sources/Home/View/HomeView.swift:418
    toastMessageView.showToast(message: "...", duration: ...)

RecommendedRoutineView에도 유사한 위치에서 showToast를 호출하도록 수정해주세요:

  • 파일: Projects/Presentation/Sources/RecommendedRoutine/View/RecommendedRoutineView.swift
  • 예시 삽입 위치(버튼 액션, 뷰 이벤트 등):
    toastMessageView.showToast(message: "추천 루틴이 업데이트되었습니다.", duration: .short)
🤖 Prompt for AI Agents
In
Projects/Presentation/Sources/RecommendedRoutine/View/RecommendedRoutineView.swift
at line 132, after adding toastMessageView as a subview, you need to call
toastMessageView.showToast with an appropriate message and duration to actually
display the toast. Add a call like toastMessageView.showToast(message: "추천 루틴이
업데이트되었습니다.", duration: .short) in a suitable place such as a button action or
view event handler to trigger the toast display.

@choijungp choijungp force-pushed the feat/toast-message branch from db3e31a to 9c26fe7 Compare August 7, 2025 16:23
@taipaise taipaise merged commit 1213290 into develop Aug 7, 2025
2 checks passed
@choijungp choijungp deleted the feat/toast-message branch August 8, 2025 06:36
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.

1 participant