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

Feature/sign in #69

Merged
merged 32 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
bb33dae
fix: SignInUserInterface MOITWeb Interface dependency ์ถ”๊ฐ€
hope1053 Jul 11, 2023
e3bed94
feat: SignInWeb attach ๋กœ์ง
hope1053 Jul 11, 2023
2f6f7ec
feat: cookie ๋ฐ token ์ฒ˜๋ฆฌ ๋กœ์ง
hope1053 Jul 12, 2023
4180801
feat: ์ธ์ฆ ํ›„ ๋กœ์ง ์ฒ˜๋ฆฌ
hope1053 Jul 12, 2023
54ab6a3
feat: ๋กœ๊ทธ์ธ ํ›„ routing ๋กœ์ง ๊ตฌํ˜„ ์ค‘
hope1053 Jul 12, 2023
62ffd8a
feat: Authorization ์ง„ํ–‰ ํ›„ HeaderField๊ฐ’ ์ „๋‹ฌ
hope1053 Jul 13, 2023
531b79d
feat: SignIn Dependency ์ถ”๊ฐ€
hope1053 Jul 13, 2023
926d752
feat: ํšŒ์›๊ฐ€์ž…ํ•˜์ง€์•Š์€ ํšŒ์› ์ธ์ฆ ์ข…๋ฃŒ ํ›„ ํšŒ์›๊ฐ€์ž…์œผ๋กœ ์ด๋™ ๋กœ์ง
hope1053 Jul 13, 2023
a55daa3
feat: Dependency ์ถ”๊ฐ€
hope1053 Jul 13, 2023
8edab18
feat: SignIn, SignUp ์—ฐ๊ฒฐ demoapp ๊ตฌํ˜„
hope1053 Jul 13, 2023
b297a4a
fix: dependency ๋ฐ bundle version ์ˆ˜์ •
hope1053 Jul 14, 2023
f27a056
fix: MOITWeb detach์‹œ memory leak ๋ฐœ์ƒํ•˜๋Š” ํ˜„์ƒ ์ˆ˜์ •
hope1053 Jul 14, 2023
c7c9dce
refactor: SignIn, SignUp โ†’ Auth ๋ชจ๋“ˆ๋กœ ํ•ฉ์น˜๋Š” ์ž‘์—… ์ค‘
hope1053 Jul 14, 2023
4036e21
refactor: SignIn, SignUp โ†’ Auth ๋ชจ๋“ˆ๋กœ ํ†ต์ผ
hope1053 Jul 14, 2023
8e2a759
remove: ์‚ฌ์šฉํ•˜์ง€์•Š๋Š” ํŒŒ์ผ ์‚ญ์ œ
hope1053 Jul 14, 2023
615236d
feat: SignInResponse SignUp RIB์œผ๋กœ ์ „๋‹ฌ
hope1053 Jul 15, 2023
02274bc
feat: redirectURL ๋ฉ”์„œ๋“œ ๋ถ„๋ฆฌ
hope1053 Jul 15, 2023
884f7ea
feat: TokenManager ๋ชจ๋“ˆ ์ƒ์„ฑ
hope1053 Jul 17, 2023
2a9bed4
feat: TokenManagerImpl ๊ตฌํ˜„
hope1053 Jul 17, 2023
00d8b4e
feat: TokenManager ๋กœ์ง ๊ตฌํ˜„
hope1053 Jul 17, 2023
2364117
fix: ์ฝ”๋“œ ๊ฐœ์„ 
hope1053 Jul 17, 2023
c7de10f
fix: TODO ์‚ญ์ œ
hope1053 Jul 17, 2023
7c598ef
fix: ์ฃผ์„ ์‚ญ์ œ
hope1053 Jul 17, 2023
4822b14
Squashed commit of the following:
hope1053 Jul 17, 2023
4242796
Squashed commit of the following:
hope1053 Jul 17, 2023
41eac9b
Merge branch 'develop' into feature/sign-in
hope1053 Jul 17, 2023
98fa3a3
Merge branch 'develop' into feature/sign-in
hope1053 Jul 23, 2023
01a3bf1
fix: router attach ๋ฐ ํ• ๋‹น๊ณผ view present ์ˆœ์„œ ๋ณ€๊ฒฝ
hope1053 Jul 26, 2023
cd99eaa
feat: authorization token ๋นˆ๊ฐ’์œผ๋กœ ์˜ค๋Š” ๊ฒฝ์šฐ errorAlert ๋„์šฐ๋Š” ๋™์ž‘ ์ถ”๊ฐ€
hope1053 Jul 26, 2023
5902acd
feat: SaveTokenUseCase ์ถ”๊ฐ€
hope1053 Jul 26, 2023
a4a0ca7
feat: token ์ €์žฅ ํ”„๋กœ์„ธ์Šค UseCase๋กœ ๋ถ„๋ฆฌ
hope1053 Jul 26, 2023
d5e3609
Merge branch 'develop' into feature/sign-in
hope1053 Jul 26, 2023
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
@@ -1,7 +1,7 @@
//
// SignInAppDelegate.swift
// AuthAppDelegate.swift
//
// SignIn
// Auth
//
// Created by hyerin
//
Expand All @@ -11,10 +11,11 @@ import ProjectDescriptionHelpers
import UtilityPlugin

