Skip to content

Commit bc7eef4

Browse files
authored
Merge pull request #36 from YAPP-Github/design/#33-내여행탭
Design/#33 내여행탭
2 parents 9b0d43f + 889ad9d commit bc7eef4

53 files changed

Lines changed: 1930 additions & 643 deletions

File tree

Some content is hidden

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

Plugins/DependencyPlugin/ProjectDescriptionHelpers/Dependency+Project.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ public extension TargetDependency {
1313
public struct Home {}
1414
public struct TabBar {}
1515
public struct Follow {}
16-
public struct Travel {}
1716
public struct Search {}
1817
public struct Setting {}
1918
public struct PopularTravel {}
19+
public struct MyTravel {}
2020
public struct TravelTool {}
2121
}
2222

@@ -63,12 +63,6 @@ public extension TargetDependency.Features.Follow {
6363
static let feature = TargetDependency.Features.project(name: "Feature", group: group)
6464
}
6565

66-
public extension TargetDependency.Features.Travel {
67-
static let group = "Travel"
68-
69-
static let feature = TargetDependency.Features.project(name: "Feature", group: group)
70-
}
71-
7266
public extension TargetDependency.Features.Search {
7367
static let group = "Search"
7468

@@ -93,6 +87,12 @@ public extension TargetDependency.Features.PopularTravel {
9387
static let feature = TargetDependency.Features.project(name: "Feature", group: group)
9488
}
9589

90+
public extension TargetDependency.Features.MyTravel {
91+
static let group = "MyTravel"
92+
93+
static let feature = TargetDependency.Features.project(name: "Feature", group: group)
94+
}
95+
9696
public extension TargetDependency.Features.TravelTool {
9797
static let group = "TravelTool"
9898

Projects/App/Sources/Application/AppComponent.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ final class AppComponent: Component<EmptyDependency>, RootDependency {
7373
TemplatesSearchUsecase(travelTemplateRepository: travelTemplateRepository)
7474
}
7575
}
76+
77+
var myTravelUsecase: MyTravelUsecaseProtocol {
78+
shared {
79+
MyTravelUsecase(
80+
travelTemplateRepository: travelTemplateRepository,
81+
userTravelRepository: userTravelRepository
82+
)
83+
}
84+
}
7685

7786
var authRepository: AuthRepositoryInterface {
7887
shared { makeAuthRepository() }
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// Date+.swift
3+
// Core
4+
//
5+
// Created by 최안용 on 2/22/26.
6+
// Copyright © 2026 NDGL-iOS. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
public extension Date {
12+
func toKoreanMMdd() -> String {
13+
let formatter = DateFormatter()
14+
formatter.locale = Locale(identifier: "ko_KR")
15+
formatter.dateFormat = "M월 d일"
16+
return formatter.string(from: self)
17+
}
18+
}

Projects/Core/Sources/Extensions/Foundation+/String+.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,11 @@ public extension String {
3131
let locale = Locale(identifier: "ko_KR")
3232
return locale.localizedString(forRegionCode: self) ?? "알 수 없음"
3333
}
34+
35+
func toDate() -> Date? {
36+
let formatter = DateFormatter()
37+
formatter.locale = Locale(identifier: "en_US_POSIX")
38+
formatter.dateFormat = "yyyy-MM-dd"
39+
return formatter.date(from: self)
40+
}
3441
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//
2+
// UserDefaultWrapper.swift
3+
// Core
4+
//
5+
// Created by 최안용 on 2/23/26.
6+
// Copyright © 2026 NDGL-iOS. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
@propertyWrapper public struct UserDefaultWrapper<T> {
12+
public var wrappedValue: T? {
13+
get {
14+
return UserDefaults.standard.object(forKey: self.key.rawValue) as? T
15+
}
16+
17+
set {
18+
if newValue == nil {
19+
UserDefaults.standard.removeObject(forKey: self.key.rawValue)
20+
} else {
21+
UserDefaults.standard.setValue(newValue, forKey: self.key.rawValue)
22+
}
23+
}
24+
}
25+
26+
private let key: UserDefaultKeys
27+
28+
public init(key: UserDefaultKeys) {
29+
self.key = key
30+
}
31+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// UserManager.swift
3+
// Core
4+
//
5+
// Created by 최안용 on 2/23/26.
6+
// Copyright © 2026 NDGL-iOS. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
public enum UserDefaultKeys: String {
12+
case uuid = "uuid"
13+
case nickname = "nickname"
14+
case isFirstOpen = "isFirstOpen"
15+
}
16+
17+
public final class UserManager {
18+
@UserDefaultWrapper(key: .uuid) public var uuid: String?
19+
@UserDefaultWrapper(key: .nickname) public var nickname: String?
20+
@UserDefaultWrapper(key: .isFirstOpen) private var isFirstOpen: Bool?
21+
22+
public static let shared = UserManager()
23+
24+
private init() {}
25+
26+
public func isFirstOpenApp() -> Bool {
27+
guard let isFirstOpen else {
28+
self.isFirstOpen = true
29+
return true
30+
}
31+
return !isFirstOpen
32+
}
33+
}

Projects/Data/Sources/Repository/UserTravel /UserTravelRepository.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,12 @@ public final class UserTravelRepository: UserTravelRepositoryInterface {
4141
throw error.toNDGLError()
4242
}
4343
}
44+
45+
public func fetchUpcomingList(page: Int?, size: Int?) async throws -> [UpcomingInfo] {
46+
do {
47+
return try await service.getUpcomingList(page: page, size: size).toDomain()
48+
} catch {
49+
throw error.toNDGLError()
50+
}
51+
}
4452
}

Projects/Data/Sources/Transform/UserTravelTransform.swift

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,22 @@ extension CreateUserTravelResponse {
4949
}
5050
}
5151

