Skip to content

Commit

Permalink
[fix] #111 카테고리 상세에서 컨텐츠 공유가 카테고리 공유로 연결되는 문제 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ShapeKim98 committed Sep 8, 2024
1 parent 9fd14d0 commit c344988
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public struct CategoryDetailFeature {
}
var kebobSelectedType: PokitDeleteBottomSheet.SheetType?
var selectedContentItem: BaseContentItem?
var shareSheetItem: BaseContentItem? = nil
/// sheet Presented
var isCategorySheetPresented: Bool = false
var isCategorySelectSheetPresented: Bool = false
Expand Down Expand Up @@ -99,6 +100,7 @@ public struct CategoryDetailFeature {
case dismiss
case onAppear
case pagenation
case 링크_공유_완료(completed: Bool)
}

public enum InnerAction: Equatable {
Expand Down Expand Up @@ -217,6 +219,9 @@ private extension CategoryDetailFeature {
}
case .pagenation:
return .run { send in await send(.async(.pagenation_네트워크)) }
case .링크_공유_완료(completed: let completed):
state.shareSheetItem = nil
return .none
}
}

Expand Down Expand Up @@ -304,13 +309,20 @@ private extension CategoryDetailFeature {
case .categoryBottomSheet(let delegateAction):
switch delegateAction {
case .shareCellButtonTapped:
kakaoShareClient.카테고리_카카오톡_공유(
CategoryKaKaoShareModel(
categoryName: state.domain.category.categoryName,
categoryId: state.domain.category.id,
imageURL: state.domain.category.categoryImage.imageURL
switch state.kebobSelectedType {
case .링크삭제:
state.shareSheetItem = state.selectedContentItem
case .포킷삭제:
kakaoShareClient.카테고리_카카오톡_공유(
CategoryKaKaoShareModel(
categoryName: state.domain.category.categoryName,
categoryId: state.domain.category.id,
imageURL: state.domain.category.categoryImage.imageURL
)
)
)
default: return .none
}

state.isCategorySheetPresented = false
return .none

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ public extension CategoryDetailView {
delegateSend: { store.send(.scope(.categoryBottomSheet($0))) }
)
}
.sheet(item: $store.shareSheetItem) { content in
if let shareURL = URL(string: content.data) {
PokitShareSheet(
items: [shareURL],
completion: { send(.링크_공유_완료(completed: $0)) }
)
.presentationDetents([.medium, .large])
}
}
.sheet(isPresented: $store.isCategorySelectSheetPresented) {
if let categories = store.categories {
PokitCategorySheet(
Expand Down

0 comments on commit c344988

Please sign in to comment.