Skip to content

Commit 6c295b8

Browse files
authored
Merge pull request #98 from YAPP-Github/saturday2
[TNT-254] QA ๋ฐ˜์˜
2 parents 4921687 + fbe3af4 commit 6c295b8

File tree

54 files changed

+721
-227
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+721
-227
lines changed

โ€ŽTnT/Projects/Data/Sources/Network/Foundation/NetworkError.swiftโ€Ž

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ enum NetworkError: Error {
1717
case unauthorized(message: String?) // 401
1818
case forbidden(message: String?) // 403
1919
case notFound(message: String?) // 404
20+
case conflict(message: String?) // 409
2021

2122
// MARK: - Server Errors (500 ~ 599)
2223
case serverError(statusCode: Int, message: String?)
@@ -47,6 +48,8 @@ extension NetworkError: LocalizedError {
4748
return "[403] \(message ?? "๊ถŒํ•œ์ด ์—†์Šต๋‹ˆ๋‹ค.")"
4849
case .notFound(let message):
4950
return "[404] \(message ?? "์š”์ฒญํ•œ ๋ฆฌ์†Œ์Šค๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.")"
51+
case .conflict(let message):
52+
return "[409] \(message ?? "์š”์ฒญ์ด ์ถฉ๋Œ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.")"
5053
case .timeout:
5154
return "์š”์ฒญ ์‹œ๊ฐ„์ด ์ดˆ๊ณผ๋˜์—ˆ์Šต๋‹ˆ๋‹ค."
5255
case .noInternet:
@@ -57,4 +60,14 @@ extension NetworkError: LocalizedError {
5760
return "[\(statusCode ?? 0)] \(message ?? "์•Œ ์ˆ˜ ์—†๋Š” ์˜ค๋ฅ˜ ๋ฐœ์ƒ")"
5861
}
5962
}
63+
64+
/// UI ํ‘œ์‹œ ์—ฌ๋ถ€
65+
var isUIToastError: Bool {
66+
switch self {
67+
case .notFound, .conflict:
68+
return true
69+
default:
70+
return false
71+
}
72+
}
6073
}

โ€ŽTnT/Projects/Data/Sources/Network/Interceptor/Implements/ResponseValidator.swiftโ€Ž

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
import Foundation
1010

