Skip to content

Commit 2ec5403

Browse files
authored
Merge pull request #204 from YAPP-Github/fix/#203-250906
Fix: 2.0.0 QA 3차
2 parents c3e2814 + 3208797 commit 2ec5403

File tree

20 files changed

+242
-166
lines changed

20 files changed

+242
-166
lines changed

Projects/App/Resources/Pokit-info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<key>CFBundlePackageType</key>
2222
<string>APPL</string>
2323
<key>CFBundleShortVersionString</key>
24-
<string>2.0.0</string>
24+
<string>2.0.1</string>
2525
<key>CFBundleURLTypes</key>
2626
<array>
2727
<dict>

Projects/App/ShareExtension/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<key>CFBundleName</key>
1414
<string>Pokit</string>
1515
<key>CFBundleShortVersionString</key>
16-
<string>1.0.9</string>
16+
<string>2.0.1</string>
1717
<key>CFBundleURLTypes</key>
1818
<array>
1919
<dict>

Projects/App/Sources/MainTab/MainTabFeatureView.swift

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,8 @@ public extension MainTabView {
7474
}
7575

7676
if self.store.linkPopup != nil {
77-
PokitLinkPopup(
78-
type: $store.linkPopup,
79-
action: { send(.링크팝업_버튼_눌렀을때, animation: .pokitSpring) }
80-
)
77+
PokitLinkPopup(type: $store.linkPopup)
78+
.onAction { send(.링크팝업_버튼_눌렀을때, animation: .pokitSpring) }
8179
}
8280
}
8381
}
@@ -93,11 +91,9 @@ private extension MainTabView {
9391
.overlay(alignment: .bottom) {
9492
VStack(spacing: 0) {
9593
if store.linkPopup != nil {
96-
PokitLinkPopup(
97-
type: $store.linkPopup,
98-
action: { send(.링크팝업_버튼_눌렀을때, animation: .pokitSpring) }
99-
)
100-
.padding(.bottom, 20)
94+
PokitLinkPopup(type: $store.linkPopup)
95+
.onAction { send(.링크팝업_버튼_눌렀을때, animation: .pokitSpring) }
96+
.padding(.bottom, 20)
10197
}
10298

10399
bottomTabBar

Projects/App/Sources/MainTab/MainTabPath.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,13 @@ public extension MainTabFeature {
194194
case .검색:
195195
return .merge(
196196
.send(.path(.element(id: stackElementId, action: .검색(.delegate(.컨텐츠_검색))))),
197-
.send(.inner(.링크팝업_활성화(.success(title: Constants.링크_저장_완료_문구))), animation: .pokitSpring)
197+
.send(.inner(.링크팝업_활성화(.success(title: Constants.링크_저장_완료_문구, until: 4))), animation: .pokitSpring)
198198
)
199199
default:
200-
return .send(.inner(.링크팝업_활성화(.success(title: Constants.링크_저장_완료_문구))), animation: .pokitSpring)
200+
return .send(.inner(.링크팝업_활성화(.success(title: Constants.링크_저장_완료_문구, until: 4))), animation: .pokitSpring)
201201
}
202202
case .recommend(.delegate(.저장하기_완료)):
203-
return .send(.inner(.링크팝업_활성화(.success(title: Constants.링크_저장_완료_문구))), animation: .pokitSpring)
203+
return .send(.inner(.링크팝업_활성화(.success(title: Constants.링크_저장_완료_문구, until: 4))), animation: .pokitSpring)
204204
/// - 각 화면에서 링크 복사 감지했을 때 (링크 추가 및 수정 화면 제외)
205205
case let .path(.element(_, action: .알림함(.delegate(.linkCopyDetected(url))))),
206206
let .path(.element(_, action: .검색(.delegate(.linkCopyDetected(url))))),

Projects/DSKit/Sources/Components/PokitCaution.swift

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,14 @@ public struct PokitCaution: View {
8484
private let type: CautionType
8585
private let action: (() -> Void)?
8686

87-
public init(
87+
public init(type: CautionType) {
88+
self.type = type
89+
self.action = nil
90+
}
91+
92+
private init(
8893
type: CautionType,
89-
action: (() -> Void)? = nil
94+
action: (() -> Void)?
9095
) {
9196
self.type = type
9297
self.action = action
@@ -132,11 +137,15 @@ public struct PokitCaution: View {
132137
.frame(maxHeight: .infinity)
133138
.padding(.bottom, 92)
134139
}
140+
141+
public func onAction(_ action: @escaping () -> Void) -> Self {
142+
PokitCaution(type: self.type, action: action)
143+
}
135144
}
136145

137146
#Preview {
138-
PokitCaution(
139-
type: .미분류_링크없음,
140-
action: {}
141-
)
147+
PokitCaution(type: .미분류_링크없음)
148+
.onAction {
149+
150+
}
142151
}

Projects/DSKit/Sources/Components/PokitLinkPopup.swift

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,36 @@ public struct PokitLinkPopup: View {
1515
@State
1616
private var second: Int = 0
1717
private let action: (() -> Void)?
18+
private let until: Int
1819
private let timer = Timer.publish(
1920
every: 1,
2021
on: .main,
2122
in: .common
2223
).autoconnect()
2324

24-
public init(
25+
public init(type: Binding<PokitLinkPopup.PopupType?>) {
26+
self._type = type
27+
switch type.wrappedValue {
28+
case let .link(_, _, until),
29+
let .text(_, until),
30+
let .success(_, until),
31+
let .error(_, until),
32+
let .warning(_, until),
33+
let .report(_, until):
34+
self.until = until
35+
default:
36+
self.until = 2
37+
}
38+
self.action = nil
39+
}
40+
41+
private init(
2542
type: Binding<PokitLinkPopup.PopupType?>,
26-
action: (() -> Void)? = nil
43+
until: Int,
44+
action: (() -> Void)?
2745
) {
2846
self._type = type
47+
self.until = until
2948
self.action = action
3049
}
3150

@@ -40,7 +59,7 @@ public struct PokitLinkPopup: View {
4059
.frame(width: 335, height: 60)
4160
.transition(.move(edge: .bottom).combined(with: .opacity))
4261
.onReceive(timer) { _ in
43-
guard second < 2 else {
62+
guard second < until else {
4463
closedPopup()
4564
return
4665
}
@@ -61,7 +80,7 @@ public struct PokitLinkPopup: View {
6180
.multilineTextAlignment(.leading)
6281
.foregroundStyle(textColor)
6382

64-
if case let .link(_, url) = type {
83+
if case let .link(_, url, _) = type {
6584
Text(url)
6685
.lineLimit(1)
6786
.pokitFont(.detail2)
@@ -167,26 +186,34 @@ public struct PokitLinkPopup: View {
167186

168187
private var title: String {
169188
switch type {
170-
case let .link(title, _),
171-
let .text(title),
172-
let .success(title),
173-
let .error(title),
174-
let .warning(title),
175-
let .report(title):
189+
case let .link(title, _, _),
190+
let .text(title, _),
191+
let .success(title, _),
192+
let .error(title, _),
193+
let .warning(title, _),
194+
let .report(title, _):
176195
return title
177196
default: return ""
178197
}
179198
}
199+
200+
public func onAction(_ action: @escaping () -> Void) -> Self {
201+
PokitLinkPopup(
202+
type: self.$type,
203+
until: self.until,
204+
action: action
205+
)
206+
}
180207
}
181208

182209
public extension PokitLinkPopup {
183210
enum PopupType: Equatable {
184-
case link(title: String, url: String)
185-
case text(title: String)
186-
case success(title: String)
187-
case error(title: String)
188-
case warning(title: String)
189-
case report(title: String)
211+
case link(title: String, url: String, until: Int = 2)
212+
case text(title: String, until: Int = 2)
213+
case success(title: String, until: Int = 2)
214+
case error(title: String, until: Int = 2)
215+
case warning(title: String, until: Int = 2)
216+
case report(title: String, until: Int = 2)
190217
}
191218
}
192219

Projects/Domain/Sources/Base/BaseContentItem.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public struct BaseContentItem: Identifiable, Equatable, PokitLinkCardItem, Sorta
1919
public let data: String
2020
public let domain: String
2121
public let createdAt: String
22-
public let isRead: Bool?
22+
public var isRead: Bool?
2323
public var isFavorite: Bool?
2424
public let keyword: String?
2525

Projects/Feature/FeatureCategoryDetail/Sources/CategoryDetailFeature.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ public struct CategoryDetailFeature {
6565
domain.contentList.hasNext
6666
}
6767
var isLoading: Bool = true
68-
var isContentsNotEmpty: Bool {
69-
(isFavoriteCategory && contents.contains { $0.content.isFavorite == true }) || (!isFavoriteCategory && !contents.isEmpty)
70-
}
7168

7269
public init(category: BaseCategoryItem) {
7370
self.domain = .init(categpry: category)
@@ -199,11 +196,14 @@ private extension CategoryDetailFeature {
199196
)
200197

201198
case let .분류_버튼_눌렀을때(type):
202-
if type == .즐겨찾기 {
199+
switch type {
200+
case .즐겨찾기:
203201
state.domain.condition.isFavoriteFlitered.toggle()
202+
guard state.domain.condition.isFavoriteFlitered else { break }
204203
state.domain.condition.isUnreadFlitered = !state.domain.condition.isFavoriteFlitered
205-
} else {
204+
case .안읽음:
206205
state.domain.condition.isUnreadFlitered.toggle()
206+
guard state.domain.condition.isUnreadFlitered else { break }
207207
state.domain.condition.isFavoriteFlitered = !state.domain.condition.isUnreadFlitered
208208
}
209209
return .concatenate(

Projects/Feature/FeatureCategoryDetail/Sources/CategoryDetailView.swift

Lines changed: 60 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public extension CategoryDetailView {
6565
.padding(.top, 12)
6666
.pokitNavigationBar { navigationBar }
6767
.overlay(
68-
if: store.isContentsNotEmpty,
68+
if: !store.isFavoriteCategory,
6969
alignment: .bottomTrailing
7070
) {
7171
Button(action: { send(.링크_추가_버튼_눌렀을때) }) {
@@ -215,30 +215,32 @@ private extension CategoryDetailView {
215215
var filterHeader: some View {
216216
let isFavoriteCategory = store.isFavoriteCategory
217217
let favoriteContentsCount = store.contents.filter { $0.content.isFavorite ?? false }.count
218-
if store.isContentsNotEmpty {
219-
HStack(spacing: isFavoriteCategory ? 2 : 8) {
220-
if isFavoriteCategory {
221-
Image(.icon(.link))
222-
.resizable()
223-
.frame(width: 16, height: 16)
224-
.foregroundStyle(.pokit(.icon(.secondary)))
225-
Text("\(favoriteContentsCount)")
226-
.foregroundStyle(.pokit(.text(.tertiary)))
227-
.pokitFont(.b2(.m))
228-
} else {
229-
favoriteButton
230-
231-
unreadButton
232-
}
218+
219+
HStack(spacing: isFavoriteCategory ? 2 : 8) {
220+
if isFavoriteCategory {
221+
Image(.icon(.link))
222+
.resizable()
223+
.frame(width: 16, height: 16)
224+
.foregroundStyle(.pokit(.icon(.secondary)))
233225

234-
Spacer()
235-
PokitIconLTextLink(
236-
store.sortType.title,
237-
icon: .icon(.align),
238-
action: { send(.정렬_버튼_눌렀을때) }
239-
)
240-
.contentTransition(.numericText())
226+
Text("\(favoriteContentsCount)")
227+
.foregroundStyle(.pokit(.text(.tertiary)))
228+
.pokitFont(.b2(.m))
229+
230+
} else {
231+
favoriteButton
232+
233+
unreadButton
241234
}
235+
236+
Spacer()
237+
238+
PokitIconLTextLink(
239+
store.sortType.title,
240+
icon: .icon(.align),
241+
action: { send(.정렬_버튼_눌렀을때) }
242+
)
243+
.contentTransition(.numericText())
242244
}
243245
}
244246

@@ -286,53 +288,47 @@ private extension CategoryDetailView {
286288
}
287289
}
288290

291+
@ViewBuilder
289292
var contentScrollView: some View {
290-
Group {
291-
if !store.isLoading {
292-
if store.contents.isEmpty {
293-
PokitCaution(
294-
type: .포킷상세_링크없음,
295-
action: { send(.링크_추가_버튼_눌렀을때) }
296-
)
297-
} else {
298-
LazyVStack(spacing: 0) {
299-
ForEach(
300-
Array(store.scope(state: \.contents, action: \.contents))
301-
) { store in
302-
let isFirst = store.state.id == self.store.contents.first?.id
303-
let isLast = store.state.id == self.store.contents.last?.id
304-
305-
if !self.store.isFavoriteCategory {
306-
ContentCardView(
307-
store: store,
308-
type: .linkList,
309-
isFirst: isFirst,
310-
isLast: isLast
311-
)
312-
} else {
313-
if store.content.isFavorite == true {
314-
ContentCardView(
315-
store: store,
316-
type: .linkList,
317-
isFirst: isFirst,
318-
isLast: isLast
319-
)
320-
}
321-
}
322-
}
293+
if !store.isLoading {
294+
if store.contents.isEmpty {
295+
PokitCaution(type: .포킷상세_링크없음)
296+
} else {
297+
LazyVStack(spacing: 0) {
298+
ForEach(
299+
Array(store.scope(state: \.contents, action: \.contents))
300+
) { store in
301+
let isFirst = store.state.id == self.store.contents.first?.id
302+
let isLast = store.state.id == self.store.contents.last?.id
323303

324-
if store.hasNext {
325-
PokitLoading()
326-
.task { await send(.pagenation).finish() }
304+
if !self.store.isFavoriteCategory {
305+
ContentCardView(
306+
store: store,
307+
type: .linkList,
308+
isFirst: isFirst,
309+
isLast: isLast
310+
)
311+
} else if store.content.isFavorite == true {
312+
ContentCardView(
313+
store: store,
314+
type: .linkList,
315+
isFirst: isFirst,
316+
isLast: isLast
317+
)
327318
}
328-
329-
Spacer()
330319
}
331-
.padding(.bottom, 36)
320+
321+
if store.hasNext {
322+
PokitLoading()
323+
.task { await send(.pagenation).finish() }
324+
}
325+
326+
Spacer()
332327
}
333-
} else {
334-
PokitLoading()
328+
.padding(.bottom, 36)
335329
}
330+
} else {
331+
PokitLoading()
336332
}
337333
}
338334

0 commit comments

Comments
 (0)