From dc8dc8f51dd07cac69025adc4c08d537771f1d7f Mon Sep 17 00:00:00 2001 From: hyungyu Kim Date: Thu, 23 Dec 2021 20:58:56 +0900 Subject: [PATCH] =?UTF-8?q?[FEAT]=20#198=20-=20=EC=B2=AB=20=EB=AA=85?= =?UTF-8?q?=ED=95=A8=EC=83=9D=EC=84=B1=20=EC=8B=9C=20=EB=B0=94=ED=85=80?= =?UTF-8?q?=EC=8B=9C=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fixme qa 테플용으로 현재 viewWillAppear 로 테스트 --- .../Resouces/Constants/UserDefaults.swift | 4 +-- .../Sources/SceneDelegate.swift | 5 +--- ...stCardAlertBottomSheetViewController.swift | 29 +++++++++++++------ .../CardCreationPreviewViewController.swift | 16 ++++++++++ .../Main/FrontViewController.swift | 24 +++++++-------- 5 files changed, 50 insertions(+), 28 deletions(-) diff --git a/NADA-iOS-forRelease/Resouces/Constants/UserDefaults.swift b/NADA-iOS-forRelease/Resouces/Constants/UserDefaults.swift index e138bc02..92812197 100644 --- a/NADA-iOS-forRelease/Resouces/Constants/UserDefaults.swift +++ b/NADA-iOS-forRelease/Resouces/Constants/UserDefaults.swift @@ -12,7 +12,7 @@ extension Const { static let darkModeState = "darkModeState" static let accessToken = "accessToken" static let refreshToken = "refreshToken" -// static let userID = "userID" - static let userID = "nada2" + static let userID = "userID" + static let isFirstCard = "isFirstCard" } } diff --git a/NADA-iOS-forRelease/Sources/SceneDelegate.swift b/NADA-iOS-forRelease/Sources/SceneDelegate.swift index 3c199b7e..7b430bb9 100644 --- a/NADA-iOS-forRelease/Sources/SceneDelegate.swift +++ b/NADA-iOS-forRelease/Sources/SceneDelegate.swift @@ -15,14 +15,11 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { let defaults = UserDefaults.standard func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { - // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. - // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. - // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). guard let windowScene = (scene as? UIWindowScene) else { return } window = UIWindow(frame: windowScene.coordinateSpace.bounds) window?.windowScene = windowScene - window?.rootViewController = UIStoryboard(name: Const.Storyboard.Name.front, bundle: nil).instantiateViewController(withIdentifier: Const.ViewController.Identifier.frontViewController) + window?.rootViewController = UIStoryboard(name: Const.Storyboard.Name.splash, bundle: nil).instantiateViewController(withIdentifier: Const.ViewController.Identifier.splashViewController) window?.makeKeyAndVisible() IQKeyboardManager.shared.enable = true diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/FirstCardAlertBottomSheetViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/FirstCardAlertBottomSheetViewController.swift index abb6404b..89471935 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/FirstCardAlertBottomSheetViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/FirstCardAlertBottomSheetViewController.swift @@ -42,20 +42,29 @@ class FirstCardAlertBottomSheetViewController: CommonBottomSheetViewController { private let firstSubtitleLabel: UILabel = { let label = UILabel() - label.text = "명함을 좌우로 스와이프하여\n 앞/뒷면을 확인할 수 있어요." - - + label.textAlignment = .center + label.numberOfLines = 2 + let attributedString = NSMutableAttributedString(string: "명함을 좌우로 스와이프하여\n 앞/뒷면을 확인할 수 있어요.") + attributedString.addAttributes([.foregroundColor: UIColor.primary, .font: UIFont.textRegular03], range: NSRange(location: 0, length: 3)) + attributedString.addAttributes([.foregroundColor: UIColor.mainColorNadaMain, .font: UIFont.textBold01], range: NSRange(location: 4, length: 8)) + attributedString.addAttributes([.foregroundColor: UIColor.primary, .font: UIFont.textRegular03], range: NSRange(location: 14, length: 16)) + label.attributedText = attributedString + return label }() private let secondSubtitleLabel: UILabel = { let label = UILabel() - label.text = "우측 상단의 공유 버튼을 통해\n 친구에게 공유해 보세요." + label.textAlignment = .center + label.numberOfLines = 2 + let attributedString = NSMutableAttributedString(string: "우측 상단의 공유 버튼을 통해\n 친구에게 공유해 보세요.") + attributedString.addAttributes([.foregroundColor: UIColor.mainColorNadaMain, .font: UIFont.textBold01], range: NSRange(location: 0, length: 12)) + attributedString.addAttributes([.foregroundColor: UIColor.primary, .font: UIFont.textRegular03], range: NSRange(location: 13, length: 17)) + label.attributedText = attributedString return label }() - // MARK: - View Life Cycle override func viewDidLoad() { @@ -68,6 +77,8 @@ class FirstCardAlertBottomSheetViewController: CommonBottomSheetViewController { // UI 세팅 작업 private func setupUI() { + titleLabel.numberOfLines = 2 + view.addSubview(cardImageView) view.addSubview(bgView) bgView.addSubview(firstHandIcon) @@ -99,25 +110,25 @@ class FirstCardAlertBottomSheetViewController: CommonBottomSheetViewController { firstHandIcon.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ firstHandIcon.topAnchor.constraint(equalTo: bgView.topAnchor, constant: 16), - firstHandIcon.centerXAnchor.constraint(equalTo: bottomSheetView.centerXAnchor) + firstHandIcon.centerXAnchor.constraint(equalTo: bgView.centerXAnchor) ]) secondHandIcon.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ secondHandIcon.topAnchor.constraint(equalTo: firstSubtitleLabel.bottomAnchor, constant: 16), - secondHandIcon.centerXAnchor.constraint(equalTo: bottomSheetView.centerXAnchor) + secondHandIcon.centerXAnchor.constraint(equalTo: bgView.centerXAnchor) ]) firstSubtitleLabel.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ firstSubtitleLabel.topAnchor.constraint(equalTo: firstHandIcon.bottomAnchor, constant: 2), - firstSubtitleLabel.centerXAnchor.constraint(equalTo: bottomSheetView.centerXAnchor) + firstSubtitleLabel.centerXAnchor.constraint(equalTo: bgView.centerXAnchor) ]) secondSubtitleLabel.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ secondSubtitleLabel.topAnchor.constraint(equalTo: secondHandIcon.bottomAnchor, constant: 2), - secondSubtitleLabel.centerXAnchor.constraint(equalTo: bottomSheetView.centerXAnchor) + secondSubtitleLabel.centerXAnchor.constraint(equalTo: bgView.centerXAnchor) ]) } } diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/CardCreation/CardCreationPreviewViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/CardCreation/CardCreationPreviewViewController.swift index d6545a4c..740062aa 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/CardCreation/CardCreationPreviewViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/CardCreation/CardCreationPreviewViewController.swift @@ -194,6 +194,22 @@ extension CardCreationPreviewViewController { case .success: print("cardCreationWithAPI - success") self.dismiss(animated: true, completion: nil) + // FIXME: - 초기에만등장 +// if UserDefaults.standard.object(forKey: Const.UserDefaults.isFirstCard) == nil { +// self.dismiss(animated: true) { +// let nextVC = FirstCardAlertBottomSheetViewController() +// .setTitle(""" +// 🎉 +// 첫 명함이 생성되었어요! +// """) +// .setHeight(587) +// nextVC.modalPresentationStyle = .overFullScreen +// DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.5) { +// self.presentingViewController?.present(nextVC, animated: false, completion: nil) +// } +// } +// } +// UserDefaults.standard.set(false, forKey: Const.UserDefaults.isFirstCard) case .requestErr(let message): print("cardCreationWithAPI - requestErr: \(message)") case .pathErr: diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/Main/FrontViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/Main/FrontViewController.swift index 9ad47dcf..df6737d4 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/Main/FrontViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/Main/FrontViewController.swift @@ -59,13 +59,22 @@ class FrontViewController: UIViewController { setDelegate() setNotification() // TODO: - 서버 테스트 + // cardListFetchWithAPI(userID: "nada", isList: false, offset: 0) } + // FIXME: - qa테스트 override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - setFirstCardAlert() + let nextVC = FirstCardAlertBottomSheetViewController() + .setTitle(""" + 🎉 + 첫 명함이 생성되었어요! + """) + .setHeight(587) + nextVC.modalPresentationStyle = .overFullScreen + present(nextVC, animated: true, completion: nil) } // MARK: - @IBAction Properties @@ -88,18 +97,7 @@ class FrontViewController: UIViewController { } // MARK: - Extensions -extension FrontViewController { - private func setFirstCardAlert() { - let nextVC = FirstCardAlertBottomSheetViewController() - .setTitle(""" - 🎉 - 첫 명함이 생성되었어요! - """) - .setHeight(587) - nextVC.modalPresentationStyle = .overFullScreen - present(nextVC, animated: false, completion: nil) - } - +extension FrontViewController { private func setDelegate() { cardSwiper.delegate = self cardSwiper.datasource = self