From 26d94bf5b3135457daddcba6df5a6cd1ec7b9a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cxixn2=E2=80=9D?= Date: Tue, 12 Nov 2024 14:41:17 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20::=20[#54]=20Add=20PostDetailView?= =?UTF-8?q?=20Qr=20Popup=20Feature=20Make?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../App/Sources/Application/ExpoApp.swift | 3 +- .../App/Sources/Extension/EXPOQRCode.swift | 2 +- .../Sources/PostDetailView.swift | 47 +++++++++++++++++-- .../PostDetailFeature/Sources/TestView.swift | 27 ----------- 4 files changed, 44 insertions(+), 35 deletions(-) delete mode 100644 Projects/App/Sources/Feature/PostDetailFeature/Sources/TestView.swift diff --git a/Projects/App/Sources/Application/ExpoApp.swift b/Projects/App/Sources/Application/ExpoApp.swift index eeefd22..94a81a0 100644 --- a/Projects/App/Sources/Application/ExpoApp.swift +++ b/Projects/App/Sources/Application/ExpoApp.swift @@ -5,8 +5,7 @@ import KakaoMapsSDK struct ExpoApp: App { var body: some Scene { WindowGroup { - //PostDetailView() - QRCodeCallerView() + SigninView(viewModel: AuthViewModel()) .onAppear { let appKey = Bundle.main.object(forInfoDictionaryKey: "KAKAO_NATIVE_APP_KEY") as? String ?? "" SDKInitializer.InitSDK(appKey: appKey) diff --git a/Projects/App/Sources/Extension/EXPOQRCode.swift b/Projects/App/Sources/Extension/EXPOQRCode.swift index bea68f5..b34fe52 100644 --- a/Projects/App/Sources/Extension/EXPOQRCode.swift +++ b/Projects/App/Sources/Extension/EXPOQRCode.swift @@ -18,7 +18,7 @@ struct QrCodeMakeView: View { Image(uiImage: qrImage) .interpolation(.none) .resizable() - .frame(width: 150, height: 150) + .frame(width: 145, height: 145) } else { ExpoIOSAsset.Assets.warningImage.swiftUIImage .resizable() diff --git a/Projects/App/Sources/Feature/PostDetailFeature/Sources/PostDetailView.swift b/Projects/App/Sources/Feature/PostDetailFeature/Sources/PostDetailView.swift index a34abd7..7fe9e4a 100644 --- a/Projects/App/Sources/Feature/PostDetailFeature/Sources/PostDetailView.swift +++ b/Projects/App/Sources/Feature/PostDetailFeature/Sources/PostDetailView.swift @@ -8,7 +8,6 @@ import SwiftUI import KakaoMapsSDK -import CoreImage.CIFilterBuiltins struct PostDetailView: View { @Environment(\.dismiss) var dismiss @@ -16,6 +15,8 @@ struct PostDetailView: View { @State private var dateLine: String = "09.10 ~09.20" @State private var drawMap: Bool = true @State private var showMessageSheet = false + @State private var showQrcodeSheet = false + @State private var link: String = "https://github.com/School-of-Company/Expo-iOS" @State private var location = Location( locationX: 126.800771954215, locationY: 35.1427689679488, @@ -156,7 +157,9 @@ struct PostDetailView: View { verticalPadding: 14, backColor: ExpoColor.main.swiftUIColor, actionColor: ExpoColor.main300.swiftUIColor - ) + ) { + showQrcodeSheet.toggle() + } } .padding(.horizontal, 16) .padding(.top, 32) @@ -192,7 +195,9 @@ struct PostDetailView: View { .overlay( Group { if showMessageSheet { - popup(showMessageSheet: $showMessageSheet) + popupMessage(showMessageSheet: $showMessageSheet) + } else if showQrcodeSheet { + popupQrcode(showQrcodeSheet: $showQrcodeSheet, link: $link) } } ) @@ -201,7 +206,7 @@ struct PostDetailView: View { } @ViewBuilder -func popup(showMessageSheet: Binding) -> some View { +func popupMessage(showMessageSheet: Binding) -> some View { Color.black.opacity(0.4) .edgesIgnoringSafeArea(.all) .overlay( @@ -248,10 +253,42 @@ func popup(showMessageSheet: Binding) -> some View { ) .padding(.horizontal, 32) ) - } +@ViewBuilder +func popupQrcode(showQrcodeSheet: Binding, link: Binding) -> some View { + Color.black.opacity(0.4) + .edgesIgnoringSafeArea(.all) + .overlay( + RoundedRectangle(cornerRadius: 6) + .frame(height: 240) + .foregroundColor(.white) + .overlay( + VStack(spacing: 0){ + HStack(spacing: 0) { + Text("현장 신청 QR코드") + .expoFont(.title3B) + Spacer() + + Button { + showQrcodeSheet.wrappedValue = false + } label: { + ExpoIOSAsset.Assets.buttonX.swiftUIImage + } + } + .padding(.horizontal, 12) + + QrCodeMakeView(link: link) + .padding(.top, 24) + Spacer() + } + .padding(.vertical, 16) + ) + .padding(.horizontal, 50) + ) + +} #Preview { PostDetailView() diff --git a/Projects/App/Sources/Feature/PostDetailFeature/Sources/TestView.swift b/Projects/App/Sources/Feature/PostDetailFeature/Sources/TestView.swift deleted file mode 100644 index b3225ce..0000000 --- a/Projects/App/Sources/Feature/PostDetailFeature/Sources/TestView.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// TestView.swift -// Expo-iOS -// -// Created by 서지완 on 11/12/24. -// Copyright © 2024 SchoolofCompany. All rights reserved. -// - -import SwiftUI - -struct QRCodeCallerView: View { - @State private var link: String = "" - - var body: some View { - VStack { - TextField("QR에 사용할 링크를 입력해주세요.", text: $link) - .textFieldStyle(RoundedBorderTextFieldStyle()) - .padding() - - QrCodeMakeView(link: $link) // QrCodeMakeView에 link를 전달 - .padding() - - Spacer() - } - .padding() - } -}