Skip to content

Commit

Permalink
Merge pull request #25 from info-dsm/fature/#24-mainScreen
Browse files Browse the repository at this point in the history
메인화면을 다 만들었습니다
  • Loading branch information
jjunhaa0211 authored Jun 21, 2023
2 parents fd4a546 + 2215507 commit 8aaeabb
Show file tree
Hide file tree
Showing 23 changed files with 674 additions and 140 deletions.
28 changes: 14 additions & 14 deletions Projects/Domain/Sources/Entities/Auth/AuthEntities.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import UIKit
import INetwork

public struct AuthEntities {
let token: Token
let username: String
let email: String

init(token: Token, username: String, email: String) {
self.token = token
self.username = username
self.email = email
}
}
//import UIKit
//import INetwork
//
//public struct AuthEntities {
// let token: Token
// let username: String
// let email: String
//
// init(token: Token, username: String, email: String) {
// self.token = token
// self.username = username
// self.email = email
// }
//}
20 changes: 10 additions & 10 deletions Projects/Domain/Sources/RepositoryInterfaces/AuthRepository.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import UIKit
import RxSwift
import RxCocoa

public protocol AuthRepository {
func login(username: String, password: String, completion: @escaping (Result<AuthEntities, Error>) -> Void)
func sendCode(email: String, completion: @escaping (Result<Void, Error>) -> Void)
func checkCode(code: String, completion: @escaping (Result<Void, Error>) -> Void)
func signUp(username: String, password: String, email: String, completion: @escaping (Result<AuthEntities, Error>) -> Void)
}
//import UIKit
//import RxSwift
//import RxCocoa
//
//public protocol AuthRepository {
// func login(username: String, password: String, completion: @escaping (Result<AuthEntities, Error>) -> Void)
// func sendCode(email: String, completion: @escaping (Result<Void, Error>) -> Void)
// func checkCode(code: String, completion: @escaping (Result<Void, Error>) -> Void)
// func signUp(username: String, password: String, email: String, completion: @escaping (Result<AuthEntities, Error>) -> Void)
//}
230 changes: 115 additions & 115 deletions Projects/Domain/Sources/UseCases/AuthUseCase.swift
Original file line number Diff line number Diff line change
@@ -1,115 +1,115 @@
import Foundation
import RxSwift
import INetwork

public protocol AuthUseCase {
func login(email: String, password: String)
func sendCode(email: String)
func checkCode(email: String, data: String, type: String)
func signUp(emailCode: String, studentKey: String, name: String, email: String, password: String, githubLink: String?)
func reissueToken()
func checkTokenTime(token: String)

var authSuccess: PublishSubject<Token> { get }
var authFail: PublishSubject<Error> { get }
var codeSent: PublishSubject<Void> { get }
var codeCheckSuccess: PublishSubject<Void> { get }
var signUpSuccess: PublishSubject<Void> { get }
var tokenReissued: PublishSubject<Token> { get }
var tokenTimeChecked: PublishSubject<Int> { get }
}

