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

๐Ÿ”€ :: (#435) ๋„๋ฉ”์ธ ๋ชจ๋“ˆ ๋ถ„๋ฆฌ 3์ฐจ #452

Merged
merged 4 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions Projects/App/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ let targets: [Target] = [
.Project.Features.RootFeature,
.Project.Module.ThirdPartyLib,
.Project.Service.Data,
TargetDependency.domain(target: .AppDomain),
TargetDependency.domain(target: .ArtistDomain)
.domain(target: .AppDomain),
.domain(target: .ArtistDomain),
.domain(target: .AuthDomain)
],
settings: .settings(
base: env.baseSetting,
Expand Down
5 changes: 2 additions & 3 deletions Projects/App/Sources/Application/AppComponent+Auth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
// Copyright ยฉ 2023 yongbeomkwak. All rights reserved.
//

import AuthDomain
import AuthDomainInterface
import CommonFeature
import DataModule
import DomainModule
import NetworkModule
import SignInFeature
import StorageFeature

Expand Down
2 changes: 2 additions & 0 deletions Projects/App/Sources/Application/NeedleGenerated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import AppDomainInterface
import ArtistDomain
import ArtistDomainInterface
import ArtistFeature
import AuthDomain
import AuthDomainInterface
import BaseFeature
import ChartFeature
import CommonFeature
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import DataMappingModule
import DomainModule
import ErrorModule
import Foundation
import RxSwift

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

import Foundation

public enum ProviderType: String, Codable {
public enum ProviderType: String {
case naver
case apple
case google
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import DataMappingModule
import ErrorModule
import Foundation
import RxSwift

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import DataMappingModule
import Foundation
import RxSwift

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import DataMappingModule
import Foundation
import RxSwift

Expand Down
21 changes: 21 additions & 0 deletions Projects/Domains/AuthDomain/Project.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import DependencyPlugin
import ProjectDescription
import ProjectDescriptionHelpers

let project = Project.module(
name: ModulePaths.Domain.AuthDomain.rawValue,
targets: [
.interface(module: .domain(.AuthDomain)),
.implements(
module: .domain(.AuthDomain),
dependencies: [
.domain(target: .BaseDomain),
.domain(target: .AuthDomain, type: .interface)
]
),
.tests(
module: .domain(.AuthDomain),
dependencies: [.domain(target: .AuthDomain)]
)
]
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DataMappingModule
import AuthDomainInterface
import BaseDomain
import ErrorModule
import Foundation
import KeychainModule
import Moya

public enum AuthAPI {
Expand Down Expand Up @@ -53,7 +53,7 @@ extension AuthAPI: WMAPI {

public var headers: [String: String]? {
switch self {
case let .fetchNaverUserInfo(tokenType: tokenType, accessToken: accessToken):
case let .fetchNaverUserInfo(tokenType, accessToken):
return ["Authorization": "\(tokenType) \(accessToken)"]
default:
return ["Content-Type": "application/json"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import APIKit
import DataMappingModule
import DomainModule
import ErrorModule
import AuthDomainInterface
import BaseDomain
import Foundation
import RxSwift

Expand All @@ -12,8 +10,7 @@ public final class RemoteAuthDataSourceImpl: BaseRemoteDataSource<AuthAPI>, Remo
.map { $0.toDomain() }
}

public func fetchNaverUserInfo(tokenType: String, accessToken: String) -> RxSwift
.Single<DomainModule.NaverUserInfoEntity> {
public func fetchNaverUserInfo(tokenType: String, accessToken: String) -> Single<NaverUserInfoEntity> {
request(.fetchNaverUserInfo(tokenType: tokenType, accessToken: accessToken))
.map(NaverUserInfoResponseDTO.self)
.map { $0.toDomain() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@
// Copyright ยฉ 2023 yongbeomkwak. All rights reserved.
//

import DatabaseModule
import DataMappingModule
import DomainModule
import ErrorModule
import NetworkModule
import AuthDomainInterface
import RxSwift

public struct AuthRepositoryImpl: AuthRepository {
public final class AuthRepositoryImpl: AuthRepository {
private let remoteAuthDataSource: any RemoteAuthDataSource

public init(remoteAuthDataSource: RemoteAuthDataSource) {
Expand All @@ -24,8 +20,7 @@ public struct AuthRepositoryImpl: AuthRepository {
remoteAuthDataSource.fetchToken(token: token, type: type)
}

public func fetchNaverUserInfo(tokenType: String, accessToken: String) -> RxSwift
.Single<DomainModule.NaverUserInfoEntity> {
public func fetchNaverUserInfo(tokenType: String, accessToken: String) -> Single<NaverUserInfoEntity> {
remoteAuthDataSource.fetchNaverUserInfo(tokenType: tokenType, accessToken: accessToken)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@
// Copyright ยฉ 2023 yongbeomkwak. All rights reserved.
//

import AuthDomainInterface
import Foundation

public struct AuthLoginResponseDTO: Codable, Equatable {
public struct AuthLoginResponseDTO: Decodable, Equatable {
public let token: String

public static func == (lhs: Self, rhs: Self) -> Bool {
return lhs.token == rhs.token
}
}

public extension AuthLoginResponseDTO {
func toDomain() -> AuthLoginEntity {
AuthLoginEntity(
token: token
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@
// Copyright ยฉ 2023 yongbeomkwak. All rights reserved.
//

import AuthDomainInterface
import Foundation

public struct NaverUserInfoResponseDTO: Codable, Equatable {
public struct NaverUserInfoResponseDTO: Decodable, Equatable {
public let resultcode, message: String
public let response: Response

public static func == (lhs: NaverUserInfoResponseDTO, rhs: NaverUserInfoResponseDTO) -> Bool {
lhs.response.id == rhs.response.id
}

public let resultcode, message: String
public let response: Response
}

public extension NaverUserInfoResponseDTO {
struct Response: Codable {
public let id, nickname: String
}

func toDomain() -> NaverUserInfoEntity {
NaverUserInfoEntity(resultcode: resultcode, message: message, id: response.id, nickname: response.nickname)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
// Copyright ยฉ 2023 yongbeomkwak. All rights reserved.
//

import DataMappingModule
import DomainModule
import ErrorModule
import AuthDomainInterface
import Foundation
import RxSwift

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
// Copyright ยฉ 2023 yongbeomkwak. All rights reserved.
//

import DataMappingModule
import DomainModule
import ErrorModule
import AuthDomainInterface
import Foundation
import RxSwift

Expand Down
11 changes: 11 additions & 0 deletions Projects/Domains/AuthDomain/Tests/AuthDomainTest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import XCTest

final class AuthDomainTests: XCTestCase {
override func setUpWithError() throws {}

override func tearDownWithError() throws {}

func testExample() {
XCTAssertEqual(1, 1)
}
}
23 changes: 16 additions & 7 deletions Projects/Features/SignInFeature/Project.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import DependencyPlugin
import ProjectDescription
import ProjectDescriptionHelpers

let project = Project.makeModule(
name: "SignInFeature",
product: .staticFramework,
dependencies: [
.Project.Features.PlayerFeature
],
resources: ["Resources/**"]
let project = Project.module(
name: ModulePaths.Feature.SignInFeature.rawValue,
targets: [
.implements(
module: .feature(.SignInFeature),
product: .staticFramework,
spec: .init(
resources: ["Resources/**"],
dependencies: [
.feature(target: .PlayerFeature),
.domain(target: .AuthDomain, type: .interface)
]
)
)
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright ยฉ 2023 yongbeomkwak. All rights reserved.
//

import AuthDomainInterface
import DomainModule
import Foundation
import NeedleFoundation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
// Copyright ยฉ 2023 yongbeomkwak. All rights reserved.
//

import AuthDomainInterface
import AuthenticationServices
import BaseFeature
import CryptoSwift
import DataMappingModule
import DomainModule
import KeychainModule
import NaverThirdPartyLogin
import RxCocoa
import RxRelay
import RxSwift
import Utility
Expand Down

This file was deleted.

This file was deleted.

Binary file modified graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading