Skip to content

Commit 5cc7d8b

Browse files
authored
Merge pull request #35 from EST-iOS-TEAM2/feature/#34
[FEAT] #34 Connect Usecases, add LastView animation
2 parents c20d1dd + 9591ef7 commit 5cc7d8b

File tree

9 files changed

+278
-184
lines changed

9 files changed

+278
-184
lines changed

Dietto/Dietto/Domain/Usecases/UserStorageUsecase.swift

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
protocol UserStorageUsecase {
1111
func createUserData(_ user: UserEntity)
1212
func getUserData() -> UserEntity?
13-
func updateUserData(_ user: UserEntity)
13+
func updateUserDefaultData(id: UUID, name: String, gender: Gender, height: Int)
1414
func updateGoal(id: UUID, weight: Int, distance: Int)
1515
func updateCurrentWeight(id: UUID, currentWeight: Int)
1616
func deleteUserData()
@@ -58,14 +58,13 @@ final class UserStorageUsecaseImpl<Repository: StorageRepository>: UserStorageUs
5858
}
5959
}
6060

61-
func updateUserData(_ user: UserEntity) {
62-
let userID = user.id
63-
let predicate = #Predicate<UserDTO> { $0.id == userID }
61+
func updateUserDefaultData(id: UUID, name: String, gender: Gender, height: Int) {
62+
let predicate = #Predicate<UserDTO> { $0.id == id }
6463
do {
6564
try storage.updateData(predicate: predicate) { dto in
66-
dto.name = user.name
67-
dto.gender = user.gender.rawValue
68-
dto.height = user.height
65+
dto.name = name
66+
dto.gender = gender.rawValue
67+
dto.height = height
6968
}
7069
}
7170
catch {

Dietto/Dietto/Presentation/Article/View/ArticleView.swift

Lines changed: 75 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -16,44 +16,48 @@ struct ArticleView: View {
1616
]
1717
@StateObject var viewModel: ArticleViewModel
1818
var body: some View {
19-
NavigationView {
20-
VStack(alignment: .leading){
21-
HStack {
22-
//MARK: - 로고
23-
Text("Dietto")
24-
.font(.NerkoOne40)
25-
.foregroundStyle(.text)
26-
Spacer()
19+
ZStack{
20+
Color.backGround.ignoresSafeArea()
21+
22+
NavigationView {
23+
VStack(alignment: .leading){
24+
HStack {
25+
//MARK: - 로고
26+
Text("Dietto")
27+
.font(.NerkoOne40)
28+
.foregroundStyle(.text)
29+
Spacer()
30+
31+
NavigationLink(destination: InterestsView(viewModel: viewModel)) {
32+
Text("관심사 수정")
33+
.font(.pretendardMedium16)
34+
.foregroundColor(.white)
35+
.padding(.vertical, 4)
36+
.padding(.horizontal, 12)
37+
.background(Color.appMain)
38+
.clipShape(Capsule())
39+
}
40+
}
41+
.padding([.leading, .trailing], 16)
42+
Text("내 관심사")
43+
.font(.pretendardBold20)
44+
.padding(.leading, 16)
45+
Interests(
46+
topic: "",
47+
titles: viewModel.selectedInterests.map{$0.title},
48+
onClicked: {_ in },
49+
isSelected: {_ in true}
50+
).padding(.leading, 16)
2751

28-
NavigationLink(destination: InterestsView(viewModel: viewModel)) {
29-
Text("관심사 수정")
30-
.font(.pretendardMedium16)
31-
.foregroundColor(.white)
32-
.padding(.vertical, 4)
33-
.padding(.horizontal, 12)
34-
.background(Color.appMain)
35-
.clipShape(Capsule())
52+
List(articles, id: \.self) { item in
53+
LinkRow(previewURL: URL(string: item)!)
54+
.background(Color.backGround).ignoresSafeArea(.all)
3655
}
56+
.listStyle(.plain)
3757
}
38-
.padding([.leading, .trailing], 16)
39-
Text("내 관심사")
40-
.font(.pretendardBold20)
41-
.padding(.leading, 16)
42-
Interests(
43-
topic: "",
44-
titles: viewModel.selectedInterests.map{$0.title},
45-
onClicked: {_ in },
46-
isSelected: {_ in true}
47-
).padding(.leading, 16)
48-
49-
List(articles, id: \.self) { item in
50-
LinkRow(previewURL: URL(string: item)!)
51-
}
52-
.listStyle(.plain)
53-
5458
}
59+
.toolbarVisibility(.hidden, for: .navigationBar)
5560
}
56-
.toolbarVisibility(.hidden, for: .navigationBar)
5761
}
5862
}
5963

@@ -71,43 +75,43 @@ struct ArticleView: View {
7175
//
7276
/*
7377
[
74-
{
75-
"title": "계룡시, 등굣길 금연 캠페인 성황리에 마무리",
76-
"link": "https://www.news1.kr/articles/?5301234"
77-
},
78-
{
79-
"title": "영도구보건소, 금연구역 인증 걷기 챌린지 운영",
80-
"link": "https://www.news2.kr/articles/?5301235"
81-
},
82-
{
83-
"title": "광주시의회, 세계 금연의 날 맞아 금연 결의 대회 개최",
84-
"link": "https://www.news3.kr/articles/?5301236"
85-
},
86-
{
87-
"title": "팔굽혀펴기로 치매 예방하기?...근육량 증가하면 당뇨·치매 위험 낮아져 [Health Recipe]",
88-
"link": "https://www.healthnews.kr/articles/?5301237"
89-
},
90-
{
91-
"title": "노년층 복병 ‘골근감소증’ “장내 미생물 먹었더니”…뼈밀도·근육량 증가↑",
92-
"link": "https://www.healthnews.kr/articles/?5301238"
93-
},
94-
{
95-
"title": "체중 재증가하는 여성은 근육량보다 지방량 증가가 원인",
96-
"link": "https://www.healthnews.kr/articles/?5301239"
97-
},
98-
{
99-
"title": "금연 무기력함 극복하는 꿀팁 3가지를 소개합니다! : 네이버 블로그",
100-
"link": "https://blog.naver.com/PostView.nhn?blogId=example1&logNo=222123456789"
101-
},
102-
{
103-
"title": "근육량 증가, 근성장을 극대화해줄 꿀팁! - 네이버 블로그",
104-
"link": "https://blog.naver.com/PostView.nhn?blogId=example2&logNo=222123456790"
105-
},
106-
{
107-
"title": "지속 가능한 근육량 증가 운동 프로그램 : 네이버 블로그",
108-
"link": "https://blog.naver.com/PostView.nhn?blogId=example3&logNo=222123456791"
109-
}
78+
{
79+
"title": "계룡시, 등굣길 금연 캠페인 성황리에 마무리",
80+
"link": "https://www.news1.kr/articles/?5301234"
81+
},
82+
{
83+
"title": "영도구보건소, 금연구역 인증 걷기 챌린지 운영",
84+
"link": "https://www.news2.kr/articles/?5301235"
85+
},
86+
{
87+
"title": "광주시의회, 세계 금연의 날 맞아 금연 결의 대회 개최",
88+
"link": "https://www.news3.kr/articles/?5301236"
89+
},
90+
{
91+
"title": "팔굽혀펴기로 치매 예방하기?...근육량 증가하면 당뇨·치매 위험 낮아져 [Health Recipe]",
92+
"link": "https://www.healthnews.kr/articles/?5301237"
93+
},
94+
{
95+
"title": "노년층 복병 ‘골근감소증’ “장내 미생물 먹었더니”…뼈밀도·근육량 증가↑",
96+
"link": "https://www.healthnews.kr/articles/?5301238"
97+
},
98+
{
99+
"title": "체중 재증가하는 여성은 근육량보다 지방량 증가가 원인",
100+
"link": "https://www.healthnews.kr/articles/?5301239"
101+
},
102+
{
103+
"title": "금연 무기력함 극복하는 꿀팁 3가지를 소개합니다! : 네이버 블로그",
104+
"link": "https://blog.naver.com/PostView.nhn?blogId=example1&logNo=222123456789"
105+
},
106+
{
107+
"title": "근육량 증가, 근성장을 극대화해줄 꿀팁! - 네이버 블로그",
108+
"link": "https://blog.naver.com/PostView.nhn?blogId=example2&logNo=222123456790"
109+
},
110+
{
111+
"title": "지속 가능한 근육량 증가 운동 프로그램 : 네이버 블로그",
112+
"link": "https://blog.naver.com/PostView.nhn?blogId=example3&logNo=222123456791"
113+
}
110114
]
111-
112-
115+
116+
113117
*/

Dietto/Dietto/Presentation/MainTabView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct MainTabView: View {
2121
ArticleView(viewModel: diContainer.getArticleViewModel())
2222
}
2323
Tab("프로필", systemImage: "person.circle.fill") {
24-
ProfileView()
24+
ProfileView(viewModel : diContainer.getOnboardingViewModel())
2525
}
2626
}
2727
}

Dietto/Dietto/Presentation/Onboarding/View/IntroView.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
import SwiftUI
99

1010
struct IntroView: View {
11+
12+
@Environment(DIContainer.self) private var diContainer
13+
1114
@State private var first: Bool = false
1215
@State private var second: Bool = false
1316
@State private var nextbtn: Bool = false
14-
@State private var navigate: Bool = false // ✅ push 트리거
17+
@State private var navigate: Bool = false
1518

1619
var body: some View {
1720
NavigationStack {
@@ -43,7 +46,7 @@ struct IntroView: View {
4346
Spacer()
4447

4548
if nextbtn {
46-
NavigationLink(destination: TutorialView()
49+
NavigationLink(destination: TutorialView(viewModel: diContainer.getOnboardingViewModel())
4750
.navigationBarBackButtonHidden(true)) {
4851
Text("다음")
4952
.frame(maxWidth: .infinity)

Dietto/Dietto/Presentation/Onboarding/View/LastView.swift

Lines changed: 47 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,59 @@ import SwiftUI
99

1010
struct LastView: View {
1111

12-
var nickName = "asddasasd"
12+
var nickName = ""
13+
14+
@State private var animating : Bool = false
1315

1416
var body: some View {
15-
VStack {
16-
Spacer()
17-
withAnimation(.easeInOut) {
18-
Text("\(nickName)님의 Challenge를 응원합니다!")
19-
.multilineTextAlignment(.center)
20-
.foregroundColor(.appMain)
17+
ZStack {
18+
Color.backGround
19+
.ignoresSafeArea(.all)
20+
ZStack {
21+
VStack{
22+
if animating {
23+
Text("\(nickName)님의 ")
24+
+ Text("Challenge")
25+
.foregroundStyle(.text)
26+
+ Text("\n 응원합니다!")
27+
}
28+
}.multilineTextAlignment(.center)
29+
.foregroundStyle(.appMain)
2130
.font(.pretendardBlack24)
22-
.padding()
31+
// VStack {
32+
// Spacer()
33+
// withAnimation(.easeInOut) {
34+
// Text("\(nickName)님의 Challenge를 응원합니다!")
35+
// .multilineTextAlignment(.center)
36+
// .foregroundColor(.appMain)
37+
// .font(.pretendardBlack24)
38+
// .padding()
39+
// }
40+
// Spacer()
41+
// Button {
42+
// // 다음으로 넘어가는 함수
43+
// } label: {
44+
// Text("시작하기")
45+
// .frame(maxWidth: .infinity)
46+
// .padding()
47+
// .background(Color.appMain)
48+
// .foregroundColor(.white)
49+
// .cornerRadius(13)
50+
// .font(.pretendardMedium16)
51+
// }
52+
// .padding(.horizontal, 20)
53+
// .padding(.bottom, 20)
54+
// }
55+
// .frame(maxHeight: .infinity, alignment: .center)
2356
}
24-
Spacer()
25-
Button {
26-
// 다음으로 넘어가는 함수
27-
} label: {
28-
Text("시작하기")
29-
.frame(maxWidth: .infinity)
30-
.padding()
31-
.background(Color.appMain)
32-
.foregroundColor(.white)
33-
.cornerRadius(13)
34-
.font(.pretendardMedium16)
57+
.animation(.easeInOut(duration: 1), value: animating)
58+
}.onAppear{
59+
animating = true
60+
61+
DispatchQueue.main.asyncAfter(deadline: .now() + 4) {
62+
animating = false
3563
}
36-
.padding(.horizontal, 20)
37-
.padding(.bottom, 20)
3864
}
39-
.frame(maxHeight: .infinity, alignment: .center)
4065
}
4166
}
4267

0 commit comments

Comments
 (0)