Skip to content

Commit bfe5652

Browse files
authored
Merge pull request #166 from YAPP-Github/feat/#157-feature-update
feat: 1.0.6 ๋ฒ„์ „ ์—…๋ฐ์ดํŠธ์— ๋”ฐ๋ฅธ ๊ธฐ๋Šฅ ์ถ”๊ฐ€ ๋ฐ ์ˆ˜์ •
2 parents 28d4bca + 5f42240 commit bfe5652

File tree

48 files changed

+958
-1098
lines changed

Some content is hidden

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

48 files changed

+958
-1098
lines changed

โ€ŽProjects/App/Sources/MainTab/MainTabFeature.swiftโ€Ž

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import FeaturePokit
1111
import FeatureRemind
1212
import FeatureContentDetail
1313
import Domain
14+
import DSKit
1415
import Util
1516
import CoreKit
1617

@@ -28,7 +29,7 @@ public struct MainTabFeature {
2829
public struct State: Equatable {
2930
var selectedTab: MainTab = .pokit
3031
var isBottomSheetPresented: Bool = false
31-
var isLinkSheetPresented: Bool = false
32+
var linkPopup: PokitLinkPopup.PopupType?
3233
var isErrorSheetPresented: Bool = false
3334
var link: String?
3435

@@ -40,6 +41,7 @@ public struct MainTabFeature {
4041
@Presents var contentDetail: ContentDetailFeature.State?
4142
@Shared(.inMemory("SelectCategory")) var categoryId: Int?
4243
@Shared(.inMemory("PushTapped")) var isPushTapped: Bool = false
44+
var savedContentId: Int?
4345

4446
public init() {
4547
self.pokit = .init()
@@ -64,7 +66,7 @@ public struct MainTabFeature {
6466
public enum View: Equatable {
6567
case addButtonTapped
6668
case addSheetTypeSelected(TabAddSheetType)
67-
case linkCopyButtonTapped
69+
case ๋งํฌํŒ์—…_๋ฒ„ํŠผ_๋ˆŒ๋ €์„๋•Œ
6870
case onAppear
6971
case onOpenURL(url: URL)
7072
case ๊ฒฝ๊ณ _ํ™•์ธ๋ฒ„ํŠผ_ํด๋ฆญ
@@ -75,6 +77,7 @@ public struct MainTabFeature {
7577
case ๊ณต์œ ํฌํ‚ท_์ด๋™(sharedCategory: CategorySharing.SharedCategory)
7678
case ๊ฒฝ๊ณ _๋„์›€(BaseError)
7779
case errorSheetPresented(Bool)
80+
case ๋งํฌํŒ์—…_ํ™œ์„ฑํ™”(PokitLinkPopup.PopupType)
7881
}
7982
public enum AsyncAction: Equatable {
8083
case ๊ณต์œ ๋ฐ›์€_์นดํ…Œ๊ณ ๋ฆฌ_์กฐํšŒ(categoryId: Int)
@@ -93,6 +96,10 @@ public struct MainTabFeature {
9396
/// - Reducer Core
9497
private func core(into state: inout State, action: Action) -> Effect<Action> {
9598
switch action {
99+
case .binding(\.linkPopup):
100+
guard state.linkPopup == nil else { return .none }
101+
state.savedContentId = nil
102+
return .none
96103
case .binding:
97104
return .none
98105
case let .pushAlertTapped(isTapped):
@@ -156,9 +163,8 @@ private extension MainTabFeature {
156163
case .ํฌํ‚ท์ถ”๊ฐ€: return .send(.delegate(.ํฌํ‚ท์ถ”๊ฐ€ํ•˜๊ธฐ))
157164
}
158165

159-
case .linkCopyButtonTapped:
160-
state.isLinkSheetPresented = false
161-
return .run { send in await send(.delegate(.๋งํฌ์ถ”๊ฐ€ํ•˜๊ธฐ)) }
166+
case .๋งํฌํŒ์—…_๋ฒ„ํŠผ_๋ˆŒ๋ €์„๋•Œ:
167+
return linkPopupButtonTapped(state: &state)
162168

163169
case .onAppear:
164170
if state.isPushTapped {
@@ -198,7 +204,10 @@ private extension MainTabFeature {
198204
switch action {
199205
case let .linkCopySuccess(url):
200206
guard let url else { return .none }
201-
state.isLinkSheetPresented = true
207+
state.linkPopup = .link(
208+
title: Constants.๋ณต์‚ฌํ•œ_๋งํฌ_์ €์žฅํ•˜๊ธฐ_๋ฌธ๊ตฌ,
209+
url: url.absoluteString
210+
)
202211
state.link = url.absoluteString
203212
return .none
204213

@@ -209,6 +218,10 @@ private extension MainTabFeature {
209218
case let .errorSheetPresented(isPresented):
210219
state.isErrorSheetPresented = isPresented
211220
return .none
221+
222+
case let .๋งํฌํŒ์—…_ํ™œ์„ฑํ™”(type):
223+
state.linkPopup = type
224+
return .none
212225

213226
default: return .none
214227
}
@@ -238,4 +251,19 @@ private extension MainTabFeature {
238251
func handleDelegateAction(_ action: Action.DelegateAction, state: inout State) -> Effect<Action> {
239252
return .none
240253
}
254+
255+
func linkPopupButtonTapped(state: inout State) -> Effect<Action> {
256+
switch state.linkPopup {
257+
case .link:
258+
state.linkPopup = nil
259+
return .send(.delegate(.๋งํฌ์ถ”๊ฐ€ํ•˜๊ธฐ))
260+
case .success:
261+
state.linkPopup = nil
262+
state.contentDetail = .init(contentId: state.savedContentId)
263+
state.savedContentId = nil
264+
return .none
265+
case .error, .text, .warning, .none:
266+
return .none
267+
}
268+
}
241269
}

โ€ŽProjects/App/Sources/MainTab/MainTabFeatureView.swiftโ€Ž

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,10 @@ public extension MainTabView {
7373
}
7474
}
7575

76-
if self.store.isLinkSheetPresented {
76+
if self.store.linkPopup != nil {
7777
PokitLinkPopup(
78-
"๋ณต์‚ฌํ•œ ๋งํฌ ์ €์žฅํ•˜๊ธฐ",
79-
isPresented: $store.isLinkSheetPresented,
80-
type: .link(url: self.store.link ?? ""),
81-
action: { send(.linkCopyButtonTapped) }
78+
type: $store.linkPopup,
79+
action: { send(.๋งํฌํŒ์—…_๋ฒ„ํŠผ_๋ˆŒ๋ €์„๋•Œ, animation: .pokitSpring) }
8280
)
8381
}
8482
}
@@ -94,12 +92,10 @@ private extension MainTabView {
9492
tabView
9593
.overlay(alignment: .bottom) {
9694
VStack(spacing: 0) {
97-
if store.isLinkSheetPresented {
95+
if store.linkPopup != nil {
9896
PokitLinkPopup(
99-
"๋ณต์‚ฌํ•œ ๋งํฌ ์ €์žฅํ•˜๊ธฐ",
100-
isPresented: $store.isLinkSheetPresented,
101-
type: .link(url: store.link ?? ""),
102-
action: { send(.linkCopyButtonTapped) }
97+
type: $store.linkPopup,
98+
action: { send(.๋งํฌํŒ์—…_๋ฒ„ํŠผ_๋ˆŒ๋ €์„๋•Œ, animation: .pokitSpring) }
10399
)
104100
.padding(.bottom, 20)
105101
}
@@ -265,7 +261,8 @@ private extension MainTabView {
265261
}
266262
.padding(.horizontal, 28)
267263
.onTapGesture {
268-
UIImpactFeedbackGenerator(style: .rigid).impactOccurred()
264+
UIImpactFeedbackGenerator(style: .light)
265+
.impactOccurred()
269266
store.send(.binding(.set(\.selectedTab, tab)))
270267
}
271268
}

โ€ŽProjects/App/Sources/MainTab/MainTabPath.swiftโ€Ž

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import FeatureContentSetting
1616
import FeatureContentList
1717
import FeatureCategorySharing
1818
import Domain
19+
import Util
1920

2021
@Reducer
2122
public struct MainTabPath {
@@ -173,13 +174,17 @@ public extension MainTabFeature {
173174
return .none
174175

175176
/// - ๋งํฌ์ถ”๊ฐ€ ๋ฐ ์ˆ˜์ •์—์„œ ์ €์žฅํ•˜๊ธฐ ๋ˆŒ๋ €์„ ๋•Œ
176-
case let .path(.element(stackElementId, action: .๋งํฌ์ถ”๊ฐ€๋ฐ์ˆ˜์ •(.delegate(.์ €์žฅํ•˜๊ธฐ_์™„๋ฃŒ)))):
177+
case let .path(.element(stackElementId, action: .๋งํฌ์ถ”๊ฐ€๋ฐ์ˆ˜์ •(.delegate(.์ €์žฅํ•˜๊ธฐ_์™„๋ฃŒ(contentId))))):
178+
state.savedContentId = contentId
177179
state.path.removeLast()
178180
switch state.path.last {
179181
case .๊ฒ€์ƒ‰:
180-
return .send(.path(.element(id: stackElementId, action: .๊ฒ€์ƒ‰(.delegate(.์ปจํ…์ธ _๊ฒ€์ƒ‰)))))
182+
return .merge(
183+
.send(.path(.element(id: stackElementId, action: .๊ฒ€์ƒ‰(.delegate(.์ปจํ…์ธ _๊ฒ€์ƒ‰))))),
184+
.send(.inner(.๋งํฌํŒ์—…_ํ™œ์„ฑํ™”(.success(title: Constants.๋งํฌ_์ €์žฅ_์™„๋ฃŒ_๋ฌธ๊ตฌ))), animation: .pokitSpring)
185+
)
181186
default:
182-
return .none
187+
return .send(.inner(.๋งํฌํŒ์—…_ํ™œ์„ฑํ™”(.success(title: Constants.๋งํฌ_์ €์žฅ_์™„๋ฃŒ_๋ฌธ๊ตฌ))), animation: .pokitSpring)
183188
}
184189
/// - ๊ฐ ํ™”๋ฉด์—์„œ ๋งํฌ ๋ณต์‚ฌ ๊ฐ์ง€ํ–ˆ์„ ๋•Œ (๋งํฌ ์ถ”๊ฐ€ ๋ฐ ์ˆ˜์ • ํ™”๋ฉด ์ œ์™ธ)
185190
case let .path(.element(_, action: .์•Œ๋ฆผํ•จ(.delegate(.linkCopyDetected(url))))),

โ€ŽProjects/CoreKit/Sources/Data/DTO/Category/CategoryEditResponse.swiftโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extension CategoryImageResponse {
3535
public static var mock: [Self] = [
3636
Self(
3737
imageId: 2312,
38-
imageUrl: "https://pokit-storage.s3.ap-northeast-2.amazonaws.com/logo/pokit.png"
38+
imageUrl: Constants.๊ธฐ๋ณธ_์ธ๋„ค์ผ_์ฃผ์†Œ.absoluteString
3939
),
4040
Self(
4141
imageId: 23122,
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// ThumbnailRequest.swift
3+
// CoreKit
4+
//
5+
// Created by ๊น€๋„ํ˜• on 12/1/24.
6+
//
7+
8+
import Foundation
9+
10+
public struct ThumbnailRequest: Encodable {
11+
private let thumbnail: String
12+
13+
public init(thumbnail: String) {
14+
self.thumbnail = thumbnail
15+
}
16+
}

โ€ŽProjects/CoreKit/Sources/Data/Network/Content/ContentClient+LiveKey.swiftโ€Ž

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ extension ContentClient: DependencyKey {
5050
condition: condition
5151
)
5252
)
53+
},
54+
์ธ๋„ค์ผ_์ˆ˜์ •: { id, model in
55+
try await provider.requestNoBody(
56+
.์ธ๋„ค์ผ_์ˆ˜์ •(contentId: id, model: model)
57+
)
5358
}
5459
)
5560
}()

โ€ŽProjects/CoreKit/Sources/Data/Network/Content/ContentClient+TestKey.swiftโ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ extension ContentClient: TestDependencyKey {
1717
์ฆ๊ฒจ์ฐพ๊ธฐ_์ทจ์†Œ: { _ in },
1818
์นดํ…Œ๊ณ ๋ฆฌ_๋‚ด_์ปจํ…์ธ _๋ชฉ๋ก_์กฐํšŒ: { _, _, _ in .mock },
1919
๋ฏธ๋ถ„๋ฅ˜_์นดํ…Œ๊ณ ๋ฆฌ_์ปจํ…์ธ _์กฐํšŒ: { _ in .mock },
20-
์ปจํ…์ธ _๊ฒ€์ƒ‰: { _, _ in .mock }
20+
์ปจํ…์ธ _๊ฒ€์ƒ‰: { _, _ in .mock },
21+
์ธ๋„ค์ผ_์ˆ˜์ •: { _, _ in }
2122
)
2223
}()
2324
}

โ€ŽProjects/CoreKit/Sources/Data/Network/Content/ContentClient.swiftโ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,9 @@ public struct ContentClient {
4040
_ pageable: BasePageableRequest,
4141
_ condition: BaseConditionRequest
4242
) async throws -> ContentListInquiryResponse
43+
public var ์ธ๋„ค์ผ_์ˆ˜์ •: @Sendable (
44+
_ contentId: String,
45+
_ model: ThumbnailRequest
46+
) async throws -> Void
4347
}
4448

โ€ŽProjects/CoreKit/Sources/Data/Network/Content/ContentEndpoint.swiftโ€Ž

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public enum ContentEndpoint {
2727
pageable: BasePageableRequest,
2828
condition: BaseConditionRequest
2929
)
30+
case ์ธ๋„ค์ผ_์ˆ˜์ •(contentId: String, model: ThumbnailRequest)
3031
}
3132

3233
extension ContentEndpoint: TargetType {
@@ -54,6 +55,8 @@ extension ContentEndpoint: TargetType {
5455
return "/uncategorized"
5556
case .์ปจํ…์ธ _๊ฒ€์ƒ‰:
5657
return ""
58+
case let .์ธ๋„ค์ผ_์ˆ˜์ •(contentId, _):
59+
return "/thumbnail/\(contentId)"
5760
}
5861
}
5962

@@ -68,7 +71,8 @@ extension ContentEndpoint: TargetType {
6871
.์ปจํ…์ธ _์ถ”๊ฐ€:
6972
return .post
7073

71-
case .์ปจํ…์ธ _์ˆ˜์ •:
74+
case .์ปจํ…์ธ _์ˆ˜์ •,
75+
.์ธ๋„ค์ผ_์ˆ˜์ •:
7276
return .patch
7377

7478
case .์นดํƒœ๊ณ ๋ฆฌ_๋‚ด_์ปจํ…์ธ _๋ชฉ๋ก_์กฐํšŒ,
@@ -129,6 +133,8 @@ extension ContentEndpoint: TargetType {
129133
],
130134
encoding: URLEncoding.default
131135
)
136+
case let .์ธ๋„ค์ผ_์ˆ˜์ •(_, model):
137+
return .requestJSONEncodable(model)
132138
}
133139
}
134140

โ€ŽProjects/DSKit/Sources/Components/PokitIconLInput.swiftโ€Ž

Lines changed: 0 additions & 108 deletions
This file was deleted.

0 commit comments

Comments
ย (0)