let project = Project.invertedDualTargetProject(
name: "SignInData",
name: "AuthData",
platform: .iOS,
iOSTargetVersion: "16.0.0",
interfaceDependencies: [
.ThirdParty.RxSwift
],
implementDependencies: [
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

import SignUpDomain
import AuthDomain

public final class FetchRandomNumberUseCaseImpl: FetchRandomNumberUseCase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

import Foundation

import SignUpData
import SignUpDomain
import AuthData
import AuthDomain

import RxSwift

Expand Down
24 changes: 24 additions & 0 deletions Features/Auth/AuthDomain/Interface/Model/MOITSignInResponse.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// MOITSignInResponse.swift
// MOITWeb
//
// Created by ์ตœํ˜œ๋ฆฐ on 2023/07/12.
// Copyright ยฉ 2023 chansoo.MOIT. All rights reserved.
//

import Foundation
import WebKit

public struct MOITSignInResponse {
let providerUniqueKey: String
let nickname: String
let email: String

public init(
headerFields: [AnyHashable : Any]
) {
self.providerUniqueKey = headerFields["X-MOIT-USER-PROVIDER"] as? String ?? ""
self.nickname = headerFields["X-MOIT-USER-NICKNAME"] as? String ?? ""
self.email = headerFields["X-MOIT-USER-EMAIL"] as? String ?? ""
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// SignInAppDelegate.swift
// AuthAppDelegate.swift
//
// SignIn
// Auth
//
// Created by hyerin
//
Expand All @@ -11,10 +11,11 @@ import ProjectDescriptionHelpers
import UtilityPlugin

let project = Project.invertedDualTargetProject(
name: "SignInDomain",
name: "AuthDomain",
platform: .iOS,
iOSTargetVersion: "16.0.0",
interfaceDependencies: [
.ThirdParty.RxSwift
],
implementDependencies: [
]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// AuthAppDelegate.swift
//
// Auth
//
// Created by hyerin on .
//

import UIKit

import AuthUserInterface
import AuthUserInterfaceImpl
import AuthDomain
import AuthDomainImpl
import AuthData

import RIBs
import RxSwift

@main
final class AuthAppDelegate: UIResponder, UIApplicationDelegate {

private final class MockSignInListener: LoggedOutListener { }

var window: UIWindow?
private var router: ViewableRouting?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let window = UIWindow(frame: UIScreen.main.bounds)

router = LoggedOutBuilder(dependency: MOCKAuthComponent())
.build(withListener: MockSignInListener())
router?.interactable.activate()
router?.load()

window.rootViewController = self.router?.viewControllable.uiviewController
window.makeKeyAndVisible()
self.window = window

return true
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//
// MockComponent.swift
// AuthUserInterfaceDemoApp
//
// Created by ์ตœํ˜œ๋ฆฐ on 2023/07/14.
// Copyright ยฉ 2023 chansoo.MOIT. All rights reserved.
//

import Foundation

import AuthUserInterface
import AuthUserInterfaceImpl
import AuthDomain
import AuthDomainImpl
import AuthData
import MOITWeb
import MOITWebImpl
import TokenManager
import TokenManagerImpl

import RIBs
import RxSwift

final class MOCKAuthComponent: Component<EmptyDependency>,
LoggedOutDependency,
ProfileSelectDependency,
SignUpDependency,
MOITWebDependency,
LoggedOutInteractorDependency {

init() {
super.init(dependency: EmptyComponent())
}

var fetchRandomNumberUseCase: FetchRandomNumberUseCase = FetchRandomNumberUseCaseImpl()

var postJoinInfoUseCase: PostJoinInfoUseCase = PostJoinInfoUseCaseImpl(joinRepository: MockJoinRepository())

var tokenManager: TokenManager = TokenManagerImpl()

lazy var profileSelectBuildable: ProfileSelectBuildable = {
return ProfileSelectBuilder(dependency: self)
}()

lazy var signUpBuildable: SignUpBuildable = {
return SignUpBuilder(dependency: self)
}()

lazy var moitWebBuildable: MOITWebBuildable = {
return MOITWebBuilder(dependency: self)
}()
}

final class MockJoinRepository: JoinRepository {

func post(imageIndex: Int, name: String, inviteCode: String?) -> Single<Int> {
Single.just(3)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
// Copyright ยฉ 2023 chansoo.MOIT. All rights reserved.
//

import SignInUserInterface
import Foundation

import RIBs
import AuthUserInterface
import TokenManager

public protocol LoggedOutDependency: Dependency {
}
import RIBs

final class LoggedOutComponent: Component<LoggedOutDependency> {
final class LoggedOutComponent: Component<LoggedOutDependency>,
LoggedOutInteractorDependency {
var tokenManager: TokenManager { dependency.tokenManager }
}

// MARK: - Builder
Expand All @@ -27,8 +29,17 @@ public final class LoggedOutBuilder: Builder<LoggedOutDependency>, LoggedOutBuil
public func build(withListener listener: LoggedOutListener) -> ViewableRouting {
let component = LoggedOutComponent(dependency: dependency)
let viewController = LoggedOutViewController()
let interactor = LoggedOutInteractor(presenter: viewController)
let interactor = LoggedOutInteractor(
presenter: viewController,
dependency: component
)
interactor.listener = listener
return LoggedOutRouter(interactor: interactor, viewController: viewController)

return LoggedOutRouter(
interactor: interactor,
viewController: viewController,
signInWebBuildable: dependency.moitWebBuildable,
signUpBuildable: dependency.signUpBuildable
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,39 @@
// Copyright ยฉ 2023 chansoo.MOIT. All rights reserved.
//

import AuthUserInterface
import AuthDomain
import TokenManager

import RIBs
import RxSwift

import CSLogger
import SignInUserInterface

protocol LoggedOutRouting: ViewableRouting {
func attachSignInWeb()
func detachSignInWeb()
func routeToSignUp(with response: MOITSignInResponse)
}

protocol LoggedOutPresentable: Presentable {
var listener: LoggedOutPresentableListener? { get set }
}

public protocol LoggedOutInteractorDependency: AnyObject {
var tokenManager: TokenManager { get }
}

final class LoggedOutInteractor: PresentableInteractor<LoggedOutPresentable>, LoggedOutInteractable, LoggedOutPresentableListener {

weak var router: LoggedOutRouting?
weak var listener: LoggedOutListener?

private let dependency: LoggedOutInteractorDependency

override init(presenter: LoggedOutPresentable) {
init(
presenter: LoggedOutPresentable,
dependency: LoggedOutInteractorDependency
) {
self.dependency = dependency
super.init(presenter: presenter)
presenter.listener = self
}
Expand All @@ -38,10 +52,21 @@ final class LoggedOutInteractor: PresentableInteractor<LoggedOutPresentable>, Lo
}

func kakaoSignInButtonDidTap() {
CSLogger.Logger.debug("kakaoSignIn")
router?.attachSignInWeb()
}

func appleSignInButtonDidTap() {
CSLogger.Logger.debug("appleSignIn")
// CSLogger.Logger.debug("appleSignIn")
}

// MARK: - MOITWeb
func shouldDetach(withPop: Bool) { }

func authorizationDidFinish(with signInResponse: MOITSignInResponse) {
router?.routeToSignUp(with: signInResponse)
}

func didSignIn(with token: String) {
dependency.tokenManager.save(token: token, with: .authorizationToken)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด ๋ถ€๋ถ„ usecase ํ•˜๋‚˜ ๋งŒ๋“ค์–ด์„œ ์ฒ˜๋ฆฌํ•ด๋„ ๊ดœ์ฐฎ์„ ๊ฒƒ ๊ฐ™์•„์š”!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chansooo ์˜ค ์ฐธ๊ณ ํ•ด์„œ ์ˆ˜์ •ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ท!

}
Loading
Loading