public final class DefaultAuthUseCase: AuthUseCase {
private let authService: AuthService
private let disposeBag = DisposeBag()

public var authSuccess = PublishSubject<Token>()
public var authFail = PublishSubject<Error>()
public var codeSent = PublishSubject<Void>()
public var codeCheckSuccess = PublishSubject<Void>()
public var signUpSuccess = PublishSubject<Void>()
public var tokenReissued = PublishSubject<Token>()
public var tokenTimeChecked = PublishSubject<Int>()

public init(authService: AuthService) {
self.authService = authService
}

public func login(email: String, password: String) {
authService.login(email: email, password: password)
.subscribe(
onSuccess: { [weak self] token in
self?.authSuccess.onNext(token)
},
onFailure: { [weak self] error in
self?.authFail.onNext(error)
}
)
.disposed(by: disposeBag)
}

public func sendCode(email: String) {
authService.sendCode(email: email)
.subscribe(
onSuccess: { [weak self] in
self?.codeSent.onNext(())
},
onFailure: { [weak self] error in
self?.authFail.onNext(error)
}
)
.disposed(by: disposeBag)
}

public func checkCode(email: String, data: String, type: String) {
authService.checkCode(email: email, data: data, type: type)
.subscribe(
onSuccess: { [weak self] in
self?.codeCheckSuccess.onNext(())
},
onFailure: { [weak self] error in
self?.authFail.onNext(error)
}
)
.disposed(by: disposeBag)
}

public func signUp(emailCode: String, studentKey: String, name: String, email: String, password: String, githubLink: String?) {
authService.signUp(emailCode: emailCode, studentKey: studentKey, name: name, email: email, password: password, githubLink: githubLink)
.subscribe(
onSuccess: { [weak self] in
self?.signUpSuccess.onNext(())
},
onFailure: { [weak self] error in
self?.authFail.onNext(error)
}
)
.disposed(by: disposeBag)
}

public func reissueToken() {
authService.reissueToken()
.subscribe(
onSuccess: { [weak self] token in
self?.tokenReissued.onNext(token)
},
onFailure: { [weak self] error in
self?.authFail.onNext(error)
}
)
.disposed(by: disposeBag)
}

public func checkTokenTime(token: String) {
authService.checkTokenTime(token: token)
.subscribe(
onSuccess: { [weak self] remainingTime in
self?.tokenTimeChecked.onNext(remainingTime)
},
onFailure: { [weak self] error in
self?.authFail.onNext(error)
}
)
.disposed(by: disposeBag)
}
}
//import Foundation
//import RxSwift
//import INetwork
//
//public protocol AuthUseCase {
// func login(email: String, password: String)
// func sendCode(email: String)
// func checkCode(email: String, data: String, type: String)
// func signUp(emailCode: String, studentKey: String, name: String, email: String, password: String, githubLink: String?)
// func reissueToken()
// func checkTokenTime(token: String)
//
// var authSuccess: PublishSubject<Token> { get }
// var authFail: PublishSubject<Error> { get }
// var codeSent: PublishSubject<Void> { get }
// var codeCheckSuccess: PublishSubject<Void> { get }
// var signUpSuccess: PublishSubject<Void> { get }
// var tokenReissued: PublishSubject<Token> { get }
// var tokenTimeChecked: PublishSubject<Int> { get }
//}
//
//public final class DefaultAuthUseCase: AuthUseCase {
// private let authService: AuthService
// private let disposeBag = DisposeBag()
//
// public var authSuccess = PublishSubject<Token>()
// public var authFail = PublishSubject<Error>()
// public var codeSent = PublishSubject<Void>()
// public var codeCheckSuccess = PublishSubject<Void>()
// public var signUpSuccess = PublishSubject<Void>()
// public var tokenReissued = PublishSubject<Token>()
// public var tokenTimeChecked = PublishSubject<Int>()
//
// public init(authService: AuthService) {
// self.authService = authService
// }
//
// public func login(email: String, password: String) {
// authService.login(email: email, password: password)
// .subscribe(
// onSuccess: { [weak self] token in
// self?.authSuccess.onNext(token)
// },
// onFailure: { [weak self] error in
// self?.authFail.onNext(error)
// }
// )
// .disposed(by: disposeBag)
// }
//
// public func sendCode(email: String) {
// authService.sendCode(email: email)
// .subscribe(
// onSuccess: { [weak self] in
// self?.codeSent.onNext(())
// },
// onFailure: { [weak self] error in
// self?.authFail.onNext(error)
// }
// )
// .disposed(by: disposeBag)
// }
//
// public func checkCode(email: String, data: String, type: String) {
// authService.checkCode(email: email, data: data, type: type)
// .subscribe(
// onSuccess: { [weak self] in
// self?.codeCheckSuccess.onNext(())
// },
// onFailure: { [weak self] error in
// self?.authFail.onNext(error)
// }
// )
// .disposed(by: disposeBag)
// }
//
// public func signUp(emailCode: String, studentKey: String, name: String, email: String, password: String, githubLink: String?) {
// authService.signUp(emailCode: emailCode, studentKey: studentKey, name: name, email: email, password: password, githubLink: githubLink)
// .subscribe(
// onSuccess: { [weak self] in
// self?.signUpSuccess.onNext(())
// },
// onFailure: { [weak self] error in
// self?.authFail.onNext(error)
// }
// )
// .disposed(by: disposeBag)
// }
//
// public func reissueToken() {
// authService.reissueToken()
// .subscribe(
// onSuccess: { [weak self] token in
// self?.tokenReissued.onNext(token)
// },
// onFailure: { [weak self] error in
// self?.authFail.onNext(error)
// }
// )
// .disposed(by: disposeBag)
// }
//
// public func checkTokenTime(token: String) {
// authService.checkTokenTime(token: token)
// .subscribe(
// onSuccess: { [weak self] remainingTime in
// self?.tokenTimeChecked.onNext(remainingTime)
// },
// onFailure: { [weak self] error in
// self?.authFail.onNext(error)
// }
// )
// .disposed(by: disposeBag)
// }
//}
2 changes: 1 addition & 1 deletion Projects/INFO-iOS/Sources/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
window?.windowScene = scene

let moduleFactory = ModuleFactory.shared
let rootViewController = moduleFactory.signupVC()
let rootViewController = moduleFactory.tabBarVC()

window?.rootViewController = UINavigationController(rootViewController: rootViewController)
window?.makeKeyAndVisible()
Expand Down
12 changes: 12 additions & 0 deletions Projects/INFO-iOS/Sources/ModuleFactory/ModuleFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,16 @@ extension ModuleFactory: ModuleFactoryInterface {

return signupVC
}

public func tabBarVC() -> TapBarViewController {
let tabbarVC = TapBarViewController()

return tabbarVC
}

public func companyListVC() -> CompanyListViewController {
let companyListVC = CompanyListViewController()

return companyListVC
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "MOUImage.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "announcementImage.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "companyListImage.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "defaultImg.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8aaeabb

Please sign in to comment.