52-
extension String {
53-
func toDate() -> Date? {
54-
let formatter = DateFormatter()
55-
formatter.locale = Locale(identifier: "en_US_POSIX")
56-
formatter.dateFormat = "yyyy-MM-dd"
57-
return formatter.date(from: self)
52+
extension UpcomingListResponse {
53+
func toDomain() -> [UpcomingInfo] {
54+
self.content.map {
55+
.init(
56+
id: $0.id,
57+
title: $0.title,
58+
country: $0.country,
59+
city: $0.city,
60+
startDate: $0.startDate.toDate() ?? .now,
61+
endDate: $0.endDate.toDate() ?? .now,
62+
nights: $0.nights,
63+
days: $0.days,
64+
templateId: $0.templateId,
65+
thumbnail: $0.thumbnail,
66+
profileImage: $0.profileImage
67+
)
68+
}
5869
}
5970
}

Projects/Domain/Sources/Interface/UserTravel/UserTravelRepositoryInterface.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,7 @@ import Foundation
1010

1111
public protocol UserTravelRepositoryInterface {
1212
func createUserTravel(request: CreateTravelRequest) async throws -> CreateTravelResponse
13+
// func fetchContentCard(id: Int) async throws ->
1314
func fetchUpcoming() async throws -> MyTripSummary
15+
func fetchUpcomingList(page: Int?, size: Int?) async throws -> [UpcomingInfo]
1416
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//
2+
// UpcomingInfo.swift
3+
// Domain
4+
//
5+
// Created by 최안용 on 2/22/26.
6+
// Copyright © 2026 NDGL-iOS. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
public struct UpcomingInfo {
12+
public let id: Int
13+
public let title: String
14+
public let country: String
15+
public let city: String
16+
public let startDate: Date
17+
public let endDate: Date
18+
public let nights: Int
19+
public let days: Int
20+
public let templateId: Int
21+
public let thumbnail: String?
22+
public let profileImage: String?
23+
24+
public init(
25+
id: Int,
26+
title: String,
27+
country: String,
28+
city: String,
29+
startDate: Date,
30+
endDate: Date,
31+
nights: Int,
32+
days: Int,
33+
templateId: Int,
34+
thumbnail: String?,
35+
profileImage: String?
36+
) {
37+
self.id = id
38+
self.title = title
39+
self.country = country
40+
self.city = city
41+
self.startDate = startDate
42+
self.endDate = endDate
43+
self.nights = nights
44+
self.days = days
45+
self.templateId = templateId
46+
self.thumbnail = thumbnail
47+
self.profileImage = profileImage
48+
}
49+
}

0 commit comments

Comments
 (0)