Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions Projects/App/Sources/MainTab/MainTabFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,7 @@ public struct MainTabFeature {
public var body: some ReducerOf<Self> {
Scope(state: \.pokit, action: \.pokit) { PokitRootFeature() }
Scope(state: \.recommend, action: \.recommend) {
withDependencies {
$0[UserClient.self] = .testValue
$0[ContentClient.self] = .testValue
} operation: {
RecommendFeature()
}
RecommendFeature()
}

BindingReducer()
Expand Down Expand Up @@ -301,7 +296,7 @@ private extension MainTabFeature {
guard let category = state.categoryOfSavedContent else { return .none }
state.categoryOfSavedContent = nil
return .send(.inner(.카테고리상세_이동(category: category)))
case .error, .text, .warning, .none:
case .error, .text, .warning, .report, .none:
return .none
}
}
Expand Down
3 changes: 3 additions & 0 deletions Projects/App/Sources/MainTab/MainTabPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ public extension MainTabFeature {
category: category
)))
return .none

case .recommend(.delegate(.컨텐츠_신고_API_반영)):
return .send(.inner(.링크팝업_활성화(.report(title: "신고가 완료되었습니다"))))

/// - 포킷 `추가` 버튼 눌렀을 때
case .delegate(.포킷추가하기),
Expand Down
16 changes: 16 additions & 0 deletions Projects/CoreKit/Sources/Data/DTO/User/InterestRequest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// InterestRequest.swift
// CoreKit
//
// Created by 김도형 on 3/1/25.
//

import Foundation

public struct InterestRequest: Encodable {
public let interests: [String]

public init(interests: [String]) {
self.interests = interests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ extension ContentClient: DependencyKey {
},
추천_컨텐츠_조회: { pageable, keyword in
try await provider.request(.추천_컨텐츠_조회(pageable: pageable, keyword: keyword))
},
컨텐츠_신고: { id in
try await provider.requestNoBody(.컨텐츠_신고(contentId: id))
}
)
}()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ extension ContentClient: TestDependencyKey {
썸네일_수정: { _, _ in },
미분류_링크_포킷_이동: { _ in },
미분류_링크_삭제: { _ in },
추천_컨텐츠_조회: { _, _ in .mock }
추천_컨텐츠_조회: { _, _ in .mock },
컨텐츠_신고: { _ in }
)
}()
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,8 @@ public struct ContentClient {
_ pageable: BasePageableRequest,
_ keyword: String?
) async throws -> ContentListInquiryResponse
public var 컨텐츠_신고: @Sendable (
_ contentId: Int
) async throws -> Void
}

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public enum ContentEndpoint {
pageable: BasePageableRequest,
keyword: String?
)
case 컨텐츠_신고(contentId: Int)
}

extension ContentEndpoint: TargetType {
Expand Down Expand Up @@ -69,6 +70,8 @@ extension ContentEndpoint: TargetType {
return "/uncategorized"
case .추천_컨텐츠_조회:
return "/recommended"
case let .컨텐츠_신고(contentId):
return "report/\(contentId)"
}
}

Expand All @@ -81,7 +84,8 @@ extension ContentEndpoint: TargetType {

case .컨텐츠_상세_조회,
.즐겨찾기,
.컨텐츠_추가:
.컨텐츠_추가,
.컨텐츠_신고:
return .post

case .컨텐츠_수정,
Expand Down Expand Up @@ -169,6 +173,8 @@ extension ContentEndpoint: TargetType {

case let .미분류_링크_삭제(model):
return .requestJSONEncodable(model)
case .컨텐츠_신고:
return .requestPlain
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ extension UserClient: DependencyKey {
},
유저_관심사_목록_조회: {
try await provider.request(.유저_관심사_목록_조회)
},
관심사_수정: { model in
try await provider.requestNoBody(.관심사_수정(model: model))
}
)
}()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ extension UserClient: TestDependencyKey {
닉네임_조회: { .mock },
fcm_토큰_저장: { _ in .mock },
프로필_이미지_목록_조회: { [.mock] },
유저_관심사_목록_조회: { InterestResponse.mock }
유저_관심사_목록_조회: { InterestResponse.mock },
관심사_수정: { _ in }
)
}()
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ public struct UserClient {
public var fcm_토큰_저장: @Sendable (_ model: FCMRequest) async throws -> FCMResponse
public var 프로필_이미지_목록_조회: @Sendable () async throws -> [BaseProfileImageResponse]
public var 유저_관심사_목록_조회: @Sendable () async throws -> [InterestResponse]
public var 관심사_수정: @Sendable (_ model: InterestRequest) async throws -> Void
}
9 changes: 7 additions & 2 deletions Projects/CoreKit/Sources/Data/Network/User/UserEndpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public enum UserEndpoint {
case fcm_토큰_저장(model: FCMRequest)
case 프로필_이미지_목록_조회
case 유저_관심사_목록_조회
case 관심사_수정(model: InterestRequest)
}

extension UserEndpoint: TargetType {
Expand All @@ -43,14 +44,16 @@ extension UserEndpoint: TargetType {
return "/fcm"
case .프로필_이미지_목록_조회:
return "/profileImage"
case .유저_관심사_목록_조회:
case .유저_관심사_목록_조회, .관심사_수정:
return "/myinterests"
}
}

