Skip to content

Commit

Permalink
Merge pull request #166 from YAPP-Github/feat/#157-feature-update
Browse files Browse the repository at this point in the history
feat: 1.0.6 ๋ฒ„์ „ ์—…๋ฐ์ดํŠธ์— ๋”ฐ๋ฅธ ๊ธฐ๋Šฅ ์ถ”๊ฐ€ ๋ฐ ์ˆ˜์ •
  • Loading branch information
ShapeKim98 authored Dec 4, 2024
2 parents 28d4bca + 5f42240 commit bfe5652
Show file tree
Hide file tree
Showing 48 changed files with 958 additions and 1,098 deletions.
40 changes: 34 additions & 6 deletions Projects/App/Sources/MainTab/MainTabFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import FeaturePokit
import FeatureRemind
import FeatureContentDetail
import Domain
import DSKit
import Util
import CoreKit

Expand All @@ -28,7 +29,7 @@ public struct MainTabFeature {
public struct State: Equatable {
var selectedTab: MainTab = .pokit
var isBottomSheetPresented: Bool = false
var isLinkSheetPresented: Bool = false
var linkPopup: PokitLinkPopup.PopupType?
var isErrorSheetPresented: Bool = false
var link: String?

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

public init() {
self.pokit = .init()
Expand All @@ -64,7 +66,7 @@ public struct MainTabFeature {
public enum View: Equatable {
case addButtonTapped
case addSheetTypeSelected(TabAddSheetType)
case linkCopyButtonTapped
case ๋งํฌํŒ์—…_๋ฒ„ํŠผ_๋ˆŒ๋ €์„๋•Œ
case onAppear
case onOpenURL(url: URL)
case ๊ฒฝ๊ณ _ํ™•์ธ๋ฒ„ํŠผ_ํด๋ฆญ
Expand All @@ -75,6 +77,7 @@ public struct MainTabFeature {
case ๊ณต์œ ํฌํ‚ท_์ด๋™(sharedCategory: CategorySharing.SharedCategory)
case ๊ฒฝ๊ณ _๋„์›€(BaseError)
case errorSheetPresented(Bool)
case ๋งํฌํŒ์—…_ํ™œ์„ฑํ™”(PokitLinkPopup.PopupType)
}
public enum AsyncAction: Equatable {
case ๊ณต์œ ๋ฐ›์€_์นดํ…Œ๊ณ ๋ฆฌ_์กฐํšŒ(categoryId: Int)
Expand All @@ -93,6 +96,10 @@ public struct MainTabFeature {
/// - Reducer Core
private func core(into state: inout State, action: Action) -> Effect<Action> {
switch action {
case .binding(\.linkPopup):
guard state.linkPopup == nil else { return .none }
state.savedContentId = nil
return .none
case .binding:
return .none
case let .pushAlertTapped(isTapped):
Expand Down Expand Up @@ -156,9 +163,8 @@ private extension MainTabFeature {
case .ํฌํ‚ท์ถ”๊ฐ€: return .send(.delegate(.ํฌํ‚ท์ถ”๊ฐ€ํ•˜๊ธฐ))
}

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

case .onAppear:
if state.isPushTapped {
Expand Down Expand Up @@ -198,7 +204,10 @@ private extension MainTabFeature {
switch action {
case let .linkCopySuccess(url):
guard let url else { return .none }
state.isLinkSheetPresented = true
state.linkPopup = .link(
title: Constants.๋ณต์‚ฌํ•œ_๋งํฌ_์ €์žฅํ•˜๊ธฐ_๋ฌธ๊ตฌ,
url: url.absoluteString
)
state.link = url.absoluteString
return .none

Expand All @@ -209,6 +218,10 @@ private extension MainTabFeature {
case let .errorSheetPresented(isPresented):
state.isErrorSheetPresented = isPresented
return .none

case let .๋งํฌํŒ์—…_ํ™œ์„ฑํ™”(type):
state.linkPopup = type
return .none

default: return .none
}
Expand Down Expand Up @@ -238,4 +251,19 @@ private extension MainTabFeature {
func handleDelegateAction(_ action: Action.DelegateAction, state: inout State) -> Effect<Action> {
return .none
}

func linkPopupButtonTapped(state: inout State) -> Effect<Action> {
switch state.linkPopup {
case .link:
state.linkPopup = nil
return .send(.delegate(.๋งํฌ์ถ”๊ฐ€ํ•˜๊ธฐ))
case .success:
state.linkPopup = nil
state.contentDetail = .init(contentId: state.savedContentId)
state.savedContentId = nil
return .none
case .error, .text, .warning, .none:
return .none
}
}
}
19 changes: 8 additions & 11 deletions Projects/App/Sources/MainTab/MainTabFeatureView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,10 @@ public extension MainTabView {
}
}

if self.store.isLinkSheetPresented {
if self.store.linkPopup != nil {
PokitLinkPopup(
"๋ณต์‚ฌํ•œ ๋งํฌ ์ €์žฅํ•˜๊ธฐ",
isPresented: $store.isLinkSheetPresented,
type: .link(url: self.store.link ?? ""),
action: { send(.linkCopyButtonTapped) }
type: $store.linkPopup,
action: { send(.๋งํฌํŒ์—…_๋ฒ„ํŠผ_๋ˆŒ๋ €์„๋•Œ, animation: .pokitSpring) }
)
}
}
Expand All @@ -94,12 +92,10 @@ private extension MainTabView {
tabView
.overlay(alignment: .bottom) {
VStack(spacing: 0) {
if store.isLinkSheetPresented {
if store.linkPopup != nil {
PokitLinkPopup(
"๋ณต์‚ฌํ•œ ๋งํฌ ์ €์žฅํ•˜๊ธฐ",
isPresented: $store.isLinkSheetPresented,
type: .link(url: store.link ?? ""),
action: { send(.linkCopyButtonTapped) }
type: $store.linkPopup,
action: { send(.๋งํฌํŒ์—…_๋ฒ„ํŠผ_๋ˆŒ๋ €์„๋•Œ, animation: .pokitSpring) }
)
.padding(.bottom, 20)
}
Expand Down Expand Up @@ -265,7 +261,8 @@ private extension MainTabView {
}
.padding(.horizontal, 28)
.onTapGesture {
UIImpactFeedbackGenerator(style: .rigid).impactOccurred()
UIImpactFeedbackGenerator(style: .light)
.impactOccurred()
store.send(.binding(.set(\.selectedTab, tab)))
}
}
Expand Down
11 changes: 8 additions & 3 deletions Projects/App/Sources/MainTab/MainTabPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import FeatureContentSetting
import FeatureContentList
import FeatureCategorySharing
import Domain
import Util

@Reducer
public struct MainTabPath {
Expand Down Expand Up @@ -173,13 +174,17 @@ public extension MainTabFeature {
return .none

/// - ๋งํฌ์ถ”๊ฐ€ ๋ฐ ์ˆ˜์ •์—์„œ ์ €์žฅํ•˜๊ธฐ ๋ˆŒ๋ €์„ ๋•Œ
case let .path(.element(stackElementId, action: .๋งํฌ์ถ”๊ฐ€๋ฐ์ˆ˜์ •(.delegate(.์ €์žฅํ•˜๊ธฐ_์™„๋ฃŒ)))):
case let .path(.element(stackElementId, action: .๋งํฌ์ถ”๊ฐ€๋ฐ์ˆ˜์ •(.delegate(.์ €์žฅํ•˜๊ธฐ_์™„๋ฃŒ(contentId))))):
state.savedContentId = contentId
state.path.removeLast()
switch state.path.last {
case .๊ฒ€์ƒ‰:
return .send(.path(.element(id: stackElementId, action: .๊ฒ€์ƒ‰(.delegate(.์ปจํ…์ธ _๊ฒ€์ƒ‰)))))
return .merge(
.send(.path(.element(id: stackElementId, action: .๊ฒ€์ƒ‰(.delegate(.์ปจํ…์ธ _๊ฒ€์ƒ‰))))),
.send(.inner(.๋งํฌํŒ์—…_ํ™œ์„ฑํ™”(.success(title: Constants.๋งํฌ_์ €์žฅ_์™„๋ฃŒ_๋ฌธ๊ตฌ))), animation: .pokitSpring)
)
default:
return .none
return .send(.inner(.๋งํฌํŒ์—…_ํ™œ์„ฑํ™”(.success(title: Constants.๋งํฌ_์ €์žฅ_์™„๋ฃŒ_๋ฌธ๊ตฌ))), animation: .pokitSpring)
}
/// - ๊ฐ ํ™”๋ฉด์—์„œ ๋งํฌ ๋ณต์‚ฌ ๊ฐ์ง€ํ–ˆ์„ ๋•Œ (๋งํฌ ์ถ”๊ฐ€ ๋ฐ ์ˆ˜์ • ํ™”๋ฉด ์ œ์™ธ)
case let .path(.element(_, action: .์•Œ๋ฆผํ•จ(.delegate(.linkCopyDetected(url))))),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extension CategoryImageResponse {
public static var mock: [Self] = [
Self(
imageId: 2312,
imageUrl: "https://pokit-storage.s3.ap-northeast-2.amazonaws.com/logo/pokit.png"
imageUrl: Constants.๊ธฐ๋ณธ_์ธ๋„ค์ผ_์ฃผ์†Œ.absoluteString
),
Self(
imageId: 23122,
Expand Down
16 changes: 16 additions & 0 deletions Projects/CoreKit/Sources/Data/DTO/Content/ThumbnailRequest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// ThumbnailRequest.swift
// CoreKit
//
// Created by ๊น€๋„ํ˜• on 12/1/24.
//

import Foundation

public struct ThumbnailRequest: Encodable {
private let thumbnail: String

public init(thumbnail: String) {
self.thumbnail = thumbnail
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ extension ContentClient: DependencyKey {
condition: condition
)
)
},
์ธ๋„ค์ผ_์ˆ˜์ •: { id, model in
try await provider.requestNoBody(
.์ธ๋„ค์ผ_์ˆ˜์ •(contentId: id, model: model)
)
}
)
}()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ extension ContentClient: TestDependencyKey {
์ฆ๊ฒจ์ฐพ๊ธฐ_์ทจ์†Œ: { _ in },
์นดํ…Œ๊ณ ๋ฆฌ_๋‚ด_์ปจํ…์ธ _๋ชฉ๋ก_์กฐํšŒ: { _, _, _ in .mock },
๋ฏธ๋ถ„๋ฅ˜_์นดํ…Œ๊ณ ๋ฆฌ_์ปจํ…์ธ _์กฐํšŒ: { _ in .mock },
์ปจํ…์ธ _๊ฒ€์ƒ‰: { _, _ in .mock }
์ปจํ…์ธ _๊ฒ€์ƒ‰: { _, _ in .mock },
์ธ๋„ค์ผ_์ˆ˜์ •: { _, _ in }
)
}()
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,9 @@ public struct ContentClient {
_ pageable: BasePageableRequest,
_ condition: BaseConditionRequest
) async throws -> ContentListInquiryResponse
public var ์ธ๋„ค์ผ_์ˆ˜์ •: @Sendable (
_ contentId: String,
_ model: ThumbnailRequest
) async throws -> Void
}

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public enum ContentEndpoint {
pageable: BasePageableRequest,
condition: BaseConditionRequest
)
case ์ธ๋„ค์ผ_์ˆ˜์ •(contentId: String, model: ThumbnailRequest)
}

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

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

case .์ปจํ…์ธ _์ˆ˜์ •:
case .์ปจํ…์ธ _์ˆ˜์ •,
.์ธ๋„ค์ผ_์ˆ˜์ •:
return .patch

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

Expand Down
108 changes: 0 additions & 108 deletions Projects/DSKit/Sources/Components/PokitIconLInput.swift

This file was deleted.

Loading

0 comments on commit bfe5652

Please sign in to comment.