Skip to content

Commit

Permalink
[SCRUM-56] 에러 및 로딩 대응 리팩토링 (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jihyun247 authored Nov 24, 2024
1 parent 54b4b39 commit f977780
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public struct NetworkErrorCore {
private func core(_ state: inout State, _ action: Action) -> EffectOf<Self> {
switch action {
case .tryAgain:
//TODO: 11.25 재시도 로직
return .none
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public struct RequestErrorCore {
case .moveToHome:
return .none
case .moveToCustomerService:
guard let feedbackURL = URL(string: "https://forms.gle/wEUPH9Tvxgua4hCZ9") else { return .none }
return .run { _ in await self.openURL(feedbackURL) }
guard let kakaoChannelURL = URL(string: "http://pf.kakao.com/_FvuAn") else { return .none }
return .run { _ in await self.openURL(kakaoChannelURL) }
}
}
}
1 change: 0 additions & 1 deletion Projects/Feature/Feature/Sources/AppCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ public struct AppCore {
case .networkError:
return .none

// TODO: state 초기화 방법 변경 필요 + 온보딩 첫페이지로 돌아가면 온보딩 carousel 이미지 안뜸
case .requestError(.presented(.moveToHome)):
if state.onboarding != nil {
state.onboarding = OnboardingCore.State()
Expand Down
23 changes: 5 additions & 18 deletions Projects/Feature/Feature/Sources/AppView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import OnboardingFeature
import ErrorFeature

import ComposableArchitecture
import Lottie

public struct AppView: View {
@Bindable var store: StoreOf<AppCore>
Expand Down Expand Up @@ -46,23 +45,8 @@ public struct AppView: View {
}
.transition(.opacity)
.animation(.easeInOut, value: store.home == nil)
.onLoad {
store.send(.onLoad)
}
.fullScreenCover(isPresented: $store.isLoading) {
VStack {
Spacer()
ZStack {
RoundedRectangle(cornerRadius: Alias.BorderRadius.medium)
.foregroundStyle(Alias.Color.Background.inverse)
.opacity(Global.Opacity._90d)
LottieView(animation: AnimationAsset.lotiSpinner.animation)
.playing(loopMode: .loop)
}
.frame(width: 82, height: 82)
Spacer()
}
.presentationBackground(.clear)
LoadingView()
}
.fullScreenCover(
item: $store.scope(
Expand All @@ -81,8 +65,11 @@ public struct AppView: View {
NetworkErrorView(store: store)
}
.transaction(value: store.isLoading) { transaction in
// TODO: 11/24, LoadingView 분리 + fullscreen animation disable
// TODO: 11.25 로딩 이외 다른 fullScreen들도 disabled됨
transaction.disablesAnimations = true
}
.onLoad {
store.send(.onLoad)
}
}
}
31 changes: 31 additions & 0 deletions Projects/Feature/Feature/Sources/Loading/LoadingView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// LoadingView.swift
// Feature
//
// Created by 김지현 on 11/25/24.
// Copyright © 2024 PomoNyang. All rights reserved.
//

import SwiftUI

import DesignSystem

import Lottie

struct LoadingView: View {
var body: some View {
VStack {
Spacer()
ZStack {
RoundedRectangle(cornerRadius: Alias.BorderRadius.medium)
.foregroundStyle(Alias.Color.Background.inverse)
.opacity(Global.Opacity._90d)
LottieView(animation: AnimationAsset.lotiSpinner.animation)
.playing(loopMode: .loop)
}
.frame(width: 82, height: 82)
Spacer()
}
.presentationBackground(.clear)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ public struct OnboardingView: View {
.background(Alias.Color.Background.primary)
.setFrameMeasure(space: .global, identifier: backgroundFrame)
.getFrameMeasure { value in
/* TODO: 11.25
Onboarding 재 초기화 시 FrameMeasure 관련 모디파이어를 안거침 . ,, 파악중
getFrameMeasure -> OnDisappear 시에도 거치는 이유는 ?
*/
guard let background = value[backgroundFrame] else { return }
store.width = background.width
}
Expand Down

0 comments on commit f977780

Please sign in to comment.