diff --git a/.gitignore b/.gitignore
index 43cede3..daf0d8a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -80,6 +80,7 @@ Tuist/Dependencies
.AppleDouble
.LSOverride
*.xcconfig
+Release.xcconfig
# Icon must end with two \r
Icon
diff --git a/Projects/App/Support/Info.plist b/Projects/App/Support/Info.plist
index d5e0df7..998fe29 100644
--- a/Projects/App/Support/Info.plist
+++ b/Projects/App/Support/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
$(PRODUCT_BUNDLE_PACKAGE_TYPE)
CFBundleShortVersionString
- 1.5.1
+ 1.5.2
CFBundleVersion
1
CloudTypeBaseURL
diff --git a/Projects/Feature/Sources/Scene/Auth/SignIn/SignInViewController.swift b/Projects/Feature/Sources/Scene/Auth/SignIn/SignInViewController.swift
index 6086a96..86a8ce1 100644
--- a/Projects/Feature/Sources/Scene/Auth/SignIn/SignInViewController.swift
+++ b/Projects/Feature/Sources/Scene/Auth/SignIn/SignInViewController.swift
@@ -10,7 +10,7 @@ import UIKit
import Service
public final class SignInViewController: BaseViewController {
-
+
// MARK: - Properties
private var viewModel = AuthViewModel()
private var listModel : StudentListModel?
@@ -18,36 +18,36 @@ public final class SignInViewController: BaseViewController {
private let notificationViewModel = NotificationViewModel()
private let loader = LoaderViewController()
-
+
init(viewModel: AuthViewModel) {
self.viewModel = viewModel
super.init(nibName: nil, bundle: nil)
}
-
+
init(listModel: StudentListModel) {
self.listModel = listModel
super.init(nibName: nil, bundle: nil)
}
-
+
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
-
+
private lazy var textFieldStackView = UIStackView().then {
$0.spacing = 24
$0.axis = .vertical
$0.distribution = .fillEqually
$0.alignment = .fill
}
-
+
private let emailTextField = GOMSTextField(frame: CGRect(x: 0, y: 0, width: 0, height: 0), placeholder: "이메일")
-
+
private let defaultDomain = UILabel().then {
$0.text = "@gsm.hs.kr"
$0.font = .pretendard(size: 16, weight: .regular)
$0.textColor = .color.gomsTertiary.color
}
-
+
private let emailErrorLabel = UILabel().then {
$0.text = "존재하지 않는 이메일입니다."
$0.textColor = .color.gomsNegative.color
@@ -60,19 +60,19 @@ public final class SignInViewController: BaseViewController {
$0.rightView = showPasswordButton
$0.rightViewMode = .always
}
-
+
lazy var showPasswordButton = UIButton().then {
$0.setImage(.image.visible.image, for: .normal)
$0.addTarget(self, action: #selector(showPasswordButtonTapped), for: .touchUpInside)
$0.isEnabled = true
}
-
+
private let findPasswordLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 0, height: 48)).then {
$0.text = "비밀번호를 잊으셨나요?"
$0.textColor = .color.gomsTertiary.color
$0.font = .pretendard(size: 16, weight: .regular)
}
-
+
private lazy var findPasswordButton = UIButton().then {
$0.setTitle("비밀번호 찾기", for: .normal)
$0.backgroundColor = .clear
@@ -80,32 +80,32 @@ public final class SignInViewController: BaseViewController {
$0.setTitleColor(.color.gomsInformation.color, for: .normal)
$0.addTarget(self, action: #selector(findPasswordButtonTapped), for: .touchUpInside)
}
-
+
private let passwordErrorLabel = UILabel().then {
$0.text = "잘못된 비밀번호입니다."
$0.textColor = .color.gomsNegative.color
$0.font = .pretendard(size: 16, weight: .medium)
$0.isHidden = true
}
-
+
private lazy var signInButton = GOMSButton(frame: CGRect(x: 0, y: 0, width: 0, height: 0), title: "로그인").then {
$0.addTarget(self, action: #selector(signInButtonTapped), for: .touchUpInside)
}
-
+
// MARK: - Life Cycel
public override func viewDidLoad() {
super.viewDidLoad()
-
+
emailTextField.delegate = self
passwordTextField.delegate = self
}
-
+
// MARK: - Seletors
@objc func findPasswordButtonTapped() {
let findPasswordVC = FindPasswordViewController(viewModel: self.viewModel)
navigationController?.pushViewController(findPasswordVC, animated: true)
}
-
+
private var isTransitioning = false
@objc func signInButtonTapped() {
@@ -130,32 +130,37 @@ public final class SignInViewController: BaseViewController {
guard let self = self else { return }
if success {
- if self.isTransitioning {
- return
- }
-
- self.isTransitioning = true
-
if let authority = self.profileModel.profileInfo?.authority {
+ var rootVC: UIViewController
+
if authority == Authority.admin.rawValue {
- let mainVC = AdminMainViewController()
- self.navigationController?.setViewControllers([mainVC], animated: true)
+ rootVC = AdminMainViewController()
} else if authority == Authority.student.rawValue {
- let mainVC = MainViewController()
- self.navigationController?.setViewControllers([mainVC], animated: true)
+ rootVC = MainViewController()
} else {
print("권한이 없습니다.")
+ self.loader.dismiss(animated: true)
+ return
+ }
+
+ /// 🔥 rootViewController 직접 교체
+ if let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
+ let window = scene.windows.first {
+ window.rootViewController = UINavigationController(rootViewController: rootVC)
+ window.makeKeyAndVisible()
}
}
} else {
print("프로필 정보를 불러오는데 실패했습니다.")
}
+
self.loader.dismiss(animated: true)
- self.isTransitioning = false
}
+
case 400:
self.passwordErrorUI()
self.loader.dismiss(animated: true)
+
case 404:
self.emailErrorUI()
self.loader.dismiss(animated: true)
@@ -168,17 +173,18 @@ public final class SignInViewController: BaseViewController {
}
}
+
@objc func showPasswordButtonTapped() {
passwordTextField.isSecureTextEntry.toggle()
showPasswordButton.isSelected.toggle()
-
+
if showPasswordButton.isSelected {
showPasswordButton.setImage(.image.invisible.image, for: .normal)
} else {
showPasswordButton.setImage(.image.visible.image, for: .normal)
}
}
-
+
@objc override func keyboardWillShow(_ sender: Notification) {
self.signInButton.isEnabled = true
signInButton.snp.remakeConstraints {
@@ -188,10 +194,10 @@ public final class SignInViewController: BaseViewController {
$0.bottom.equalTo(-bounds.height * 0.43)
}
}
-
+
@objc override func keyboardWillHide(_ sender: Notification) {
self.signInButton.isEnabled = true
-
+
signInButton.snp.makeConstraints {
$0.height.equalTo(48)
$0.leading.equalTo(bounds.width * 0.05)
@@ -199,7 +205,7 @@ public final class SignInViewController: BaseViewController {
$0.bottom.equalTo(-bounds.height * 0.16)
}
}
-
+
func signInSuccessUI() {
emailTextField.setPlaceholderColor(.color.gomsTertiary.color)
defaultDomain.textColor = .color.gomsTertiary.color
@@ -210,7 +216,7 @@ public final class SignInViewController: BaseViewController {
findPasswordLabel.isHidden = false
passwordTextField.layer.borderColor = UIColor.clear.cgColor
passwordTextField.layer.borderWidth = 0
-
+
passwordTextField.snp.remakeConstraints {
$0.height.equalTo(56)
$0.leading.equalTo(bounds.width * 0.05)
@@ -218,7 +224,7 @@ public final class SignInViewController: BaseViewController {
$0.top.equalTo(emailTextField.snp.bottom).offset(24)
}
}
-
+
func emailErrorUI() {
emailTextField.setPlaceholderColor(.color.gomsNegative.color)
defaultDomain.textColor = .color.gomsNegative.color
@@ -229,7 +235,7 @@ public final class SignInViewController: BaseViewController {
findPasswordLabel.isHidden = false
passwordTextField.layer.borderColor = UIColor.clear.cgColor
passwordTextField.layer.borderWidth = 0
-
+
passwordTextField.snp.remakeConstraints {
$0.height.equalTo(48)
$0.leading.equalTo(bounds.width * 0.05)
@@ -237,7 +243,7 @@ public final class SignInViewController: BaseViewController {
$0.top.equalTo(emailErrorLabel.snp.bottom).offset(24)
}
}
-
+
func passwordErrorUI() {
passwordTextField.setPlaceholderColor(.color.gomsNegative.color)
passwordErrorLabel.isHidden = false
@@ -249,7 +255,7 @@ public final class SignInViewController: BaseViewController {
emailErrorLabel.isHidden = true
emailTextField.layer.borderColor = UIColor.clear.cgColor
emailTextField.layer.borderWidth = 0
-
+
passwordTextField.snp.remakeConstraints {
$0.height.equalTo(56)
$0.leading.equalTo(bounds.width * 0.05)
@@ -257,20 +263,20 @@ public final class SignInViewController: BaseViewController {
$0.top.equalTo(emailTextField.snp.bottom).offset(24)
}
}
-
+
// MARK: - Navigaiton
override func configNavigation() {
super.configNavigation()
navigationController?.navigationBar.prefersLargeTitles = true
navigationItem.title = "로그인"
}
-
+
// MARK: - Add View
override func addView() {
emailTextField.addSubview(defaultDomain)
[emailTextField, emailErrorLabel, passwordTextField, passwordErrorLabel, findPasswordLabel, findPasswordButton, signInButton].forEach { view.addSubview($0) }
}
-
+
// MARK: - Layout
override func setLayout() {
defaultDomain.snp.makeConstraints {
@@ -278,45 +284,45 @@ public final class SignInViewController: BaseViewController {
$0.height.equalTo(28)
$0.centerY.equalToSuperview()
}
-
+
emailTextField.snp.makeConstraints {
$0.leading.equalTo(bounds.width * 0.05)
$0.trailing.equalTo(-bounds.width * 0.05)
$0.top.equalTo(bounds.height * 0.2)
$0.height.equalTo(56)
}
-
+
emailErrorLabel.snp.makeConstraints {
$0.leading.equalTo(emailTextField.snp.leading)
$0.height.equalTo(48)
$0.top.equalTo(emailTextField.snp.bottom)
}
-
+
passwordTextField.snp.makeConstraints {
$0.height.equalTo(56)
$0.leading.equalTo(bounds.width * 0.05)
$0.trailing.equalTo(-bounds.width * 0.05)
$0.top.equalTo(emailTextField.snp.bottom).offset(24)
}
-
+
findPasswordLabel.snp.makeConstraints {
$0.height.equalTo(48)
$0.top.equalTo(passwordTextField.snp.bottom)
$0.leading.equalTo(bounds.width * 0.07)
}
-
+
passwordErrorLabel.snp.makeConstraints {
$0.height.equalTo(48)
$0.top.equalTo(passwordTextField.snp.bottom)
$0.leading.equalTo(bounds.width * 0.07)
}
-
+
findPasswordButton.snp.makeConstraints {
$0.height.equalTo(48)
$0.trailing.equalTo(-bounds.width * 0.07)
$0.top.equalTo(passwordTextField.snp.bottom)
}
-
+
signInButton.snp.makeConstraints {
$0.height.equalTo(48)
$0.leading.equalTo(bounds.width * 0.05)
@@ -335,22 +341,22 @@ extension SignInViewController: UITextFieldDelegate {
viewModel.setupPassword(password: textField.text ?? "")
}
}
-
+
public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
let currentText = (textField.text ?? "") as NSString
let updatedText = currentText.replacingCharacters(in: range, with: string)
-
+
if textField == emailTextField {
return updatedText.count <= 6 && updatedText.rangeOfCharacter(from: .whitespaces) == nil
}
-
+
if textField == passwordTextField {
return updatedText.rangeOfCharacter(from: .whitespaces) == nil
}
-
+
return true
}
-
+
public func textFieldShouldReturn(_ textField: UITextField) -> Bool {
if emailTextField.text != "", passwordTextField.text != "" {
passwordTextField.resignFirstResponder()