-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
86 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,10 @@ public struct MemeDetailView: View { | |
@State private var totalHeight: CGFloat = 0 | ||
@State private var memeCardHeight: CGFloat = 0 | ||
@State private var tabBarHeight: CGFloat = 0 | ||
|
||
@State private var isSheetPresented: Bool = false | ||
@State private var isWebViewPresented: Bool = false | ||
@State private var showContactUsAlert: Bool = false | ||
|
||
private var isShortCard: Bool { | ||
memeCardHeight + tabBarHeight > totalHeight - 30 | ||
} | ||
|
@@ -43,19 +46,42 @@ public struct MemeDetailView: View { | |
public var body: some View { | ||
ZStack { | ||
memeDetailCardView | ||
if viewModel.state.isSheetPresented { | ||
.sheet(isPresented: $isSheetPresented) { | ||
bottomSheetView | ||
.presentationDetents([.height(66+40)]) | ||
} | ||
|
||
if isSheetPresented { | ||
Color.black.opacity(0.4) | ||
.ignoresSafeArea([.container]) | ||
} | ||
} | ||
.onAppear { | ||
viewModel.logMemeDetail(interaction: .view, event: .meme) | ||
} | ||
.plainNavigationBar( | ||
backHandler: { viewModel.dispatch(type: .naviBackButtonTapped) }, | ||
rightActionHandler: { viewModel.dispatch(type: .naviMoreButtonTapped) }, | ||
rightActionHandler: { isSheetPresented = true }, | ||
hasConfigureButton: true, | ||
title: viewModel.state.meme.title | ||
) | ||
.sheet(isPresented: $isWebViewPresented, onDismiss: { isWebViewPresented = false }) { | ||
WebView(url: viewModel.state.reportProblemUrl) | ||
.presentationDetents([.large]) | ||
} | ||
.basicModal( | ||
isPresented: $showContactUsAlert, | ||
opacity: 0.5, | ||
content: { | ||
FarmemeAlertView( | ||
title: "문의하기", | ||
description: "[email protected]", | ||
dismiss: { | ||
showContactUsAlert = false | ||
} | ||
) | ||
} | ||
) | ||
.popup( | ||
isActive: $viewModel.state.isCopied, | ||
image: ResourceKitAsset.Icon.copyFilled.swiftUIImage, | ||
|
@@ -66,16 +92,6 @@ 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]) | ||
} | ||
} | ||
|
||
private var memeDetailCardView: some View { | ||
|
@@ -153,11 +169,18 @@ public struct MemeDetailView: View { | |
.frame(height: 16) | ||
.foregroundStyle(Color.Background.white) | ||
reportProblembutton | ||
.onTapGesture { | ||
isSheetPresented = false | ||
isWebViewPresented = true | ||
} | ||
contactUsButton | ||
.onTapGesture { | ||
isSheetPresented = false | ||
isWebViewPresented = false // 신고하기 후에 누르면, 신고하기가 떠서 강제로 막음 | ||
showContactUsAlert = true | ||
} | ||
} | ||
.padding(.bottom, 10) | ||
.onTapGesture { | ||
viewModel.dispatch(type: .reportProblemButtonTapped) | ||
} | ||
} | ||
|
||
private var reportProblembutton: some View { | ||
|
@@ -167,6 +190,13 @@ public struct MemeDetailView: View { | |
.padding(.vertical, 16) | ||
} | ||
|
||
private var contactUsButton: some View { | ||
Text("문의하기") | ||
.font(Font.Body.Xlarge.medium) | ||
.foregroundStyle(Color.Text.primary) | ||
.padding(.vertical, 16) | ||
} | ||
|
||
@MainActor | ||
private func tabBarTap(_ type: MemeDetailTab) { | ||
switch type { | ||
|
@@ -178,7 +208,6 @@ public struct MemeDetailView: View { | |
viewModel.dispatch(type: .shreButtonTapped) | ||
} | ||
} | ||
|
||
} | ||
|
||
#Preview { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters