Skip to content

Commit

Permalink
[Feat] TeamSparker#292 - 대기방에서 팝업 화면 전환 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
yangsubinn committed Feb 21, 2022
1 parent 570ed8f commit ec97dd9
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,7 @@ extension HomeVC {

@objc
private func presentToProfileVC() {
guard let nextVC = UIStoryboard(name: Const.Storyboard.Name.roomStart, bundle: nil).instantiateViewController(withIdentifier: Const.ViewController.Identifier.roomStart) as? RoomStartVC else { return }

nextVC.modalPresentationStyle = .overFullScreen
nextVC.modalTransitionStyle = .crossDissolve

self.present(nextVC, animated: true, completion: nil)
}

@objc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@

import UIKit

import SnapKit

class RoomStartVC: UIViewController {

// MARK: - Properties

private let popupView = UIView()
private let titleLabel = UILabel()
private let userImageView = UIImageView()
Expand All @@ -27,9 +30,11 @@ class RoomStartVC: UIViewController {
super.viewDidLoad()
setUI()
setLayout()
setAddTarget()
}

// MARK: - Custom Method

private func setUI() {
view.backgroundColor = .sparkBlack.withAlphaComponent(0.8)

Expand Down Expand Up @@ -65,13 +70,34 @@ class RoomStartVC: UIViewController {
startButton.titleLabel?.font = .krMediumFont(ofSize: 16)
}

private func setAddTarget() {
cancelButton.addTarget(self, action: #selector(dismissRoomStart), for: .touchUpInside)
startButton.addTarget(self, action: #selector(touchStartButton), for: .touchUpInside)
}

// MARK: - @objc

@objc
func touchStartButton() {
// TODO: - 서버연결
}

@objc
func dismissRoomStart() {
self.dismiss(animated: true, completion: nil)
}
}

// MARK: - Layout

extension RoomStartVC {
private func setLayout() {
view.addSubview(popupView)

popupView.snp.makeConstraints { make in
make.center.equalToSuperview()
make.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(20)
make.height.equalTo(250)
make.height.equalTo((UIScreen.main.bounds.width - 40) * 250 / 335)
}

popupView.addSubviews([titleLabel, userImageView, phoneImageView,
Expand Down
47 changes: 27 additions & 20 deletions Spark-iOS/Spark-iOS/Source/ViewControllers/Waiting/WaitingVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ extension WaitingVC {
copyButton.addTarget(self, action: #selector(copyToClipboard), for: .touchUpInside)
editButton.addTarget(self, action: #selector(touchEditButton), for: .touchUpInside)
refreshButton.addTarget(self, action: #selector(touchToRefreshButton), for: .touchUpInside)
startButton.addTarget(self, action: #selector(touchToCreateButton), for: .touchUpInside)
startButton.addTarget(self, action: #selector(touchToStartButton), for: .touchUpInside)
toolTipButton.addTarget(self, action: #selector(touchPresentToolTip), for: .touchUpInside)
tapGestrueRecognizer.addTarget(self, action: #selector(quickDismissToolTip))
}
Expand Down Expand Up @@ -402,26 +402,33 @@ extension WaitingVC {
}

@objc
private func touchToCreateButton() {
DispatchQueue.main.async {
self.setLoading()
}
private func touchToStartButton() {
guard let nextVC = UIStoryboard(name: Const.Storyboard.Name.roomStart, bundle: nil).instantiateViewController(withIdentifier: Const.ViewController.Identifier.roomStart) as? RoomStartVC else { return }

DispatchQueue.main.async {
self.postStartRoomWithAPI(roomID: self.roomId ?? 0) {
switch self.fromWhereStatus {
case .fromHome:
self.popToHomeVC()
case .makeRoom:
self.dismissToHomeVC()
case .joinCode:
// 코드로 참여시에는 createButton 이 히든되어 있어서 아무런 동작이 필요하지 않다.
return
case .none:
print("fromeWhereStatus 를 지정해주세요.")
}
}
}
nextVC.modalPresentationStyle = .overFullScreen
nextVC.modalTransitionStyle = .crossDissolve

self.present(nextVC, animated: true, completion: nil)

// DispatchQueue.main.async {
// self.setLoading()
// }
//
// DispatchQueue.main.async {
// self.postStartRoomWithAPI(roomID: self.roomId ?? 0) {
// switch self.fromWhereStatus {
// case .fromHome:
// self.popToHomeVC()
// case .makeRoom:
// self.dismissToHomeVC()
// case .joinCode:
// // 코드로 참여시에는 createButton 이 히든되어 있어서 아무런 동작이 필요하지 않다.
// return
// case .none:
// print("fromeWhereStatus 를 지정해주세요.")
// }
// }
// }
}
}

Expand Down

0 comments on commit ec97dd9

Please sign in to comment.