11+
import Domain
12+
1113
struct ResponseValidatorInterceptor: Interceptor {
1214
let priority: InterceptorPriority = .normal
1315

@@ -17,11 +19,18 @@ struct ResponseValidatorInterceptor: Interceptor {
1719
}
1820

1921
let statusCode: Int = httpResponse.statusCode
20-
let responseBody: String = String(data: data, encoding: .utf8) ?? "No Response"
21-
2222
switch statusCode {
2323
case 200..<300:
2424
return
25+
default:
26+
try throwError(with: data, statusCode: statusCode)
27+
}
28+
}
29+
30+
private func throwError(with data: Data, statusCode: Int) throws {
31+
let responseBody: String = try JSONDecoder().decode(ErrorResponse.self, from: data).message
32+
33+
switch statusCode {
2534
case 400:
2635
throw NetworkError.badRequest(message: responseBody)
2736

@@ -33,6 +42,9 @@ struct ResponseValidatorInterceptor: Interceptor {
3342

3443
case 404:
3544
throw NetworkError.notFound(message: responseBody)
45+
46+
case 409:
47+
throw NetworkError.conflict(message: responseBody)
3648

3749
case 405..<500:
3850
throw NetworkError.clientError(statusCode: statusCode, message: responseBody)

โ€ŽTnT/Projects/Data/Sources/Network/NetworkService.swiftโ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ public final class NetworkService {
4848
switch error {
4949
case .unauthorized:
5050
NotificationCenter.default.postSessionExpired()
51+
case .notFound(let message), .conflict(let message):
52+
NotificationCenter.default.post(toast: .init(presentType: .text("โš "), message: message ?? ""))
5153
default:
5254
NotificationCenter.default.post(toast: .init(presentType: .text("โš "), message: "์„œ๋ฒ„ ์š”์ฒญ์— ์‹คํŒจํ–ˆ์–ด์š”"))
5355
}

โ€ŽTnT/Projects/Data/Sources/Network/Service/SocialLogin/SNSLoginManager.swiftโ€Ž

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import AuthenticationServices
99
import KakaoSDKCommon
1010
import KakaoSDKAuth
1111
import KakaoSDKUser
12+
import FirebaseMessaging
1213

1314
import Domain
1415

@@ -172,3 +173,20 @@ extension SNSLoginManager {
172173
)
173174
}
174175
}
176+
177+
// MARK: FCM ํ† ํฐ
178+
extension SNSLoginManager {
179+
public func getFCMToken() async throws -> String {
180+
return try await withCheckedThrowingContinuation { continuation in
181+
Messaging.messaging().token { token, error in
182+
if let error = error {
183+
continuation.resume(throwing: error)
184+
} else if let token = token {
185+
continuation.resume(returning: token)
186+
} else {
187+
continuation.resume(throwing: LoginError.fcmError)
188+
}
189+
}
190+
}
191+
}
192+
}

โ€ŽTnT/Projects/Data/Sources/Network/Service/SocialLogin/SocialLogInRepositoryImpl.swiftโ€Ž

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public enum LoginError: Error {
1616
case networkFailure
1717
case kakaoError
1818
case appleError
19+
case fcmError
1920
case unknown(message: String)
2021
}
2122

@@ -34,4 +35,8 @@ public struct SocialLogInRepositoryImpl: SocialLoginRepository {
3435
public func kakaoLogin() async -> KakaoLoginInfo? {
3536
return await loginManager.kakaoLogin()
3637
}
38+
39+
public func getFCMToken() async throws -> String {
40+
return try await loginManager.getFCMToken()
41+
}
3742
}

โ€ŽTnT/Projects/DesignSystem/Sources/Button/TButton.swiftโ€Ž

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ public struct TButton: View {
6868

6969
// ์ œ๋ชฉ ์ถ”๊ฐ€
7070
Text(title)
71-
.typographyStyle(config.font, with: textColor)
72-
.frame(maxWidth: .infinity, alignment: .center)
71+
.typographyStyle(config.font, with: textColor)
72+
.frame(maxWidth: .infinity, alignment: .center)
73+
.frame(minHeight: config.font.lineHeight)
7374

7475
// ์˜ค๋ฅธ์ชฝ ์ด๋ฏธ์ง€ ์ถ”๊ฐ€
7576
if let rightImage = image, rightImage.type == .right || rightImage.type == .both {
@@ -79,15 +80,13 @@ public struct TButton: View {
7980
.frame(width: rightImage.size, height: rightImage.size)
8081
}
8182
}
82-
.padding(.vertical, config.verticalSize)
83-
.padding(.horizontal, config.horizontalSize)
84-
.background(backgroundColor)
85-
.clipShape(RoundedRectangle(cornerRadius: config.radius))
86-
.overlay {
83+
.padding(.vertical, config.verticalSize + 0.5)
84+
.padding(.horizontal, config.horizontalSize + 0.5)
85+
.background(
8786
RoundedRectangle(cornerRadius: config.radius)
87+
.fill(backgroundColor)
8888
.stroke(borderColor, lineWidth: 1.5)
89-
}
90-
.contentShape(Rectangle())
89+
)
9190
}
9291
}
9392

โ€ŽTnT/Projects/DesignSystem/Sources/Components/BottomSheet/AutoSizingBottomSheetModifier.swiftโ€Ž

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ struct AutoSizingBottomSheetModifier: ViewModifier {
2222

2323
func body(content: Content) -> some View {
2424
content
25+
.padding(.top, 24)
2526
.background(
2627
GeometryReader { proxy in
2728
Color.clear
2829
.onAppear {
29-
contentHeight = proxy.size.height + 10
30+
contentHeight = proxy.size.height
3031
}
3132
.onChange(of: proxy.size.height) { _, newHeight in
32-
contentHeight = newHeight + 10
33+
contentHeight = newHeight
3334
}
3435
}
3536
)

โ€ŽTnT/Projects/DesignSystem/Sources/Components/PopUp/TPopUpAlertView.swiftโ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public struct TPopUpAlertView: View {
3535
Text(alertState.title)
3636
.typographyStyle(.heading3, with: .neutral900)
3737
.multilineTextAlignment(.center)
38+
.fixedSize(horizontal: false, vertical: true)
3839
}
3940

4041
if let message = alertState.message {

โ€ŽTnT/Projects/DesignSystem/Sources/DesignSystem/Font+DesignSystem.swiftโ€Ž

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,40 +49,40 @@ public struct Typography {
4949
/// - size: ํฐํŠธ ํฌ๊ธฐ
5050
/// - lineHeightMultiplier: ์ค„ ๋†’์ด ๋ฐฐ์œจ (CGFloat)
5151
/// - letterSpacing: ์ž๊ฐ„ (CGFloat)
52-
init(_ weight: Pretendard.Weight, size: CGFloat, lineHeightMultiplier: CGFloat, letterSpacing: CGFloat) {
52+
init(_ weight: Pretendard.Weight, size: CGFloat, lineHeightMultiplier: CGFloat, letterSpacingRate: CGFloat) {
5353
self.font = weight.fontConvertible.swiftUIFont(size: size)
5454
self.uiFont = weight.fontConvertible.font(size: size)
5555
self.size = size
5656
self.lineHeight = size * lineHeightMultiplier
5757
self.lineSpacing = (size * lineHeightMultiplier) - size
58-
self.letterSpacing = letterSpacing
58+
self.letterSpacing = size * letterSpacingRate
5959
}
6060
}
6161
}
6262

6363
/// ์•ฑ์—์„œ ์‚ฌ์šฉํ•  ๊ธฐ๋ณธ์ ์ธ ํฐํŠธ ์Šคํƒ€์ผ์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค.
6464
public extension Typography.FontStyle {
6565
// Heading Styles
66-
static let heading1: Typography.FontStyle = Typography.FontStyle(.bold, size: 28, lineHeightMultiplier: 1.4, letterSpacing: -0.02)
67-
static let heading2: Typography.FontStyle = Typography.FontStyle(.bold, size: 24, lineHeightMultiplier: 1.5, letterSpacing: -0.02)
68-
static let heading3: Typography.FontStyle = Typography.FontStyle(.bold, size: 20, lineHeightMultiplier: 1.5, letterSpacing: -0.02)
69-
static let heading4: Typography.FontStyle = Typography.FontStyle(.bold, size: 18, lineHeightMultiplier: 1.5, letterSpacing: -0.02)
66+
static let heading1: Typography.FontStyle = Typography.FontStyle(.bold, size: 28, lineHeightMultiplier: 1.4, letterSpacingRate: -0.02)
67+
static let heading2: Typography.FontStyle = Typography.FontStyle(.bold, size: 24, lineHeightMultiplier: 1.5, letterSpacingRate: -0.02)
68+
static let heading3: Typography.FontStyle = Typography.FontStyle(.bold, size: 20, lineHeightMultiplier: 1.5, letterSpacingRate: -0.02)
69+
static let heading4: Typography.FontStyle = Typography.FontStyle(.bold, size: 18, lineHeightMultiplier: 1.5, letterSpacingRate: -0.02)
7070

7171
// Body Styles
72-
static let body1Bold: Typography.FontStyle = Typography.FontStyle(.bold, size: 16, lineHeightMultiplier: 1.5, letterSpacing: -0.02)
73-
static let body1Semibold: Typography.FontStyle = Typography.FontStyle(.semibold, size: 16, lineHeightMultiplier: 1.5, letterSpacing: -0.02)
74-
static let body1Medium: Typography.FontStyle = Typography.FontStyle(.medium, size: 16, lineHeightMultiplier: 1.6, letterSpacing: -0.02)
75-
static let body2Bold: Typography.FontStyle = Typography.FontStyle(.bold, size: 15, lineHeightMultiplier: 1.5, letterSpacing: -0.02)
76-
static let body2Medium: Typography.FontStyle = Typography.FontStyle(.medium, size: 15, lineHeightMultiplier: 1.5, letterSpacing: -0.02)
72+
static let body1Bold: Typography.FontStyle = Typography.FontStyle(.bold, size: 16, lineHeightMultiplier: 1.5, letterSpacingRate: -0.02)
73+
static let body1Semibold: Typography.FontStyle = Typography.FontStyle(.semibold, size: 16, lineHeightMultiplier: 1.5, letterSpacingRate: -0.02)
74+
static let body1Medium: Typography.FontStyle = Typography.FontStyle(.medium, size: 16, lineHeightMultiplier: 1.6, letterSpacingRate: -0.02)
75+
static let body2Bold: Typography.FontStyle = Typography.FontStyle(.bold, size: 15, lineHeightMultiplier: 1.5, letterSpacingRate: -0.02)
76+
static let body2Medium: Typography.FontStyle = Typography.FontStyle(.medium, size: 15, lineHeightMultiplier: 1.5, letterSpacingRate: -0.02)
7777

7878
// Label Styles
79-
static let label1Bold: Typography.FontStyle = Typography.FontStyle(.bold, size: 13, lineHeightMultiplier: 1.3, letterSpacing: -0.02)
80-
static let label1Medium: Typography.FontStyle = Typography.FontStyle(.medium, size: 13, lineHeightMultiplier: 1.5, letterSpacing: -0.02)
81-
static let label2Bold: Typography.FontStyle = Typography.FontStyle(.bold, size: 12, lineHeightMultiplier: 1.5, letterSpacing: -0.02)
82-
static let label2Medium: Typography.FontStyle = Typography.FontStyle(.medium, size: 12, lineHeightMultiplier: 1.5, letterSpacing: -0.02)
79+
static let label1Bold: Typography.FontStyle = Typography.FontStyle(.bold, size: 13, lineHeightMultiplier: 1.3, letterSpacingRate: -0.02)
80+
static let label1Medium: Typography.FontStyle = Typography.FontStyle(.medium, size: 13, lineHeightMultiplier: 1.5, letterSpacingRate: -0.02)
81+
static let label2Bold: Typography.FontStyle = Typography.FontStyle(.bold, size: 12, lineHeightMultiplier: 1.5, letterSpacingRate: -0.02)
82+
static let label2Medium: Typography.FontStyle = Typography.FontStyle(.medium, size: 12, lineHeightMultiplier: 1.5, letterSpacingRate: -0.02)
8383

8484
// Caption Styles
85-
static let caption1: Typography.FontStyle = Typography.FontStyle(.medium, size: 11, lineHeightMultiplier: 1.3, letterSpacing: -0.02)
85+
static let caption1: Typography.FontStyle = Typography.FontStyle(.medium, size: 11, lineHeightMultiplier: 1.3, letterSpacingRate: -0.02)
8686
}
8787

8888
/// ํ…์ŠคํŠธ์— Typography ์Šคํƒ€์ผ๊ณผ ์ƒ‰์ƒ์„ ์ ์šฉํ•˜๋Š” ViewModifier์ž…๋‹ˆ๋‹ค.
@@ -91,13 +91,31 @@ public extension Typography.FontStyle {
9191
struct TypographyModifier: ViewModifier {
9292
let style: Typography.FontStyle
9393
let color: Color
94-
94+
9595
func body(content: Content) -> some View {
9696
content
9797
.font(style.font)
9898
.lineSpacing(style.lineSpacing)
9999
.kerning(style.letterSpacing)
100100
.foregroundStyle(color)
101+
.background(
102+
GeometryReader { proxy in
103+
Color.clear
104+
.onAppear {
105+
if proxy.size.height < style.lineHeight {
106+
applySingleLineFix(content: content)
107+
}
108+
}
109+
}
110+
)
111+
}
112+
113+
/// ํ•œ ์ค„์งœ๋ฆฌ ํ…์ŠคํŠธ์— ๋Œ€ํ•œ lineHeight ์ ์šฉ
114+
@ViewBuilder
115+
private func applySingleLineFix(content: Content) -> some View {
116+
content
117+
.frame(height: style.lineHeight)
118+
.baselineOffset((style.lineHeight - style.size) / 2)
101119
}
102120
}
103121

โ€ŽTnT/Projects/Domain/Sources/DTO/EmptyResponse.swiftโ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@ import Foundation
1212
public struct EmptyResponse: Decodable {
1313
public init() {}
1414
}
15+
16+
public struct ErrorResponse: Decodable {
17+
public let message: String
18+
}

0 commit comments

Comments
ย (0)