Skip to content

Commit

Permalink
fix/#388 PromiseViewController 개행 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
youz2me committed Sep 15, 2024
1 parent 49c4e2c commit 616f68f
Showing 1 changed file with 35 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,66 +16,38 @@ class PromiseViewController: BaseViewController {
private let promiseInfoViewController: PromiseInfoViewController
private let promiseReadyStatusViewController: ReadyStatusViewController
private let promiseTardyViewController: TardyViewController
private let exitViewController = CustomActionSheetController(
kind: .exitPromise
)
private let deleteViewController = CustomActionSheetController(
kind: .deletePromise
)
private let exitViewController = CustomActionSheetController(kind: .exitPromise)
private let deleteViewController = CustomActionSheetController(kind: .deletePromise)
private let promisePageViewController = UIPageViewController(
transitionStyle: .scroll,
navigationOrientation: .vertical
)

private var removePromiseViewContoller: RemovePromiseViewController = RemovePromiseViewController(
promiseName: ""
)
private var removePromiseViewContoller: RemovePromiseViewController = RemovePromiseViewController(promiseName: "")
private var promiseViewControllerList: [BaseViewController] = []

private lazy var promiseSegmentedControl = PagePromiseSegmentedControl(
items: [
"약속 정보",
"준비 현황",
"지각 꾸물이"
]
)
private lazy var promiseSegmentedControl = PagePromiseSegmentedControl(items: ["약속 정보", "준비 현황", "지각 꾸물이"])


// MARK: - LifeCycle

init(
viewModel: PromiseViewModel
) {
init(viewModel: PromiseViewModel) {
self.viewModel = viewModel

promiseInfoViewController = PromiseInfoViewController(
viewModel: viewModel
)
promiseReadyStatusViewController = ReadyStatusViewController(
viewModel: viewModel
)
promiseTardyViewController = TardyViewController(
viewModel: viewModel
)
promiseInfoViewController = PromiseInfoViewController(viewModel: viewModel)
promiseReadyStatusViewController = ReadyStatusViewController(viewModel: viewModel)
promiseTardyViewController = TardyViewController(viewModel: viewModel)

promiseViewControllerList = [
promiseInfoViewController,
promiseReadyStatusViewController,
promiseTardyViewController
]

super.init(
nibName: nil,
bundle: nil
)
super.init(nibName: nil, bundle: nil)
}

required init?(
coder: NSCoder
) {
fatalError(
"init(coder:) has not been implemented"
)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func viewDidLoad() {
Expand All @@ -85,22 +57,14 @@ class PromiseViewController: BaseViewController {
setupBindings()
}

override func viewWillAppear(
_ animated: Bool
) {
super.viewWillAppear(
animated
)
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

navigationController?.isNavigationBarHidden = false
}

override func viewWillDisappear(
_ animated: Bool
) {
super.viewWillDisappear(
animated
)
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)

navigationController?.isNavigationBarHidden = true
}
Expand All @@ -111,14 +75,9 @@ class PromiseViewController: BaseViewController {
override func setupView() {
view.backgroundColor = .white

addChild(
promisePageViewController
)
addChild(promisePageViewController)

view.addSubviews(
promiseSegmentedControl,
promisePageViewController.view
)
view.addSubviews(promiseSegmentedControl, promisePageViewController.view)

promisePageViewController.setViewControllers(
[promiseViewControllerList[0]],
Expand All @@ -127,65 +86,46 @@ class PromiseViewController: BaseViewController {
)

promiseSegmentedControl.snp.makeConstraints {
$0.top.equalTo(
view.safeAreaLayoutGuide
)
$0.leading.trailing.equalToSuperview().inset(
-6
)
$0.height.equalTo(
Screen.height(
60
)
$0.top.equalTo(view.safeAreaLayoutGuide)
$0.leading.trailing.equalToSuperview().inset(-6)
$0.height.equalTo(Screen.height(60)
)
}

promisePageViewController.view.snp.makeConstraints {
$0.top.equalTo(
promiseSegmentedControl.snp.bottom
)
$0.top.equalTo(promiseSegmentedControl.snp.bottom)
$0.leading.trailing.bottom.equalToSuperview()
}
}

override func setupAction() {
promiseSegmentedControl.addTarget(
self,
action: #selector(
didSegmentedControlIndexUpdated
),
action: #selector(didSegmentedControlIndexUpdated),
for: .valueChanged
)

promiseTardyViewController.tardyView.finishMeetingButton.addTarget(
self,
action: #selector(
finishMeetingButtonDidTap
),
action: #selector(finishMeetingButtonDidTap),
for: .touchUpInside
)

promiseTardyViewController.arriveView.finishMeetingButton.addTarget(
self,
action: #selector(
finishMeetingButtonDidTap
),
action: #selector(finishMeetingButtonDidTap),
for: .touchUpInside
)

removePromiseViewContoller.exitButton.addTarget(
self,
action: #selector(
exitButtonDidTap
),
action: #selector(exitButtonDidTap),
for: .touchUpInside
)

removePromiseViewContoller.deleteButton.addTarget(
self,
action: #selector(
deleteButtonDidTap
),
action: #selector(deleteButtonDidTap),
for: .touchUpInside
)
}
Expand Down Expand Up @@ -237,56 +177,35 @@ private extension PromiseViewController {
func moreButtonDidTap() {
let bottomSheetViewController = BottomSheetViewController(
contentViewController: removePromiseViewContoller,
defaultHeight: Screen.height(
232
)
defaultHeight: Screen.height(232)
)

present(
bottomSheetViewController,
animated: true
)
present(bottomSheetViewController, animated: true)
}

@objc
func exitButtonDidTap() {
dismiss(
animated: false
)
present(
exitViewController,
animated: true
)
dismiss(animated: false)
present(exitViewController, animated: true)
}

@objc
func deleteButtonDidTap() {
dismiss(
animated: false
)
present(
deleteViewController,
animated: true
)
dismiss(animated: false)
present(deleteViewController, animated: true)
}
}


// MARK: - CustomActionSheetDelegate

extension PromiseViewController: CustomActionSheetDelegate {
func actionButtonDidTap(
for kind: ActionSheetKind
) {
func actionButtonDidTap(for kind: ActionSheetKind) {
if kind == .deletePromise {
dismiss(
animated: false
)
dismiss(animated: false)
}
else {
dismiss(
animated: false
)
dismiss(animated: false)
}
}
}
Expand Down

0 comments on commit 616f68f

Please sign in to comment.