Skip to content

Commit

Permalink
Merge pull request #206 from TeamNADA/release1.0/#198
Browse files Browse the repository at this point in the history
[FEAT] #198 - 첫 명함생성 시 바텀시트 구현
  • Loading branch information
hyun99999 authored Dec 23, 2021
2 parents 41cef59 + dc8dc8f commit ecc079c
Show file tree
Hide file tree
Showing 19 changed files with 242 additions and 9 deletions.
4 changes: 4 additions & 0 deletions NADA-iOS-forRelease.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
DBBB91E1639641F40C5B4416 /* Pods_NADA_iOS_forRelease.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A2183AE0E469153221624A0 /* Pods_NADA_iOS_forRelease.framework */; };
F811720027383097002742CF /* ChangeGroupRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = F81171FF27383097002742CF /* ChangeGroupRequest.swift */; };
F822E7A92709CEB60020452C /* Notification.swift in Sources */ = {isa = PBXBuildFile; fileRef = F822E7A82709CEB60020452C /* Notification.swift */; };
F8268DB927730B0100BF114B /* FirstCardAlertBottomSheetViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8268DB827730B0100BF114B /* FirstCardAlertBottomSheetViewController.swift */; };
F82FEB4C27639F3100DA7847 /* MainCardCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F82FEB4A27639F3100DA7847 /* MainCardCell.swift */; };
F82FEB4D27639F3100DA7847 /* MainCardCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F82FEB4B27639F3100DA7847 /* MainCardCell.xib */; };
F82FF81D2701EBCE00E57F8B /* CardCreation.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F82FF81C2701EBCE00E57F8B /* CardCreation.storyboard */; };
Expand Down Expand Up @@ -226,6 +227,7 @@
7F4EE1D042EC783FA8528743 /* Pods-NADA-iOS-forRelease.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NADA-iOS-forRelease.debug.xcconfig"; path = "Target Support Files/Pods-NADA-iOS-forRelease/Pods-NADA-iOS-forRelease.debug.xcconfig"; sourceTree = "<group>"; };
F81171FF27383097002742CF /* ChangeGroupRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangeGroupRequest.swift; sourceTree = "<group>"; };
F822E7A82709CEB60020452C /* Notification.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Notification.swift; sourceTree = "<group>"; };
F8268DB827730B0100BF114B /* FirstCardAlertBottomSheetViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstCardAlertBottomSheetViewController.swift; sourceTree = "<group>"; };
F82FEB4A27639F3100DA7847 /* MainCardCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainCardCell.swift; sourceTree = "<group>"; };
F82FEB4B27639F3100DA7847 /* MainCardCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainCardCell.xib; sourceTree = "<group>"; };
F82FF81C2701EBCE00E57F8B /* CardCreation.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = CardCreation.storyboard; sourceTree = "<group>"; };
Expand Down Expand Up @@ -502,6 +504,7 @@
F8915A20275728F20013D609 /* SelectBirthBottomViewController.swift */,
F8915A21275728F20013D609 /* SelectMBTIBottomViewController.swift */,
7734D5A927719520004360E4 /* CardShareBottomSheetViewController.swift */,
F8268DB827730B0100BF114B /* FirstCardAlertBottomSheetViewController.swift */,
);
path = BottomSheet;
sourceTree = "<group>";
Expand Down Expand Up @@ -1130,6 +1133,7 @@
F8C310C0273A7360008EC5BA /* FrontCardCreationDelegate.swift in Sources */,
F8C83FBF272FA0670009DF0D /* UserSevice.swift in Sources */,
39F5A3D0271461EA00191F94 /* BackCardCell.swift in Sources */,
F8268DB927730B0100BF114B /* FirstCardAlertBottomSheetViewController.swift in Sources */,
F851805B275D047C006BD5ED /* OnboardingViewController.swift in Sources */,
39C1E88F270EC762006D2089 /* UIColor+Extension.swift in Sources */,
F8C83FC9272FA3190009DF0D /* GroupAPI.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "invalidName.png",
"scale" : "1x",
"idiom" : "universal"
},
{
"scale" : "2x",
"filename" : "invalidName@2x.png",
"idiom" : "universal"
},
{
"filename" : "invalidName@3x.png",
"scale" : "3x",
"idiom" : "universal"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "imgFirstcard.png"
},
{
"filename" : "imgFirstcard@2x.png",
"scale" : "2x",
"idiom" : "universal"
},
{
"filename" : "imgFirstcard@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"scale" : "1x",
"idiom" : "universal",
"filename" : "invalidName.png"
},
{
"filename" : "invalidName@2x.png",
"scale" : "2x",
"idiom" : "universal"
},
{
"idiom" : "universal",
"filename" : "invalidName@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ extension Const {
static let openSourceViewController = "OpenSourceViewController"
static let teamNADAViewController = "TeamNADAViewController"
static let groupNameEditBottomSheetViewController = "GroupNameEditBottomSheetViewController"
static let firstCardAlertBottomSheetViewController = "FirstCardAlertBottomSheetViewController"
}
}
}
3 changes: 0 additions & 3 deletions NADA-iOS-forRelease/Sources/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ 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)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
//
// FirstCardAlertBottomSheetViewController.swift
// NADA-iOS-forRelease
//
// Created by kimhyungyu on 2021/12/22.
//

import UIKit

class FirstCardAlertBottomSheetViewController: CommonBottomSheetViewController {

// MARK: - Properties

private let cardImageView: UIImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "imgFirstcard")

return imageView
}()

private let bgView: UIView = {
let view = UIView()
view.layer.cornerRadius = 20
view.backgroundColor = .textBox

return view
}()

private let firstHandIcon: UIImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "firsthandIcon")

return imageView
}()

private let secondHandIcon: UIImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "secondhandIcon")

return imageView
}()

private let firstSubtitleLabel: UILabel = {
let label = UILabel()
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.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() {
super.viewDidLoad()

setupUI()
}

// MARK: - Methods

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

view.addSubview(cardImageView)
view.addSubview(bgView)
bgView.addSubview(firstHandIcon)
bgView.addSubview(secondHandIcon)
bgView.addSubview(firstSubtitleLabel)
bgView.addSubview(secondSubtitleLabel)

setupLayout()
}

// 레이아웃 세팅
private func setupLayout() {
cardImageView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
cardImageView.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 16),
cardImageView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 70),
cardImageView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -70)
])

bgView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
bgView.topAnchor.constraint(equalTo: cardImageView.bottomAnchor, constant: 16),
bgView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16),
bgView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -16),
bgView.heightAnchor.constraint(equalToConstant: 194)

])

firstHandIcon.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
firstHandIcon.topAnchor.constraint(equalTo: bgView.topAnchor, constant: 16),
firstHandIcon.centerXAnchor.constraint(equalTo: bgView.centerXAnchor)
])

secondHandIcon.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
secondHandIcon.topAnchor.constraint(equalTo: firstSubtitleLabel.bottomAnchor, constant: 16),
secondHandIcon.centerXAnchor.constraint(equalTo: bgView.centerXAnchor)
])

firstSubtitleLabel.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
firstSubtitleLabel.topAnchor.constraint(equalTo: firstHandIcon.bottomAnchor, constant: 2),
firstSubtitleLabel.centerXAnchor.constraint(equalTo: bgView.centerXAnchor)
])

secondSubtitleLabel.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
secondSubtitleLabel.topAnchor.constraint(equalTo: secondHandIcon.bottomAnchor, constant: 2),
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,9 +59,24 @@ class FrontViewController: UIViewController {
setDelegate()
setNotification()
// TODO: - 서버 테스트

// cardListFetchWithAPI(userID: "nada", isList: false, offset: 0)
}

// FIXME: - qa테스트
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

let nextVC = FirstCardAlertBottomSheetViewController()
.setTitle("""
🎉
첫 명함이 생성되었어요!
""")
.setHeight(587)
nextVC.modalPresentationStyle = .overFullScreen
present(nextVC, animated: true, completion: nil)
}

// MARK: - @IBAction Properties
// 명함 생성 뷰로 화면 전환
@IBAction func presentToCardCreationView(_ sender: Any) {
Expand All @@ -82,10 +97,7 @@ class FrontViewController: UIViewController {
}

// MARK: - Extensions
extension FrontViewController {
private func setUI() {

}
extension FrontViewController {
private func setDelegate() {
cardSwiper.delegate = self
cardSwiper.datasource = self
Expand Down

0 comments on commit ecc079c

Please sign in to comment.