diff --git a/Projects/Core/DesignSystem/Sources/PlainNavigationBar.swift b/Projects/Core/DesignSystem/Sources/PlainNavigationBar.swift index a87aead..2d92693 100644 --- a/Projects/Core/DesignSystem/Sources/PlainNavigationBar.swift +++ b/Projects/Core/DesignSystem/Sources/PlainNavigationBar.swift @@ -42,7 +42,7 @@ public struct PlainNavigationBar: View { Spacer() if hasConfigureButton { - ResourceKitAsset.Icon.setting.swiftUIImage + ResourceKitAsset.Icon.moreItem.swiftUIImage } } .padding(.horizontal, 16) @@ -84,9 +84,11 @@ public struct PlainNavigationBarModifier: ViewModifier { HStack { Spacer() if hasConfigureButton { - ResourceKitAsset.Icon.setting.swiftUIImage - .resizable() - .frame(width: 20, height: 20) + Button(action: { self.rightActionHandler?() }) { + ResourceKitAsset.Icon.moreItem.swiftUIImage + .resizable() + .frame(width: 20, height: 20) + } } } } diff --git a/Projects/Features/MemeDetail/Sources/MemeDetailView.swift b/Projects/Features/MemeDetail/Sources/MemeDetailView.swift index 746416e..1f19ba0 100644 --- a/Projects/Features/MemeDetail/Sources/MemeDetailView.swift +++ b/Projects/Features/MemeDetail/Sources/MemeDetailView.swift @@ -41,6 +41,44 @@ public struct MemeDetailView: View { // MARK: - UI public var body: some View { + ZStack { + memeDetailCardView + if viewModel.state.isSheetPresented { + Color.black.opacity(0.4) + } + } + .onAppear { + viewModel.logMemeDetail(interaction: .view, event: .meme) + } + .plainNavigationBar( + backHandler: { viewModel.dispatch(type: .naviBackButtonTapped) }, + rightActionHandler: { viewModel.dispatch(type: .naviMoreButtonTapped) }, + hasConfigureButton: true, + title: viewModel.state.meme.title + ) + .popup( + isActive: $viewModel.state.isCopied, + image: ResourceKitAsset.Icon.copyFilled.swiftUIImage, + text: "이미지를 클립보드에 복사했어요" + ) + .popup( + isActive: $viewModel.state.isFarmemeChanged, + image: viewModel.state.meme.isFarmemed ? ResourceKitAsset.Icon.copyFilled.swiftUIImage : nil, + text: viewModel.state.meme.isFarmemed ? "파밈 완료!" : "파밈을 취소했어요" + ) + .sheet(isPresented: $viewModel.state.isSheetPresented) { + ZStack(alignment: .bottom) { + bottomSheetView + .presentationDetents([.height(66)]) + } + } + .sheet(isPresented: $viewModel.state.isWebViewPresented) { + WebView(url: viewModel.state.reportProblemUrl) + .presentationDetents([.large]) + } + } + + private var memeDetailCardView: some View { ZStack { VStack(spacing: 0) { Spacer() @@ -74,7 +112,6 @@ public struct MemeDetailView: View { VStack(spacing: 0) { Spacer() - EmptyView() .memeDetailTabBar( isFarmemed: $viewModel.state.meme.isFarmemed @@ -107,25 +144,27 @@ public struct MemeDetailView: View { .clipped() .edgesIgnoringSafeArea(.top) ) - .onAppear { - viewModel.logMemeDetail(interaction: .view, event: .meme) + } + + private var bottomSheetView: some View { + VStack { + Rectangle() + .cornerRadius(20, corners: [.topLeft, .topRight]) + .frame(height: 16) + .foregroundStyle(Color.Background.white) + reportProblembutton + } + .padding(.bottom, 10) + .onTapGesture { + viewModel.dispatch(type: .reportProblemButtonTapped) } - .plainNavigationBar( - backHandler: { viewModel.dispatch(type: .naviBackButtonTapped) }, - rightActionHandler: nil, - hasConfigureButton: false, - title: "밈 자세히 보기" - ) - .popup( - isActive: $viewModel.state.isCopied, - image: ResourceKitAsset.Icon.copyFilled.swiftUIImage, - text: "이미지를 클립보드에 복사했어요" - ) - .popup( - isActive: $viewModel.state.isFarmemeChanged, - image: viewModel.state.meme.isFarmemed ? ResourceKitAsset.Icon.copyFilled.swiftUIImage : nil, - text: viewModel.state.meme.isFarmemed ? "파밈 완료!" : "파밈을 취소했어요" - ) + } + + private var reportProblembutton: some View { + Text("신고하기") + .font(Font.Body.Xlarge.medium) + .foregroundStyle(Color.Text.primary) + .padding(.vertical, 16) } @MainActor @@ -139,6 +178,7 @@ public struct MemeDetailView: View { viewModel.dispatch(type: .shreButtonTapped) } } + } #Preview { diff --git a/Projects/Features/MemeDetail/Sources/MemeDetailViewModel.swift b/Projects/Features/MemeDetail/Sources/MemeDetailViewModel.swift index 8397504..b9bc931 100644 --- a/Projects/Features/MemeDetail/Sources/MemeDetailViewModel.swift +++ b/Projects/Features/MemeDetail/Sources/MemeDetailViewModel.swift @@ -29,12 +29,18 @@ public final class MemeDetailViewModel: ViewModelType, ObservableObject { case shreButtonTapped case farmemeButtonTapped case naviBackButtonTapped + case naviMoreButtonTapped + case reportProblemButtonTapped } public struct State { var meme: MemeDetail var isCopied: Bool = false var isFarmemeChanged: Bool = false + var isSheetPresented: Bool = false + var isWebViewPresented: Bool = false + + let reportProblemUrl: URL? = URL(string: "https://forms.gle/a5QkMnLD8AANtYCo7") } // MARK: - Properties @@ -49,6 +55,8 @@ public final class MemeDetailViewModel: ViewModelType, ObservableObject { private var reactionCount = 0 private var reactionTask: Task? + + // MARK: - Initializers @@ -94,6 +102,12 @@ public final class MemeDetailViewModel: ViewModelType, ObservableObject { } case .naviBackButtonTapped: router?.popView() + case .naviMoreButtonTapped: + state.isSheetPresented = true + case .reportProblemButtonTapped: + state.isSheetPresented = false + state.isWebViewPresented = true + print("reportProblemButtonTapped") } } } diff --git a/Projects/Features/Recommend/Sources/Presentation/RecommendViewModel.swift b/Projects/Features/Recommend/Sources/Presentation/RecommendViewModel.swift index ba64ec4..d6d613b 100644 --- a/Projects/Features/Recommend/Sources/Presentation/RecommendViewModel.swift +++ b/Projects/Features/Recommend/Sources/Presentation/RecommendViewModel.swift @@ -81,8 +81,6 @@ public final class RecommendViewModel: ViewModelType, ObservableObject { isSuccessFetch: false ) bind() - - UserInfo.shared.deviceId = "uni-test4" } public func dispatch(type: Action) { diff --git a/Projects/ResourceKit/Resources/Icon.xcassets/More_Item.imageset/Contents.json b/Projects/ResourceKit/Resources/Icon.xcassets/More_Item.imageset/Contents.json new file mode 100644 index 0000000..9ec719e --- /dev/null +++ b/Projects/ResourceKit/Resources/Icon.xcassets/More_Item.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "More_Item.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "More_Item@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "More_Item@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Projects/ResourceKit/Resources/Icon.xcassets/More_Item.imageset/More_Item.png b/Projects/ResourceKit/Resources/Icon.xcassets/More_Item.imageset/More_Item.png new file mode 100644 index 0000000..0e39d68 Binary files /dev/null and b/Projects/ResourceKit/Resources/Icon.xcassets/More_Item.imageset/More_Item.png differ diff --git a/Projects/ResourceKit/Resources/Icon.xcassets/More_Item.imageset/More_Item@2x.png b/Projects/ResourceKit/Resources/Icon.xcassets/More_Item.imageset/More_Item@2x.png new file mode 100644 index 0000000..f3cf8fa Binary files /dev/null and b/Projects/ResourceKit/Resources/Icon.xcassets/More_Item.imageset/More_Item@2x.png differ diff --git a/Projects/ResourceKit/Resources/Icon.xcassets/More_Item.imageset/More_Item@3x.png b/Projects/ResourceKit/Resources/Icon.xcassets/More_Item.imageset/More_Item@3x.png new file mode 100644 index 0000000..73c03db Binary files /dev/null and b/Projects/ResourceKit/Resources/Icon.xcassets/More_Item.imageset/More_Item@3x.png differ