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

[Feat] #60 - 계정 찾기 뷰 구현 #70

Merged
merged 7 commits into from
Jan 1, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public struct I18N {
public static let findAccount = "계정 찾기"
public static let signIn = "로그인"
public static let signUp = "회원가입"
public static let findDescription = "아래 구글 폼을 제출해 주시면\n평일 기준 3-5일 이내로\n아이디 / 임시 비밀번호를 전송 드립니다."
public static let findEmail = "이메일 찾기"
public static let findPassword = "비밀번호 찾기"
}

public struct SignUp {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public protocol ModuleFactoryInterface {
func makeSplashVC() -> SplashVC
func makeOnboardingVC() -> OnboardingVC
func makeSignInVC() -> SignInVC
func makeFindAccountVC() -> FindAccountVC
func makeSignUpVC() -> SignUpVC
func makeSignUpCompleteVC() -> SignUpCompleteVC
func makeMissionListVC(sceneType: MissionListSceneType) -> MissionListVC
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
//
// FindAccountVC.swift
// Presentation
//
// Created by devxsby on 2023/01/01.
// Copyright © 2023 SOPT-Stamp-iOS. All rights reserved.
//

import UIKit
import DSKit

import Core

public class FindAccountVC: UIViewController {

// MARK: - UI Components

private lazy var naviBar = CustomNavigationBar(self, type: .titleWithLeftButton)
.setTitle(I18N.SignIn.findAccount)

private let descriptionLabel = UILabel().then {
$0.text = I18N.SignIn.findDescription
$0.textColor = DSKitAsset.Colors.gray700.color
$0.textAlignment = .left
$0.numberOfLines = 3
$0.font = UIFont.subtitle3
$0.setLineSpacing(lineSpacing: 10)
}

private lazy var findEmailButton = UIButton(type: .system).then {
$0.setTitle(I18N.SignIn.findEmail, for: .normal)
$0.addTarget(self, action: #selector(findEmailButtonDidTap), for: .touchUpInside)
}

private lazy var findPasswordButton = UIButton(type: .system).then {
$0.setTitle(I18N.SignIn.findPassword, for: .normal)
$0.addTarget(self, action: #selector(findPasswordButtonDidTap), for: .touchUpInside)
}

// MARK: - View Life Cycle

public override func viewDidLoad() {
super.viewDidLoad()
self.setUI()
self.setLayout()
}

// MARK: - @objc Function

@objc
private func findEmailButtonDidTap() {
self.openExternalLink(urlStr: "https://forms.gle/XkVFMUPsWWV1DXU38")
}

@objc
private func findPasswordButtonDidTap() {
self.openExternalLink(urlStr: "https://forms.gle/bUgTG9ooRVgPZ8K39")
}
}

// MARK: - UI & Layout

extension FindAccountVC {

private func setUI() {
self.view.backgroundColor = .white
[findEmailButton, findPasswordButton].forEach {
$0.layer.cornerRadius = 9
$0.backgroundColor = DSKitAsset.Colors.purple200.color
$0.setTitleColor(DSKitAsset.Colors.purple300.color, for: .normal)
$0.contentHorizontalAlignment = .left
$0.titleEdgeInsets = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 0)
$0.titleLabel!.setTypoStyle(.h3)
}
}

private func setLayout() {
self.view.addSubviews(naviBar, descriptionLabel, findEmailButton, findPasswordButton)

naviBar.snp.makeConstraints { make in
make.leading.top.trailing.equalTo(view.safeAreaLayoutGuide)
}

descriptionLabel.snp.makeConstraints { make in
make.top.equalTo(naviBar.snp.bottom).offset(24)
make.leading.equalToSuperview().offset(20)
}

findEmailButton.snp.makeConstraints { make in
make.top.equalTo(descriptionLabel.snp.bottom).offset(48)
make.leading.trailing.equalToSuperview().inset(20)
make.height.equalTo(56)
}

findPasswordButton.snp.makeConstraints { make in
make.top.equalTo(findEmailButton.snp.bottom).offset(12)
make.leading.trailing.equalToSuperview().inset(20)
make.height.equalTo(56)
}
}
}

// MARK: - Methods

extension FindAccountVC {

public func openExternalLink(urlStr: String, _ handler: (() -> Void)? = nil) {
guard let url = URL(string: urlStr) else {
return
}

if #available(iOS 10.0, *) {
UIApplication.shared.open(url, options: [:]) { _ in
handler?()
}
} else {
UIApplication.shared.openURL(url)
handler?()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public class SignInVC: UIViewController {

@objc
private func findAccountButtonDidTap() {
print("find account btn did tap")
// 화면전환
let findAccountVC = self.factory.makeFindAccountVC()
self.navigationController?.pushViewController(findAccountVC, animated: true)
}

@objc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ extension ModuleFactory: ModuleFactoryInterface {
return signinVC
}

public func makeFindAccountVC() -> Presentation.FindAccountVC {
let findAccountVC = FindAccountVC()
return findAccountVC
}

public func makeSignUpVC() -> Presentation.SignUpVC {
let repository = SignUpRepository(service: authService, userService: userService)
let useCase = DefaultSignUpUseCase(repository: repository)
Expand Down