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

[SCRUM-50] ErrorFeature: 네트워크 에러뷰, 서버통신 에러뷰 UI #57

Merged
merged 8 commits into from
Nov 24, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ public enum Feature: String, Modulable {
case MyPageFeature
case PomodoroFeature
case CatFeature
case ErrorFeature
}
3 changes: 2 additions & 1 deletion Projects/Feature/CatFeature/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ let project: Project = .makeTMABasedProject(
],
dependencies: [
.sources: [
.dependency(rootModule: Domain.self)
.dependency(rootModule: Domain.self),
.dependency(module: Feature.ErrorFeature)
devMinseok marked this conversation as resolved.
Show resolved Hide resolved
],
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"images" : [
{
"filename" : "ICON_DEMO.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
<rect key="frame" x="0.0" y="832" width="393" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ErrorFeature 모듈 데모앱" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
<rect key="frame" x="0.0" y="263.66666666666669" width="393" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="obG-Y5-kRd" secondAttribute="centerX" id="5cz-MP-9tL"/>
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
<constraint firstItem="obG-Y5-kRd" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" constant="20" symbolic="YES" id="SfN-ll-jLj"/>
<constraint firstAttribute="bottom" secondItem="obG-Y5-kRd" secondAttribute="bottom" constant="20" id="Y44-ml-fuU"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" symbolic="YES" id="x7j-FC-K8j"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
34 changes: 34 additions & 0 deletions Projects/Feature/ErrorFeature/Example/Sources/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import SwiftUI

import ErrorFeature

struct ContentView: View {
@State var isNetworkErrorViewPresented = false
@State var isRequestErrorViewPresented = false

var body: some View {
VStack(spacing: 20) {
Spacer()

Button(title: "네트워크 에러 뷰") {
isNetworkErrorViewPresented = true
}

Button(title: "서버통신 에러 뷰") {
isRequestErrorViewPresented = true
}

Spacer()
}
.fullScreenCover(isPresented: $isNetworkErrorViewPresented) {
NetworkErrorView()
}
.fullScreenCover(isPresented: $isRequestErrorViewPresented) {
RequestErrorView()
}
}
}

#Preview {
ContentView()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import SwiftUI

@main
struct ErrorFeatureApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
22 changes: 22 additions & 0 deletions Projects/Feature/ErrorFeature/Project.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import ProjectDescription
import ProjectDescriptionHelpers

@_spi(Feature)
@_spi(Domain)
import DependencyPlugin

let project: Project = .makeTMABasedProject(
module: Feature.ErrorFeature,
scripts: [],
targets: [
.sources,
.tests,
.testing,
.example
],
dependencies: [
.sources: [
.dependency(rootModule: Domain.self)
]
]
)
12 changes: 12 additions & 0 deletions Projects/Feature/ErrorFeature/Sources/ErrorFeature.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// ErrorFeature.swift
// ErrorFeature
//
// Created by <#T##Author name#> on 11/14/24.
//

import Foundation

public struct ErrorFeature {
public init() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//
// NetworkErrorView.swift
// ErrorFeature
//
// Created by 김지현 on 11/14/24.
// Copyright © 2024 PomoNyang. All rights reserved.
//

import SwiftUI

import DesignSystem

public struct NetworkErrorView: View {
@Environment(\.dismiss) var dismiss

public init() {

}

public var body: some View {
HStack {
Spacer()

VStack(spacing: Alias.Spacing.xxxLarge) {
Spacer()

DesignSystemAsset.Image.imgOnboarding1.swiftUIImage

VStack(spacing: Alias.Spacing.small) {
Text("인터넷 연결이 불안정해요")
.font(Typography.header4)
.foregroundStyle(Alias.Color.Text.primary)
Text("연결 상태를 확인한 후\n다시 시도해 주세요.")
.multilineTextAlignment(.center)
.font(Typography.bodyR)
.foregroundStyle(Alias.Color.Text.secondary)
}
.padding(.bottom, 34)

Button(title: "다시 시도하기") {
dismiss()
}
.buttonStyle(.box(level: .primary, size: .large, width: .medium))

Spacer()
}

Spacer()
}
.background(Alias.Color.Background.primary)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// RequestErrorView.swift
// ErrorFeature
//
// Created by 김지현 on 11/14/24.
// Copyright © 2024 PomoNyang. All rights reserved.
//

import SwiftUI

import DesignSystem

public struct RequestErrorView: View {
@Environment(\.dismiss) var dismiss

public init() {

}

public var body: some View {
HStack {
Spacer()

VStack(spacing: Alias.Spacing.xxxLarge) {
Spacer()

DesignSystemAsset.Image.imgOnboarding1.swiftUIImage

VStack(spacing: Alias.Spacing.small) {
Text("문제가 발생했어요")
.font(Typography.header4)
.foregroundStyle(Alias.Color.Text.primary)
Text("잠시 후에 다시 확인해주세요.\n문제가 지속된다면 고객센터에 문의해주세요.")
.multilineTextAlignment(.center)
.font(Typography.bodyR)
.foregroundStyle(Alias.Color.Text.secondary)
}
.padding(.bottom, 34)

VStack(spacing: Alias.Spacing.large) {
Button(title: "홈으로 이동") {
dismiss()
}
.buttonStyle(.box(level: .primary, size: .large, width: .medium))

Button(
action: {
print("고객센터 문의")
},
label: {
Text("고객센터 문의")
.font(Typography.bodyR)
.underline(pattern: .solid, color: Alias.Color.Text.tertiary)
.foregroundStyle(Alias.Color.Text.tertiary)
}
)
}

Spacer()
}

Spacer()
}
.background(Alias.Color.Background.primary)
}
}
12 changes: 12 additions & 0 deletions Projects/Feature/ErrorFeature/Testing/ErrorFeatureTesting.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// ErrorFeatureTesting.swift
// ErrorFeature
//
// Created by <#T##Author name#> on 11/14/24.
//

import Foundation

public struct ErrorFeatureTesting {
public init() {}
}
33 changes: 33 additions & 0 deletions Projects/Feature/ErrorFeature/Tests/ErrorFeatureTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// ErrorFeatureTests.swift
// ErrorFeature
//
// Created by <#T##Author name#> on 11/14/24.
//

import XCTest

final class ErrorFeatureTests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}

override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}

func testExample() throws {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
// Any test you write for XCTest can be annotated as throws and async.
// Mark your test throws to produce an unexpected failure when your test encounters an uncaught error.
// Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards.
}

func testPerformanceExample() throws {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}
Loading