Skip to content

Commit

Permalink
[FEAT] #198 - 첫 명함생성 시 바텀시트 구현
Browse files Browse the repository at this point in the history
- fixme qa 테플용으로 현재 viewWillAppear 로 테스트
  • Loading branch information
hyun99999 committed Dec 23, 2021
1 parent 97477cc commit dc8dc8f
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 28 deletions.
4 changes: 2 additions & 2 deletions NADA-iOS-forRelease/Resouces/Constants/UserDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
5 changes: 1 addition & 4 deletions NADA-iOS-forRelease/Sources/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -68,6 +77,8 @@ class FirstCardAlertBottomSheetViewController: CommonBottomSheetViewController {

// UI 세팅 작업
private func setupUI() {
titleLabel.numberOfLines = 2

view.addSubview(cardImageView)
view.addSubview(bgView)
bgView.addSubview(firstHandIcon)
Expand Down Expand Up @@ -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)
])
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit dc8dc8f

Please sign in to comment.