Skip to content

Commit

Permalink
Merge pull request #906 from wakmusic/812-credit-worker-song-list
Browse files Browse the repository at this point in the history
๐Ÿ”€ :: (#812) Music Detail Feature ๋””๋ ‰ํ† ๋ฆฌ ์ •๋ฆฌ
  • Loading branch information
baekteun authored Jul 30, 2024
2 parents 7e1cf7b + 425e32e commit af3c5a3
Show file tree
Hide file tree
Showing 31 changed files with 139 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ extension ModulePaths: MicroTargetPathConvertable {

public extension ModulePaths {
enum Feature: String, MicroTargetPathConvertable {
case CreditSongListFeature
case SongCreditFeature
case TeamFeature
case FruitDrawFeature
Expand Down
6 changes: 6 additions & 0 deletions Projects/App/Sources/Application/AppComponent+Credit.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import CreditDomain
import CreditDomainInterface
import SongCreditFeature
import SongCreditFeatureInterface

public extension AppComponent {
var fetchCreditSongListUseCase: any FetchCreditSongListUseCase {
FetchCreditSongListUseCaseImpl()
}

var songCreditFactory: any SongCreditFactory {
SongCreditComponent(parent: self)
}
}
6 changes: 6 additions & 0 deletions Projects/App/Sources/Application/AppComponent+Songs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,10 @@ public extension AppComponent {
FetchNewSongsUseCaseImpl(songsRepository: songsRepository)
}
}

var fetchSongCreditsUseCase: any FetchSongCreditsUseCase {
shared {
FetchSongCreditsUseCaseImpl(songsRepository: songsRepository)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import UIKit

@main
final class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?

func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
let viewController = UIViewController()
viewController.view.backgroundColor = .yellow
window?.rootViewController = viewController
window?.makeKeyAndVisible()

return true
}
}
22 changes: 22 additions & 0 deletions Projects/Features/CreditSongListFeature/Project.swift
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.Feature.CreditSongListFeature.rawValue,
targets: [
.interface(module: .feature(.CreditSongListFeature)),
.implements(module: .feature(.CreditSongListFeature), dependencies: [
.feature(target: .CreditSongListFeature, type: .interface)
]),
.testing(module: .feature(.CreditSongListFeature), dependencies: [
.feature(target: .CreditSongListFeature, type: .interface)
]),
.tests(module: .feature(.CreditSongListFeature), dependencies: [
.feature(target: .CreditSongListFeature)
]),
.demo(module: .feature(.CreditSongListFeature), dependencies: [
.feature(target: .CreditSongListFeature)
])
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// This is for Tuist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// This is for Tuist
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import XCTest

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

override func tearDownWithError() throws {}

func testExample() {
XCTAssertEqual(1, 1)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Inject
import LyricHighlightingFeatureInterface
@testable import MusicDetailFeature
import RxSwift
import SongCreditFeatureInterface
import SongsDomainTesting
import UIKit
import Utility
Expand Down Expand Up @@ -48,6 +49,7 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
rootViewController: MusicDetailViewController(
reactor: reactor,
lyricHighlightingFactory: DummyLyricHighlightingFactory(),
songCreditFactory: DummySongCreditFactory(),
containSongsFactory: DummyContainSongsFactory(),
playlistPresenterGlobalState: DummyPlaylistPresenterGlobalState()
)
Expand All @@ -72,6 +74,12 @@ final class DummyContainSongsFactory: ContainSongsFactory {
}
}

final class DummySongCreditFactory: SongCreditFactory {
func makeViewController(songID: String) -> UIViewController {
return UIViewController()
}
}

final class DummyPlaylistPresenterGlobalState: PlayListPresenterGlobalStateProtocol {
var presentPlayListObservable: RxSwift.Observable<Void> { .empty() }
func presentPlayList() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import BaseFeatureInterface
import LyricHighlightingFeatureInterface
import MusicDetailFeatureInterface
import NeedleFoundation
import SongCreditFeatureInterface
import SongsDomainInterface
import UIKit

public protocol MusicDetailDependency: Dependency {
var fetchSongUseCase: any FetchSongUseCase { get }
var lyricHighlightingFactory: any LyricHighlightingFactory { get }
var songCreditFactory: any SongCreditFactory { get }
var containSongsFactory: any ContainSongsFactory { get }
var playlistPresenterGlobalState: any PlayListPresenterGlobalStateProtocol { get }
}
Expand All @@ -24,6 +26,7 @@ public final class MusicDetailComponent: Component<MusicDetailDependency>, Music
let viewController = MusicDetailViewController(
reactor: reactor,
lyricHighlightingFactory: dependency.lyricHighlightingFactory,
songCreditFactory: dependency.songCreditFactory,
containSongsFactory: dependency.containSongsFactory,
playlistPresenterGlobalState: dependency.playlistPresenterGlobalState
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,27 @@ import LogManager
import LyricHighlightingFeatureInterface
import RxSwift
import SnapKit
import SongCreditFeatureInterface
import Then
import UIKit
import Utility

final class MusicDetailViewController: BaseReactorViewController<MusicDetailReactor> {
private let musicDetailView = MusicDetailView()
private let lyricHighlightingFactory: any LyricHighlightingFactory
private let songCreditFactory: any SongCreditFactory
private let containSongsFactory: any ContainSongsFactory
private let playlistPresenterGlobalState: any PlayListPresenterGlobalStateProtocol

init(
reactor: MusicDetailReactor,
lyricHighlightingFactory: any LyricHighlightingFactory,
songCreditFactory: any SongCreditFactory,
containSongsFactory: any ContainSongsFactory,
playlistPresenterGlobalState: any PlayListPresenterGlobalStateProtocol
) {
self.lyricHighlightingFactory = lyricHighlightingFactory
self.songCreditFactory = songCreditFactory
self.containSongsFactory = containSongsFactory
self.playlistPresenterGlobalState = playlistPresenterGlobalState
super.init(reactor: reactor)
Expand Down Expand Up @@ -178,7 +182,8 @@ private extension MusicDetailViewController {
}

func navigateCredits(id: String) {
LogManager.printDebug("Navigate Music Credit : id=\(id)")
let viewController = songCreditFactory.makeViewController(songID: id)
self.navigationController?.pushViewController(viewController, animated: true)
}

func navigateLyricsHighlighing(model: LyricHighlightingRequiredModel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,10 @@ final class MyPlaylistDetailViewController: BaseReactorViewController<MyPlaylist
)
activityViewController.popoverPresentationController?.sourceView = owner.view
activityViewController.popoverPresentationController?.sourceRect = CGRect(
x: owner.view.bounds.midX,
y: owner.view.bounds.midY,
width: 0,
height: 0
x: owner.view.bounds.midX,
y: owner.view.bounds.midY,
width: 0,
height: 0
)
activityViewController.popoverPresentationController?.permittedArrowDirections = []
owner.present(activityViewController, animated: true)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import UIKit

public protocol SongCreditFactory {
func makeViewController(songID: String) -> UIViewController
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import NeedleFoundation
import SongCreditFeatureInterface
import SongsDomainInterface
import UIKit

public protocol SongCreditDependency: Dependency {
var fetchSongCreditsUseCase: any FetchSongCreditsUseCase { get }
}

public final class SongCreditComponent: Component<SongCreditDependency>, SongCreditFactory {
public func makeViewController(songID: String) -> UIViewController {
let reactor = SongCreditReactor(
songID: songID,
fetchSongCreditsUseCase: dependency.fetchSongCreditsUseCase
)
let viewController = SongCreditViewController(
reactor: reactor
)
return viewController
}
}

0 comments on commit af3c5a3

Please sign in to comment.