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

[CVW-030] 웹소켓 & 환율정보 획득 과정 에러처리 #41

Merged
merged 50 commits into from
Feb 2, 2025

Conversation

J0onYEong
Copy link
Collaborator

변경된 점

  • 웹소켓 서비스 에러처리
  • 웹소켓 헬퍼 에러처리
  • AlertShooter구현 및 연동
  • 환율 정보 획득 실패시 에러처리

웹소켓 & 환율정보 처리(도메인) 에러처리 플로우

image

AlertModel

AlertModel은 Alert표출에 필요한 정보를 담고 있습니다.
AlertAction을 통해 버튼 유저가 버튼을 클릭시 수행할 작업을 전달할 수 있습니다.

var alertModel = AlertModel(
    titleKey: TextKey.Alert.Title.webSocketError.rawValue,
    messageKey: TextKey.Alert.Message.streamSubFailure.rawValue
)
alertModel
    .add(action: .init(
        titleKey: TextKey.Alert.ActionTitle.cancel.rawValue,
        config: .init(textColor: .red)
    ))
alertModel
    .add(action: .init(
        titleKey: TextKey.Alert.ActionTitle.retry.rawValue,
        action: { [weak self] in
            guard let self else { return }
            requestSubscribeToStream(streams: streams)
    }))
alertShooter.shoot(alertModel)

I18N

Alert에 표시되는 정보들은 I18N을 지원합니다.

복잡한 키관리를 간소화 하기위해 TextKey타입을 생성하였습니다.

런타임시 키값 불일치를 방지하기 위해 키값에 일치하는 언어값이 존재하는지 확인하는 테스트 코드를 작성했습니다.

Alert시현영상

버튼을 동적으로 새성하기 위해 커스텀 Alert를 구현했습니다.
Alert동작으로 부터 상태를 회복합니다.

@J0onYEong J0onYEong requested a review from GomHyeok January 31, 2025 08:52
@J0onYEong J0onYEong merged commit 16e9b2f into main Feb 2, 2025
1 check passed
@GomHyeok
Copy link
Collaborator

GomHyeok commented Feb 3, 2025

제가 이해한 방식은 아래와 같습니다.

  • Root에서 AlertRO 상태를 관리하는 isAlertPresent 값을 가지며 Queue를 통해 보여줘야 하는 RO를 유지하며, 먼저 들어온 Alert 부터 화면에 올린다.
  • Alert가 하나씩 사라질 때 마다 Queue의 상태를 관리한다.
  • RootView에서 viewModel의 isAlertPresent값이 바뀜에 따라 View를 생성한 수 Present한다.

혹시 제가 잘못 이해한 부분이 있다면 말씀해주세요.
해당 방식이 매우 효율적이라고 생각합니다. Listener를 사용하는 방식이 좋다고 생각합니다!

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.

2 participants