From e6caca1ac64df72034718c3a4b1ac5886037fb96 Mon Sep 17 00:00:00 2001 From: hryeong66 Date: Thu, 3 Oct 2024 21:27:26 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=B0=88=20=EC=8B=A0=EA=B3=A0=ED=95=98?= =?UTF-8?q?=EA=B8=B0=20=EC=B6=94=EA=B0=80=20(#86)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/PlainNavigationBar.swift | 10 ++- .../MemeDetail/Sources/MemeDetailView.swift | 83 +++++++++++++----- .../Sources/MemeDetailViewModel.swift | 14 +++ .../More_Item.imageset/Contents.json | 23 +++++ .../More_Item.imageset/More_Item.png | Bin 0 -> 255 bytes .../More_Item.imageset/More_Item@2x.png | Bin 0 -> 268 bytes .../More_Item.imageset/More_Item@3x.png | Bin 0 -> 500 bytes 7 files changed, 103 insertions(+), 27 deletions(-) create mode 100644 Projects/ResourceKit/Resources/Icon.xcassets/More_Item.imageset/Contents.json create mode 100644 Projects/ResourceKit/Resources/Icon.xcassets/More_Item.imageset/More_Item.png create mode 100644 Projects/ResourceKit/Resources/Icon.xcassets/More_Item.imageset/More_Item@2x.png create mode 100644 Projects/ResourceKit/Resources/Icon.xcassets/More_Item.imageset/More_Item@3x.png 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 a96e1c7..3737c2e 100644 --- a/Projects/Features/MemeDetail/Sources/MemeDetailView.swift +++ b/Projects/Features/MemeDetail/Sources/MemeDetailView.swift @@ -31,34 +31,19 @@ public struct MemeDetailView: View { public var body: some View { Spacer() - - MemeDetailCardView(meme: $viewModel.state.meme) { - viewModel.dispatch(type: .likeButtonTapped) + ZStack { + memeDetailCardView + if viewModel.state.isSheetPresented { + Color.black.opacity(0.4) + } } - .padding(.horizontal, 24) - .memeDetailTabBar(isFarmemed: $viewModel.state.meme.isFarmemed) { tab in - tabBarTap(tab) - } - .background( - KFImage(URL(string: viewModel.state.meme.imageUrlString)) - .resizable() - .loadDiskFileSynchronously() - .cacheMemoryOnly() - .aspectRatio(contentMode: .fill) - .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center) - .clipped() - .opacity(0.4) // Image Opacity: 40% - .blur(radius: 50) // Layer Blur: 50 - .overlay(Color.white.opacity(0.3)) // White Dim: #fff, Opacity: 30% - .edgesIgnoringSafeArea(.top) - ) .onAppear { viewModel.logMemeDetail(interaction: .view, event: .meme) } .plainNavigationBar( backHandler: { viewModel.dispatch(type: .naviBackButtonTapped) }, - rightActionHandler: nil, - hasConfigureButton: false, + rightActionHandler: { viewModel.dispatch(type: .naviMoreButtonTapped) }, + hasConfigureButton: true, title: viewModel.state.meme.title ) .popup( @@ -71,7 +56,16 @@ public struct MemeDetailView: View { 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]) + } Spacer() } @@ -86,6 +80,49 @@ public struct MemeDetailView: View { viewModel.dispatch(type: .shreButtonTapped) } } + + private var memeDetailCardView: some View { + MemeDetailCardView(meme: $viewModel.state.meme) { + viewModel.dispatch(type: .likeButtonTapped) + } + .padding(.horizontal, 24) + .memeDetailTabBar(isFarmemed: $viewModel.state.meme.isFarmemed) { tab in + tabBarTap(tab) + } + .background( + KFImage(URL(string: viewModel.state.meme.imageUrlString)) + .resizable() + .loadDiskFileSynchronously() + .cacheMemoryOnly() + .aspectRatio(contentMode: .fill) + .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center) + .clipped() + .opacity(0.4) // Image Opacity: 40% + .blur(radius: 50) // Layer Blur: 50 + .overlay(Color.white.opacity(0.3)) // White Dim: #fff, Opacity: 30% + .edgesIgnoringSafeArea(.top) + ) + } + + private var bottomSheetView: some View { + VStack { + Rectangle() + .cornerRadius(20, corners: [.topLeft, .topRight]) + .frame(height: 16) + .foregroundStyle(Color.Background.white) + reportProblembutton + } + .onTapGesture { + viewModel.dispatch(type: .reportProblemButtonTapped) + } + } + + private var reportProblembutton: some View { + Text("신고하기") + .font(Font.Body.Xlarge.medium) + .foregroundStyle(Color.Text.primary) + .padding(.vertical, 16) + } } // //#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/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 0000000000000000000000000000000000000000..0e39d68d7cb08cc1a1bea6f4bf35ba81f9173fc4 GIT binary patch literal 255 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VXMsm#F#`j)FbFd;%$g$s6l5$8 za(7}_cTVOdki(Mh={03GHjao^1=|s&fL1vd#yPg?NF`8>?5;`-svP16CvUhPeUKpRB yB*5A>$)QL8gir8VA;YOYudf~y?mt>&u6)N=|M%fd9A-fGF?hQAxvX=n&l+Of|FWO$ifl#Hud9b?X8AdkV*)z4*} HQ$iB}Dk)%! literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..73c03db2c89c6d8a80403baa34700bc3a66e684d GIT binary patch literal 500 zcmeAS@N?(olHy`uVBq!ia0vp^HXzKw1|+Ti+$;i8oCO|{#S9FJ79h;%I?XTvD9BhG z@ z-YB%`NISnm>x^A57iS;6Q}XHh*Vn