From c76d2a83033228e1a389b689549443587e460a7e Mon Sep 17 00:00:00 2001 From: Sejin Lee Date: Sat, 29 Apr 2023 00:47:33 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20#129=20-=20LogoutVC=EB=A5=BC=20RNAlert?= =?UTF-8?q?VC=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20=EC=9A=B0?= =?UTF-8?q?=EC=B8=A1=20=EB=B2=84=ED=8A=BC=20=EC=95=A1=EC=85=98=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runnect-iOS.xcodeproj/project.pbxproj | 8 +++---- .../UIComponents/RNAlertVC.swift} | 23 ++++++++++++------- .../MyPage/VC/SettingVC/PersonalInfoVC.swift | 5 +++- 3 files changed, 23 insertions(+), 13 deletions(-) rename Runnect-iOS/Runnect-iOS/{Presentation/MyPage/VC/SettingVC/LogoutVC.swift => Global/UIComponents/RNAlertVC.swift} (83%) diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 7f32d704..267f3dbe 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -21,7 +21,7 @@ A3C2CACE29E313CC00EC525B /* SettingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C2CACD29E313CC00EC525B /* SettingVC.swift */; }; A3C2CAD329E4F77C00EC525B /* TermsOfServiceVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C2CAD229E4F77C00EC525B /* TermsOfServiceVC.swift */; }; A3C2CAD529E4F85400EC525B /* PersonalInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C2CAD429E4F85400EC525B /* PersonalInfoVC.swift */; }; - A3C2CAD729E53B2900EC525B /* LogoutVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C2CAD629E53B2900EC525B /* LogoutVC.swift */; }; + A3C2CAD729E53B2900EC525B /* RNAlertVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C2CAD629E53B2900EC525B /* RNAlertVC.swift */; }; A3C2CADB29E9A12400EC525B /* DeleteAccountVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C2CADA29E9A12400EC525B /* DeleteAccountVC.swift */; }; A3D1A77929CF03D200DD54EC /* AuthRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3D1A77829CF03D200DD54EC /* AuthRouter.swift */; }; A3D1A77E29CF09B600DD54EC /* SignInResponseDto.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3D1A77D29CF09B600DD54EC /* SignInResponseDto.swift */; }; @@ -171,7 +171,7 @@ A3C2CACD29E313CC00EC525B /* SettingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingVC.swift; sourceTree = ""; }; A3C2CAD229E4F77C00EC525B /* TermsOfServiceVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TermsOfServiceVC.swift; sourceTree = ""; }; A3C2CAD429E4F85400EC525B /* PersonalInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersonalInfoVC.swift; sourceTree = ""; }; - A3C2CAD629E53B2900EC525B /* LogoutVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogoutVC.swift; sourceTree = ""; }; + A3C2CAD629E53B2900EC525B /* RNAlertVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RNAlertVC.swift; sourceTree = ""; }; A3C2CADA29E9A12400EC525B /* DeleteAccountVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeleteAccountVC.swift; sourceTree = ""; }; A3D1A77829CF03D200DD54EC /* AuthRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthRouter.swift; sourceTree = ""; }; A3D1A77D29CF09B600DD54EC /* SignInResponseDto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInResponseDto.swift; sourceTree = ""; }; @@ -391,7 +391,6 @@ A3C2CACD29E313CC00EC525B /* SettingVC.swift */, A3C2CAD229E4F77C00EC525B /* TermsOfServiceVC.swift */, A3C2CAD429E4F85400EC525B /* PersonalInfoVC.swift */, - A3C2CAD629E53B2900EC525B /* LogoutVC.swift */, A3C2CADA29E9A12400EC525B /* DeleteAccountVC.swift */, ); path = SettingVC; @@ -1032,6 +1031,7 @@ CE9291262965D0ED0010959C /* StatsInfoView.swift */, CE6B63D729673450003F900F /* ListEmptyView.swift */, CEB0BCBB29D123350048CCD5 /* GuideView.swift */, + A3C2CAD629E53B2900EC525B /* RNAlertVC.swift */, ); path = UIComponents; sourceTree = ""; @@ -1361,7 +1361,7 @@ CE40BB1C2967E4910030ABCA /* RunningWaitingVC.swift in Sources */, CE6B63D6296731F9003F900F /* ScrapCourseListView.swift in Sources */, CE6655F8295D90CF00C64E12 /* adjusted+.swift in Sources */, - A3C2CAD729E53B2900EC525B /* LogoutVC.swift in Sources */, + A3C2CAD729E53B2900EC525B /* RNAlertVC.swift in Sources */, DAD5A3E2296D4C6500C8166B /* PickedMapListResponseDto.swift in Sources */, CE4545CB295D7AF4003201E1 /* SceneDelegate.swift in Sources */, A3F67AE2296D33AC001598A2 /* MyPageDto.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/SettingVC/LogoutVC.swift b/Runnect-iOS/Runnect-iOS/Global/UIComponents/RNAlertVC.swift similarity index 83% rename from Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/SettingVC/LogoutVC.swift rename to Runnect-iOS/Runnect-iOS/Global/UIComponents/RNAlertVC.swift index d3644fc2..adcb5578 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/SettingVC/LogoutVC.swift +++ b/Runnect-iOS/Runnect-iOS/Global/UIComponents/RNAlertVC.swift @@ -10,17 +10,19 @@ import UIKit import SnapKit import Then -final class LogoutVC: UIViewController { +final class RNAlertVC: UIViewController { // MARK: - Properties + var rightButtonTapAction: (() -> Void)? + // MARK: - UI Components private let containerView = UIView().then { $0.layer.cornerRadius = 15 } - private let logoutQuestionLabel = UILabel().then { + private let DescriptionLabel = UILabel().then { $0.text = "로그아웃 하시겠어요?" $0.font = .b4 $0.textColor = .g2 @@ -54,7 +56,7 @@ final class LogoutVC: UIViewController { // MARK: - Methods -extension LogoutVC { +extension RNAlertVC { override func touchesBegan(_ touches: Set, with event: UIEvent?) { super.touchesBegan(touches, with: event) if let touch = touches.first, touch.view == self.view { @@ -64,20 +66,25 @@ extension LogoutVC { private func setAddTarget() { self.noButton.addTarget(self, action: #selector(touchUpNoButton), for: .touchUpInside) + self.yesButton.addTarget(self, action: #selector(touchYesButton), for: .touchUpInside) } } // MARK: - @objc Function -extension LogoutVC { - @objc func touchUpNoButton() { +extension RNAlertVC { + @objc private func touchUpNoButton() { dismiss(animated: false) } + + @objc private func touchYesButton() { + self.rightButtonTapAction?() + } } // MARK: - Layout Helpers -extension LogoutVC { +extension RNAlertVC { private func setUI() { view.backgroundColor = .black.withAlphaComponent(0.8) containerView.backgroundColor = .w1 @@ -93,9 +100,9 @@ extension LogoutVC { make.height.equalTo(126) } - containerView.addSubviews(logoutQuestionLabel, yesButton, noButton) + containerView.addSubviews(DescriptionLabel, yesButton, noButton) - logoutQuestionLabel.snp.makeConstraints { make in + DescriptionLabel.snp.makeConstraints { make in make.centerX.equalToSuperview() make.top.equalToSuperview().offset(26) } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/SettingVC/PersonalInfoVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/SettingVC/PersonalInfoVC.swift index 8d305225..ff084181 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/SettingVC/PersonalInfoVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/SettingVC/PersonalInfoVC.swift @@ -97,7 +97,10 @@ extension PersonalInfoVC { } private func pushToLogoutVC() { - let logoutVC = LogoutVC() + let logoutVC = RNAlertVC() + logoutVC.rightButtonTapAction = { + print("로그아웃 버튼 클릭!~~!") + } logoutVC.modalPresentationStyle = .overFullScreen self.present(logoutVC, animated: false) }