diff --git a/Projects/Features/MemeDetail/Sources/MemeDetailView.swift b/Projects/Features/MemeDetail/Sources/MemeDetailView.swift index 9db7aff..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,6 @@ public struct MemeDetailView: View { .clipped() .edgesIgnoringSafeArea(.top) ) - .onAppear { - viewModel.logMemeDetail(interaction: .view, event: .meme) - } - .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 bottomSheetView: some View { @@ -136,6 +154,7 @@ public struct MemeDetailView: View { .foregroundStyle(Color.Background.white) reportProblembutton } + .padding(.bottom, 10) .onTapGesture { viewModel.dispatch(type: .reportProblemButtonTapped) } @@ -147,6 +166,19 @@ public struct MemeDetailView: View { .foregroundStyle(Color.Text.primary) .padding(.vertical, 16) } + + @MainActor + private func tabBarTap(_ type: MemeDetailTab) { + switch type { + case .copy: + viewModel.dispatch(type: .copyButtonTapped) + case .farmeme: + viewModel.dispatch(type: .farmemeButtonTapped) + case .share: + viewModel.dispatch(type: .shreButtonTapped) + } + } + } #Preview { 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) {