public var method: Moya.Method {
switch self {
case .프로필_수정, .닉네임_수정:
case .닉네임_수정,
.관심사_수정,
.프로필_수정:
return .put

case .회원등록,
Expand All @@ -76,6 +79,8 @@ extension UserEndpoint: TargetType {
return .requestJSONEncodable(model)
case let .fcm_토큰_저장(model):
return .requestJSONEncodable(model)
case let .관심사_수정(model):
return .requestJSONEncodable(model)
case .닉네임_중복_체크,
.관심사_목록_조회,
.닉네임_조회,
Expand Down
5 changes: 5 additions & 0 deletions Projects/DSKit/Sources/Components/PokitCaution.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public enum CautionType {
case 즐겨찾기_링크없음
case 링크부족
case 알림없음
case 추천_링크없음

var image: PokitImage.Character {
switch self {
Expand Down Expand Up @@ -42,6 +43,8 @@ public enum CautionType {
return "링크가 부족해요!"
case .알림없음:
return "알림이 없어요"
case .추천_링크없음:
return "아직 추천된 링크가 없어요!"
}
}

Expand All @@ -61,6 +64,8 @@ public enum CautionType {
return "링크를 5개 이상 저장하고 추천을 받아보세요"
case .알림없음:
return "리마인드 알림을 설정하세요"
case .추천_링크없음:
return ""
}
}

Expand Down
27 changes: 20 additions & 7 deletions Projects/DSKit/Sources/Components/PokitLinkPopup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,17 @@ public struct PokitLinkPopup: View {

private var closeButton: some View {
Button(action: closedPopup) {
Image(.icon(.x))
.resizable()
.frame(width: 24, height: 24)
.foregroundStyle(iconColor)
Group {
if case .report = type {
Image(.icon(.check))
.resizable()
} else {
Image(.icon(.x))
.resizable()
}
}
.frame(width: 24, height: 24)
.foregroundStyle(iconColor)
}
}

Expand All @@ -109,7 +116,7 @@ public struct PokitLinkPopup: View {
case .link, .text, .warning:
UINotificationFeedbackGenerator()
.notificationOccurred(.warning)
case .success:
case .success, .report:
UINotificationFeedbackGenerator()
.notificationOccurred(.success)
case .error:
Expand All @@ -125,7 +132,7 @@ public struct PokitLinkPopup: View {
return .pokit(.bg(.tertiary))
case .success:
return .pokit(.bg(.success))
case .error:
case .error, .report:
return .pokit(.bg(.error))
case .warning:
return .pokit(.bg(.warning))
Expand Down Expand Up @@ -164,7 +171,8 @@ public struct PokitLinkPopup: View {
let .text(title),
let .success(title),
let .error(title),
let .warning(title):
let .warning(title),
let .report(title):
return title
default: return ""
}
Expand All @@ -178,6 +186,7 @@ public extension PokitLinkPopup {
case success(title: String)
case error(title: String)
case warning(title: String)
case report(title: String)
}
}

Expand Down Expand Up @@ -205,5 +214,9 @@ public extension PokitLinkPopup {
PokitLinkPopup(
type: .constant(.warning(title: "저장공간 부족"))
)

PokitLinkPopup(
type: .constant(.report(title: "신고가 완료되었습니다"))
)
}
}
34 changes: 31 additions & 3 deletions Projects/Domain/Sources/Base/BaseInterest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,41 @@

import Foundation

public struct BaseInterest: Equatable, Identifiable {
public struct BaseInterest: Equatable, Identifiable, Hashable {
public let id = UUID()
public let code: String
public let code: Code
public let description: String

public init(code: String, description: String) {
public func hash(into hasher: inout Hasher) {
hasher.combine(code)
}

public static func ==(lhs: BaseInterest, rhs: BaseInterest) -> Bool {
lhs.code == rhs.code
}

public init(code: Code, description: String) {
self.code = code
self.description = description
}
}

extension BaseInterest {
public enum Code: String {
case `default` = "DEFAULT"
case 스포츠_레저 = "SPORTS"
case 문구_오피스 = "OFFICE"
case 패션 = "FASHION"
case 여행 = "TRAVEL"
case 경제_시사 = "ECONOMY"
case 영화_드라마 = "MOVIE_DRAMA"
case 맛집 = "RESTAURANT"
case 인테리어 = "INTERIOR"
case IT = "IT"
case 디자인 = "DESIGN"
case 자기계발 = "SELF_IMPROVEMENT"
case 유머 = "HUMOR"
case 음악 = "MUSIC"
case 취업정보 = "JOB_INFO"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import CoreKit
public extension InterestResponse {
func toDomian() -> BaseInterest {
return BaseInterest(
code: self.code,
code: BaseInterest.Code(rawValue: self.code) ?? .default,
description: self.description
)
}
Expand Down
2 changes: 2 additions & 0 deletions Projects/Domain/Sources/Recommend/Recommend.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public struct Recommend: Equatable {
/// 콘텐츠 목록
public var contentList: BaseContentListInquiry
public var pageable: BasePageable
public var myInterests: [BaseInterest]
public var interests: [BaseInterest]

public init() {
Expand All @@ -25,6 +26,7 @@ public struct Recommend: Equatable {
page: 0, size: 10,
sort: ["createdAt,desc"]
)
self.myInterests = []
self.interests = []
}
}
Loading