Skip to content
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

[TNT-221] API 포함 결과 처리 관련 오버레이 UI 로직 작성 #65

Merged
merged 8 commits into from
Feb 10, 2025

Conversation

FpRaArNkK
Copy link
Contributor

📌 What is the PR?

  • 비동기 처리 결과로 화면에 표시되는 로직을 작성했습니다

🪄 Changes

  • 토스트 뷰 표시 관련 수정
  • Overlay 관련 매니저 작성, UI 연결
  • Ovelrlay Notification 작성, 데이터 연결
  • NetworkService 관련 Interceptor 추가

🌐 Common Changes

  • 기존에 존재하던 모든 API TargetType에 ProgressIndicator 인터셉터가 추가되었습니다.
    • API 요청 시작 시 UI에 ProgressView를 표시하는 Notification을 post
    • API 응답 받을 시 UI에 ProgressView를 내리는 Notification을 post
  • 네트워크 관련 에러 발생시 UI에 서버에러 토스트를 표시하는 Notification을 post하도록 수정했습니다.
    • 추후 리팩토링 시 구조적으로 수정이 필요합니다

🔥 PR Point

  1. OverlayManager를 작성했습니다. 앱의 전체 화면 위로 표시되는 ToastView와 ProgressView의 표시를 위한 것이며,
    ProgressView는 단순 Bool 값으로 관리되고 - ToastView는 Queue 방식으로 관리됩니다.
    현재 표시되고 있는 Toast는 Queue의 맨 앞에서 FIFO로 출력된 데이터이며, 표시 해제 시 Queue의 다음 Toast가 표시됩니다.
    실력이슈로 TCA Redcuer로 구현하다 ObservableObject로 노선을 변경하고, NotificationCenter를 통해 이벤트 구독형으로 작성했습니다. 추후 개선 방향 도출 시 리팩토링 예정입니다.

사용법은 아래와 같습니다

// 프로그레스 화면 표시
NotificationCenter.default.postProgress(visible: true)
// 프로그레스 화면 숨김
NotificationCenter.default.postProgress(visible: false)
// 토스트 표시 큐에 추가
NotificationCenter.default.post(toast: .init(presentType: .text(""), message: "서버 요청에 실패했어요"))
// 토스트 표시 해제 or 표시 큐에서 삭제
NotificationCenter.default.postDelete(toast: existToast) // post에 등록했던 toast 그대로 사용해야 id가 전달되어 제대로 삭제됩니다
  • Toast는 Identifiable하며 개별의 UUID를 갖고 있기 때문에, delete하려면 반드시 post때 사용했던 인스턴스 그대로 전달해야합니다

📸 Screenshot

기능 스크린샷
GIF
MOV

🙆🏻 To Reviewers

  • 추후 리팩토링 때 반영해야할 부분이 많은 것 같습니다. TODO로 일일이 적어놓겠습니다..

💭 Related Issues

@FpRaArNkK FpRaArNkK added the ✨Feat 새로운 기능 구현 (새로운 로직 추가, UI 구현 등) label Feb 9, 2025
@FpRaArNkK FpRaArNkK requested a review from syss220211 February 9, 2025 15:07
@FpRaArNkK FpRaArNkK self-assigned this Feb 9, 2025
@FpRaArNkK FpRaArNkK changed the base branch from TNT-221-apiConnectionBase-userApi to develop February 10, 2025 15:11
@FpRaArNkK FpRaArNkK merged commit 14e151a into develop Feb 10, 2025
@FpRaArNkK FpRaArNkK deleted the TNT-221-apiConnection-overlay branch February 12, 2025 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨Feat 새로운 기능 구현 (새로운 로직 추가, UI 구현 등)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants