Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔀 :: [#210] 로그인 버튼 GAuth 버튼으로 리펙토링 #212

Merged
merged 9 commits into from
Nov 27, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public extension TargetDependency {
}

public extension TargetDependency.SPM {
static let GAuthSignin = TargetDependency.external(name: "GAuthSignin")
static let Lottie = TargetDependency.external(name: "Lottie")
static let Nuke = TargetDependency.external(name: "Nuke")
static let Anim = TargetDependency.external(name: "Anim")
Expand Down
3 changes: 2 additions & 1 deletion Projects/Domain/AuthDomain/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ let project = Project.module(
]),
.implements(module: .domain(.AuthDomain), dependencies: [
.domain(target: .AuthDomain, type: .interface),
.domain(target: .BaseDomain)
.domain(target: .BaseDomain),
.SPM.GAuthSignin
baekteun marked this conversation as resolved.
Show resolved Hide resolved
]),
.testing(module: .domain(.AuthDomain), dependencies: [
.domain(target: .AuthDomain, type: .interface)
Expand Down
3 changes: 2 additions & 1 deletion Projects/Feature/SigninFeature/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ let project = Project.module(
.feature(target: .SigninFeature, type: .interface),
.feature(target: .SignupFeature, type: .interface),
.feature(target: .RenewalPasswordFeature, type: .interface),
.domain(target: .AuthDomain, type: .interface)
.domain(target: .AuthDomain, type: .interface),
.SPM.GAuthSignin
]),
.tests(module: .feature(.SigninFeature), dependencies: [
.feature(target: .SigninFeature)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Localization
import MSGLayout
import UIKit
import UtilityModule
import GAuthSignin

final class SigninViewController: BaseStoredViewController<SigninStore> {
private let dotoriLogoImageView = UIImageView()
Expand All @@ -17,75 +18,43 @@ final class SigninViewController: BaseStoredViewController<SigninStore> {
.withTintColor(.dotori(.primary(.p10)))
.resize(width: 182, height: 41)
)
private let emailTextField = DotoriIconTextField(
placeholder: L10n.Signin.emailPlaceholder,
icon: .Dotori.person
)
private let passwordTextField = DotoriIconTextField(
placeholder: L10n.Signin.passwordPlaceholder,
icon: .Dotori.lock
)
.set(\.isSecureTextEntry, true)
private let renewalPasswordButton = DotoriTextButton(
L10n.Signin.findPasswordButtonTitle,
private let dotoriSubTitle = DotoriLabel(
"광주소프트웨어마이스터고\n기숙사 관리 시스템, DOTORI",
textColor: .neutral(.n20),
font: .body2
font: .subtitle2
)
.set(\.numberOfLines, 0)
.set(\.textAlignment, .center)
private let signinButton = GAuthButton(
auth: .signin,
color: .colored,
rounded: .default
)
private let signinButton = DotoriButton(text: L10n.Signin.loginButtonTitle)
.set(\.contentEdgeInsets, .vertical(16))
private let signupButton = DotoriTextButton(
L10n.Signin.signupButtonTitle,
textColor: .neutral(.n20),
font: .body2
).then {
let signupString = NSMutableAttributedString(string: $0.titleLabel?.text ?? "")
signupString.setColorForText(
textToFind: L10n.Signin.signupTitle,
withColor: .dotori(.primary(.p10))
)
$0.setAttributedTitle(signupString, for: .normal)
}

override func addView() {
view.addSubviews {
dotoriLogoImageView
emailTextField
passwordTextField
renewalPasswordButton
dotoriSubTitle
signinButton
signupButton
}
}

override func setLayout() {
MSGLayout.buildLayout {
dotoriLogoImageView.layout
.centerX(.toSuperview())
.top(.to(view.safeAreaLayoutGuide).top, .equal(20))
.top(.to(view.safeAreaLayoutGuide).top, .equal(200))
.height(41)

emailTextField.layout
dotoriSubTitle.layout
.centerX(.toSuperview())
.horizontal(.toSuperview(), .equal(20))
.top(.to(dotoriLogoImageView).bottom, .equal(30))

passwordTextField.layout
.centerX(.toSuperview())
.horizontal(.toSuperview(), .equal(20))
.top(.to(emailTextField).bottom, .equal(8))

renewalPasswordButton.layout
.trailing(.to(passwordTextField).trailing)
.top(.to(passwordTextField).bottom, .equal(8))
.top(.to(dotoriLogoImageView).bottom, .equal(20))

signinButton.layout
.centerX(.toSuperview())
.horizontal(.toSuperview(), .equal(20))
.top(.to(renewalPasswordButton).bottom, .equal(32))

signupButton.layout
.centerX(.toSuperview())
.top(.to(signinButton).bottom, .equal(16))
.bottom(.to(view.safeAreaLayoutGuide), .equal(-32))
.height(50)
}
}

Expand All @@ -98,26 +67,6 @@ final class SigninViewController: BaseStoredViewController<SigninStore> {
}

override func bindAction() {
emailTextField.textPublisher
.map(Store.Action.updateEmail)
.sink(receiveValue: store.send(_:))
.store(in: &subscription)

passwordTextField.textPublisher
.map(Store.Action.updatePassword)
.sink(receiveValue: store.send(_:))
.store(in: &subscription)

signupButton.tapPublisher
.map { Store.Action.signupButtonDidTap }
.sink(receiveValue: store.send(_:))
.store(in: &subscription)

renewalPasswordButton.tapPublisher
.map { Store.Action.renewalPasswordButtonDidTap }
.sink(receiveValue: store.send(_:))
.store(in: &subscription)

signinButton.tapPublisher
.map { Store.Action.signinButtonDidTap }
.sink(receiveValue: store.send(_:))
Expand Down
4 changes: 3 additions & 1 deletion Tuist/Dependencies.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ let dependencies = Dependencies(
carthage: nil,
swiftPackageManager: SwiftPackageManagerDependencies(
[
.remote(url: "https://github.com/GSM-MSG/GAuthSignin-Swift", requirement: .exact("0.0.3")),
.remote(url: "https://github.com/airbnb/lottie-ios.git", requirement: .exact("4.2.0")),
.remote(url: "https://github.com/kean/Nuke.git", requirement: .exact("12.1.4")),
.remote(url: "https://github.com/GSM-MSG/Anim.git", requirement: .exact("1.1.0")),
Expand All @@ -22,7 +23,8 @@ let dependencies = Dependencies(
],
productTypes: [
"Moordinator": .framework,
"CombineMiniature": .framework
"CombineMiniature": .framework,
"GAuthSignin": .framework
],
baseSettings: .settings(
configurations: [
Expand Down
Loading