-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 629-connect-recommend-data
- Loading branch information
Showing
29 changed files
with
326 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import LyricDomain | ||
import LyricDomainInterface | ||
|
||
// MARK: 변수명 주의 | ||
// AppComponent 내 변수 == Dependency 내 변수 이름 같아야함 | ||
|
||
public extension AppComponent { | ||
var remoteLyricDataSource: any RemoteLyricDataSource { | ||
shared { | ||
RemoteLyricDataSourceImpl(keychain: keychain) | ||
} | ||
} | ||
|
||
var lyricRepository: any LyricRepository { | ||
shared { | ||
LyricRepositoryImpl(remoteLyricDataSource: remoteLyricDataSource) | ||
} | ||
} | ||
|
||
var fetchDecoratingBackgroundUseCase: any FetchDecoratingBackgroundUseCase { | ||
shared { | ||
FetchDecoratingBackgroundUseCaseImpl(lyricRepository: lyricRepository) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
Projects/Domains/LyricDomain/Interface/DataSource/RemoteLyricDataSource.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Foundation | ||
import RxSwift | ||
|
||
public protocol RemoteLyricDataSource { | ||
func fetchDecoratingBackground() -> Single<[DecoratingBackgroundEntity]> | ||
} |
14 changes: 14 additions & 0 deletions
14
Projects/Domains/LyricDomain/Interface/Entity/DecoratingBackgroundEntity.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Foundation | ||
|
||
public struct DecoratingBackgroundEntity { | ||
public init( | ||
name: String, | ||
image: String | ||
) { | ||
self.name = name | ||
self.image = image | ||
} | ||
|
||
public let name, image: String | ||
public var isSelected: Bool = false | ||
} |
6 changes: 6 additions & 0 deletions
6
Projects/Domains/LyricDomain/Interface/Repository/LyricRepository.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Foundation | ||
import RxSwift | ||
|
||
public protocol LyricRepository { | ||
func fetchDecoratingBackground() -> Single<[DecoratingBackgroundEntity]> | ||
} |
6 changes: 6 additions & 0 deletions
6
Projects/Domains/LyricDomain/Interface/UseCase/FetchDecoratingBackgroundUseCase.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Foundation | ||
import RxSwift | ||
|
||
public protocol FetchDecoratingBackgroundUseCase { | ||
func execute() -> Single<[DecoratingBackgroundEntity]> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import DependencyPlugin | ||
import ProjectDescription | ||
import ProjectDescriptionHelpers | ||
|
||
let project = Project.module( | ||
name: ModulePaths.Domain.LyricDomain.rawValue, | ||
targets: [ | ||
.interface( | ||
module: .domain(.LyricDomain), | ||
dependencies: [ | ||
.domain(target: .BaseDomain, type: .interface) | ||
] | ||
), | ||
.implements( | ||
module: .domain(.LyricDomain), | ||
dependencies: [ | ||
.domain(target: .BaseDomain), | ||
.domain(target: .LyricDomain, type: .interface) | ||
] | ||
) | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import BaseDomain | ||
import ErrorModule | ||
import Foundation | ||
import LyricDomainInterface | ||
import Moya | ||
|
||
public enum LyricAPI { | ||
case fetchDecoratingBackground | ||
} | ||
|
||
extension LyricAPI: WMAPI { | ||
public var domain: WMDomain { | ||
return .lyric | ||
} | ||
|
||
public var urlPath: String { | ||
switch self { | ||
case .fetchDecoratingBackground: | ||
return "/background" | ||
} | ||
} | ||
|
||
public var method: Moya.Method { | ||
switch self { | ||
case .fetchDecoratingBackground: | ||
return .get | ||
} | ||
} | ||
|
||
public var task: Moya.Task { | ||
switch self { | ||
case .fetchDecoratingBackground: | ||
return .requestPlain | ||
} | ||
} | ||
|
||
public var jwtTokenType: JwtTokenType { | ||
return .none | ||
} | ||
|
||
public var errorMap: [Int: WMError] { | ||
switch self { | ||
default: | ||
return [ | ||
400: .badRequest, | ||
401: .tokenExpired, | ||
404: .notFound, | ||
429: .tooManyRequest, | ||
500: .internalServerError | ||
] | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Projects/Domains/LyricDomain/Sources/DataSource/RemoteLyricDataSourceImpl.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import BaseDomain | ||
import Foundation | ||
import LyricDomainInterface | ||
import RxSwift | ||
|
||
public final class RemoteLyricDataSourceImpl: BaseRemoteDataSource<LyricAPI>, RemoteLyricDataSource { | ||
public func fetchDecoratingBackground() -> Single<[DecoratingBackgroundEntity]> { | ||
request(.fetchDecoratingBackground) | ||
.map([DecoratingBackgroundResponseDTO].self) | ||
.map { $0.map { $0.toDomain() } } | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
Projects/Domains/LyricDomain/Sources/Repository/LyricRepositoryImpl.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Foundation | ||
import LyricDomainInterface | ||
import RxSwift | ||
|
||
public final class LyricRepositoryImpl: LyricRepository { | ||
private let remoteLyricDataSource: any RemoteLyricDataSource | ||
|
||
public init( | ||
remoteLyricDataSource: RemoteLyricDataSource | ||
) { | ||
self.remoteLyricDataSource = remoteLyricDataSource | ||
} | ||
|
||
public func fetchDecoratingBackground() -> Single<[DecoratingBackgroundEntity]> { | ||
remoteLyricDataSource.fetchDecoratingBackground() | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Projects/Domains/LyricDomain/Sources/ResponseDTO/DecoratingBackgroundResponseDTO.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Foundation | ||
import LyricDomainInterface | ||
|
||
public struct DecoratingBackgroundResponseDTO: Decodable { | ||
let name: String | ||
let image: String | ||
|
||
private enum CodingKeys: String, CodingKey { | ||
case name | ||
case image = "imageUrl" | ||
} | ||
} | ||
|
||
public extension DecoratingBackgroundResponseDTO { | ||
func toDomain() -> DecoratingBackgroundEntity { | ||
return .init(name: name, image: image) | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
Projects/Domains/LyricDomain/Sources/UseCase/FetchDecoratingBackgroundUseCaseImpl.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Foundation | ||
import LyricDomainInterface | ||
import RxSwift | ||
|
||
public struct FetchDecoratingBackgroundUseCaseImpl: FetchDecoratingBackgroundUseCase { | ||
private let lyricRepository: any LyricRepository | ||
|
||
public init( | ||
lyricRepository: LyricRepository | ||
) { | ||
self.lyricRepository = lyricRepository | ||
} | ||
|
||
public func execute() -> Single<[DecoratingBackgroundEntity]> { | ||
lyricRepository.fetchDecoratingBackground() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 8 additions & 2 deletions
10
Projects/Features/LyricHighlightingFeature/Sources/Components/LyricDecoratingComponent.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
import Foundation | ||
import LyricDomainInterface | ||
import LyricHighlightingFeatureInterface | ||
import NeedleFoundation | ||
|
||
public protocol LyricDecoratingDependency: Dependency {} | ||
public protocol LyricDecoratingDependency: Dependency { | ||
var fetchDecoratingBackgroundUseCase: any FetchDecoratingBackgroundUseCase { get } | ||
} | ||
|
||
public final class LyricDecoratingComponent: Component<LyricDecoratingDependency> { | ||
public func makeView(model: LyricHighlightingRequiredModel) -> LyricDecoratingViewController { | ||
let viewModel = LyricDecoratingViewModel(model: model) | ||
let viewModel = LyricDecoratingViewModel( | ||
model: model, | ||
fetchDecoratingBackgroundUseCase: dependency.fetchDecoratingBackgroundUseCase | ||
) | ||
return LyricDecoratingViewController(viewModel: viewModel) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.