From 9f0692edd11d2acd5dcea64885d90df260a5d114 Mon Sep 17 00:00:00 2001 From: junha Date: Tue, 7 Nov 2023 18:29:58 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=8A::=20[#49]=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20=EC=BD=94=EB=93=9C=20=EB=A6=AC=ED=8E=99=ED=86=A0?= =?UTF-8?q?=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppLoginImpl/Views/LoginInteractor.swift | 3 -- .../Views/LoginViewController.swift | 46 +++++++++++-------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/Features/User/Auth/Login/LoginUserInterface/Implement/AppLoginImpl/Views/LoginInteractor.swift b/Features/User/Auth/Login/LoginUserInterface/Implement/AppLoginImpl/Views/LoginInteractor.swift index 6b142e0..d259f40 100644 --- a/Features/User/Auth/Login/LoginUserInterface/Implement/AppLoginImpl/Views/LoginInteractor.swift +++ b/Features/User/Auth/Login/LoginUserInterface/Implement/AppLoginImpl/Views/LoginInteractor.swift @@ -37,7 +37,6 @@ final class LoginInteractor: PresentableInteractor, } -//로직 처리 함수 extension LoginInteractor { func loginButtonDidTap(email: String, password: String) { @@ -67,12 +66,10 @@ extension LoginInteractor { } else { textfield.passwordErrorType = .notMatch print("비밀번호가 올바르지 않습니다.") -// fatalError("비밀번호가 올바르지 않습니다.") } } } -//로직 함수 extension LoginInteractor { func checkGmailFormat(emailText: String?) -> Bool { diff --git a/Features/User/Auth/Login/LoginUserInterface/Implement/AppLoginImpl/Views/LoginViewController.swift b/Features/User/Auth/Login/LoginUserInterface/Implement/AppLoginImpl/Views/LoginViewController.swift index f702bad..8950221 100644 --- a/Features/User/Auth/Login/LoginUserInterface/Implement/AppLoginImpl/Views/LoginViewController.swift +++ b/Features/User/Auth/Login/LoginUserInterface/Implement/AppLoginImpl/Views/LoginViewController.swift @@ -4,7 +4,6 @@ import SnapKit import Then import RxCocoa import RxSwift -import Kingfisher import LoginUserInterface import SuperUI import DesignSystem @@ -27,16 +26,16 @@ public final class LoginViewContoller: BaseViewController, LoginPresentable, Log $0.isSecureTextEntry = true } + public lazy var doubleButton = MonsterDoubleTextButton(title1: "비밀번호 찾기", title2: "아이디 찾기", thintColor: .black, backgroundColor: .clear) + public lazy var nextButton = MonsterButton(title: "다음", backgorundColor: .gray, titleColor: .white) public var uiviewController: UIViewController { return self } - public let loginView = LoginView() - - public init() { - super.init(nibName: nil, bundle: nil) + public override init() { + super.init() self.textFieldBind() self.buttonBind() self.keyboardBind() @@ -57,7 +56,8 @@ public final class LoginViewContoller: BaseViewController, LoginPresentable, Log titleLabel, idTextField, passwordTextField, - nextButton + nextButton, + doubleButton ].forEach { view.addSubview($0) } titleLabel.snp.makeConstraints { @@ -88,6 +88,11 @@ public final class LoginViewContoller: BaseViewController, LoginPresentable, Log $0.right.left.equalToSuperview().inset(20.0) $0.height.equalTo(48.0) } + + doubleButton.snp.makeConstraints { + $0.leading.equalTo(passwordTextField.snp.leading) + $0.bottom.equalTo(nextButton.snp.top).offset(-20.0) + } } private func attrebute() { @@ -96,15 +101,17 @@ public final class LoginViewContoller: BaseViewController, LoginPresentable, Log } private func textFieldBind() { + let idTextFieldObservable = idTextField.rx.text.orEmpty + let passwordTextFieldObservable = passwordTextField.rx.text.orEmpty - let inputTextObservable = idTextField.rx.text.orEmpty - - inputTextObservable - .map { !$0.isEmpty } + Observable.combineLatest(idTextFieldObservable, passwordTextFieldObservable) + .map { idText, passwordText in + return !idText.isEmpty && !passwordText.isEmpty + } .bind(to: nextButton.rx.isEnabled) .disposed(by: disposeBag) - - inputTextObservable + + idTextFieldObservable .map { text in text.isEmpty ? UIColor.gray : UIColor.black } @@ -113,7 +120,7 @@ public final class LoginViewContoller: BaseViewController, LoginPresentable, Log self?.nextButton.backgroundColor = backgroundColor }) .disposed(by: disposeBag) - + idTextField.rx.controlEvent(.editingChanged) .subscribe(onNext: { [weak self] in if let text = self?.idTextField.text, text.count > 30 { @@ -121,8 +128,8 @@ public final class LoginViewContoller: BaseViewController, LoginPresentable, Log } }) .disposed(by: disposeBag) - - inputTextObservable + + idTextFieldObservable .subscribe(onNext: { [weak self] text in self?.listener?.checkGmailTextField(textfield: self?.idTextField ?? MonsterTextField()) }) @@ -139,8 +146,9 @@ public final class LoginViewContoller: BaseViewController, LoginPresentable, Log Observable.merge(keyboardWillShowObservable) .subscribe(onNext: { [weak self] height in self?.nextButton.snp.updateConstraints { - $0.left.right.equalToSuperview() $0.bottom.equalToSuperview().offset(-height) + $0.left.equalToSuperview() + $0.right.equalToSuperview() } self?.nextButton.layer.cornerRadius = 0 UIView.animate(withDuration: 0.3) { @@ -153,10 +161,10 @@ public final class LoginViewContoller: BaseViewController, LoginPresentable, Log .subscribe(onNext: { [weak self] _ in self?.nextButton.snp.updateConstraints { $0.bottom.equalToSuperview().inset(48.0) - $0.right.left.equalToSuperview().inset(20.0) + $0.left.equalToSuperview().inset(20.0) + $0.right.equalToSuperview().inset(20.0) } self?.nextButton.layer.cornerRadius = 8.0 - UIView.animate(withDuration: 0.3) { self?.view.layoutIfNeeded() } @@ -164,8 +172,6 @@ public final class LoginViewContoller: BaseViewController, LoginPresentable, Log .disposed(by: disposeBag) } - - private func buttonBind() { nextButton.rx.tap .subscribe(onNext: { [weak self] _ in