Skip to content

Commit e5c7a09

Browse files
author
Mincheol Kim
authored
Merge pull request #63 from Nexters/fix/mypage-badge
Fix/mypage badge
2 parents 4011275 + 7970201 commit e5c7a09

File tree

7 files changed

+21
-24
lines changed

7 files changed

+21
-24
lines changed

Sticky.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@
10831083
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
10841084
CODE_SIGN_IDENTITY = "Apple Development";
10851085
CODE_SIGN_STYLE = Automatic;
1086-
CURRENT_PROJECT_VERSION = 1;
1086+
CURRENT_PROJECT_VERSION = 3;
10871087
DEVELOPMENT_ASSET_PATHS = "\"Sticky/Preview Content\"";
10881088
DEVELOPMENT_TEAM = 787Q6972XA;
10891089
ENABLE_PREVIEWS = YES;
@@ -1111,7 +1111,7 @@
11111111
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
11121112
CODE_SIGN_IDENTITY = "Apple Development";
11131113
CODE_SIGN_STYLE = Automatic;
1114-
CURRENT_PROJECT_VERSION = 1;
1114+
CURRENT_PROJECT_VERSION = 3;
11151115
DEVELOPMENT_ASSET_PATHS = "\"Sticky/Preview Content\"";
11161116
DEVELOPMENT_TEAM = 787Q6972XA;
11171117
ENABLE_PREVIEWS = YES;

Sticky/Features/MyPage/Components/BadgeItem.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct BadgeItem: View {
1313
var badge: Badge
1414
@Binding var selection: ShareType?
1515
@Binding var showCountBadge: Bool
16-
@EnvironmentObject var shareViewModel: ShareViewModel
16+
@StateObject var shareViewModel: ShareViewModel
1717

1818
var body: some View {
1919
Button(action: {
@@ -63,7 +63,8 @@ struct BadgeItem_Previews: PreviewProvider {
6363
BadgeItem(
6464
badge: Badge(badgeType: BadgeType.monthly, badgeValue: "10"),
6565
selection: .constant(ShareType.card),
66-
showCountBadge: .constant(true)
66+
showCountBadge: .constant(true),
67+
shareViewModel: ShareViewModel()
6768
)
6869
}
6970
.environmentObject(ShareViewModel())

Sticky/Features/MyPage/Components/BadgePanel.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ struct BadgePanel: View {
1818
var badges: [Badge]?
1919
@Binding var selection: ShareType?
2020
@Binding var showCountBadge: Bool
21+
@StateObject var shareViewModel: ShareViewModel
2122

2223
var body: some View {
2324
VStack {
@@ -46,7 +47,8 @@ struct BadgePanel: View {
4647
BadgeItem(
4748
badge: badge,
4849
selection: $selection,
49-
showCountBadge: $showCountBadge
50+
showCountBadge: $showCountBadge,
51+
shareViewModel: shareViewModel
5052
)
5153
}
5254
}
@@ -77,7 +79,8 @@ struct BadgePanel_Previews: PreviewProvider {
7779
trailing: AnyView(Text("이번 달")),
7880
badges: badgeMocks(count: 6),
7981
selection: .constant(ShareType.card),
80-
showCountBadge: .constant(true)
82+
showCountBadge: .constant(true),
83+
shareViewModel: ShareViewModel()
8184
)
8285
.padding()
8386
}

Sticky/Features/MyPage/Components/Summary.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct Summary: View {
1414
var seconds: Int
1515
@Binding var selection: ShareType?
1616
@EnvironmentObject var user: User
17-
@EnvironmentObject var shareViewModel: ShareViewModel
17+
@StateObject var shareViewModel: ShareViewModel
1818

1919
var body: some View {
2020
let tier = Tier(level: user.level)
@@ -91,8 +91,7 @@ struct Summary_Previews: PreviewProvider {
9191
static var previews: some View {
9292
ZStack {
9393
Color.GrayScale._100.ignoresSafeArea()
94-
Summary(seconds: 10, selection: .constant(ShareType.card))
95-
.environmentObject(ShareViewModel())
94+
Summary(seconds: 10, selection: .constant(ShareType.card), shareViewModel: ShareViewModel())
9695
.border(Color.black)
9796
}
9897
}

Sticky/Features/MyPage/Views/MyPage.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ struct MyPage: View {
7474
VStack(alignment: .leading, spacing: 20) {
7575
Summary(
7676
seconds: user.accumulateSeconds,
77-
selection: $navSelection
77+
selection: $navSelection,
78+
shareViewModel: shareViewModel
7879
)
7980
.padding(.bottom, 15)
8081
Divider()
@@ -84,22 +85,25 @@ struct MyPage: View {
8485
subtitle: "특별한 기록을 달성하면 받을 수 있어요.",
8586
badges: badgeViewModel.specials,
8687
selection: $navSelection,
87-
showCountBadge: .constant(false)
88+
showCountBadge: .constant(false),
89+
shareViewModel: shareViewModel
8890
)
8991
BadgePanel(
9092
title: "월간 달성",
9193
subtitle: "한달 내에 쌓은 시간을 기준으로 합니다.",
9294
trailing: monthlyButton as? AnyView,
9395
badges: badgeViewModel.monthly,
9496
selection: $navSelection,
95-
showCountBadge: $badgeViewModel.showCountBadge
97+
showCountBadge: $badgeViewModel.showCountBadge,
98+
shareViewModel: shareViewModel
9699
)
97100
BadgePanel(
98101
title: "연속 달성",
99102
subtitle: "멈추지 않고 이어서 기록된 시간을 기준으로 합니다.",
100103
badges: badgeViewModel.continuous,
101104
selection: $navSelection,
102-
showCountBadge: .constant(false)
105+
showCountBadge: .constant(false),
106+
shareViewModel: shareViewModel
103107
)
104108

105109
Spacer()

Sticky/Features/Share/Model/ShareViewModel.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@ class ShareViewModel: ObservableObject {
1313
init() {
1414
badge = loadBadge(forKey: "shareBadge")
1515
seconds = UserDefaults.standard.integer(forKey: "shareSeconds")
16-
// let type = Main.ChallengeType(
17-
// rawValue: UserDefaults.standard.integer(forKey: "challengeType")
18-
// ) ?? .notRunning
19-
// switch type {
20-
// case .notAtHome,
21-
// .notRunning,
22-
// .outing:
23-
// seconds = 0
24-
// case .running:
25-
// seconds = UserDefaults.standard.integer(forKey: "shareSeconds")
26-
// }
2716
}
2817

2918
// MARK: Internal

makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ endif
5151

5252
release:
5353
sed -i ".bak" "s/MARKETING_VERSION = .*/MARKETING_VERSION = $(shell npx next-standard-version);/g" ${PROJECT_NAME}.xcodeproj/project.pbxproj
54+
sed -i ".bak" "s/CURRENT_PROJECT_VERSION = .*/CURRENT_PROJECT_VERSION = ${GITHUB_RUN_NUMBER};/g" ${PROJECT_NAME}.xcodeproj/project.pbxproj
5455
.PHONY: release
5556

5657
# 마지막 tag로부터 현재까지의 changelog 및 버전 확인 용

0 commit comments

Comments
 (0)