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

๐Ÿ”€ :: (#521) ์„œ์น˜ ํ“จ์ฒ˜๋ฅผ ReactorKit์œผ๋กœ ๋ฆฌํŒฉํ•ฉ๋‹ˆ๋‹ค. #522

Merged
merged 26 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9183f4a
:wrench: ์„œ์น˜ ํ“จ์ฒ˜ ์ธํ„ฐํŽ˜์ด์Šค ์—ฐ๊ฒฐ
yongbeomkwak May 6, 2024
d2546c3
:bricks: :: reactor ์ ์šฉ์„ ์œ„ํ•ด ์ฝ”๋“œ ์ฃผ์„ ์ฒ˜๋ฆฌ
yongbeomkwak May 6, 2024
9db6fb2
:syringe: ๋ฉ”์ธ ํƒญ๋ฐ” ํ“จ์ฒ˜์— ์„œ์น˜ ์ปดํฌ๋„ŒํŠธ ๋Œ€์‹  ํŒฉํ† ๋ฆฌ ์ฃผ์ž…
yongbeomkwak May 6, 2024
d203d1c
:bricks: :: ํฌ๋งทํŒ…
yongbeomkwak May 6, 2024
fcf900b
:refactor: :: ์ถ”์ฒœ ํ”Œ๋ฆฌ์™€ ์ตœ๊ทผ ๊ฒ€์ƒ‰์–ด ์—ฐ๊ฒฐ
yongbeomkwak May 6, 2024
929cc26
:recycle: :: ์„œ์น˜ ์ปจํ…Œ์ด๋„ˆ ์ปจํŠธ๋กค๋Ÿฌ ๋ฆฌํŒฉ ์™„๋ฃŒ
yongbeomkwak May 6, 2024
7f47b41
:bricks: :: ํฌ๋งทํŒ…
yongbeomkwak May 6, 2024
4db9744
Merge branch '519-split-tab-storage-myinfo' into 521-refactor-search
yongbeomkwak May 8, 2024
f14d3a7
Merge branch '519-split-tab-storage-myinfo' into 521-refactor-search
yongbeomkwak May 8, 2024
2649178
Merge branch 'develop' into 521-refactor-search
yongbeomkwak May 8, 2024
b94f389
:zap: :: public -> internal
yongbeomkwak May 8, 2024
17a14fa
:bricks: :: ํฌ๋งทํŒ…
yongbeomkwak May 8, 2024
ce0f502
:truck: :: ํŒŒ์ผ๋ช… ๋ณ€๊ฒฝ
yongbeomkwak May 9, 2024
97bf1b0
:recycle: :: mutate , reduce ์ˆœ์„œ ๋ณ€๊ฒฝ
yongbeomkwak May 9, 2024
4f09f48
:bricks: :: ํฌ๋งทํŒ…
yongbeomkwak May 9, 2024
62b949e
:zap: :: private ๋ถ™ํž˜
yongbeomkwak May 9, 2024
7998e4c
:zap: :: ๋ณ„๋„์˜ enum์œผ๋กœ ์ถ”์ถœ
yongbeomkwak May 9, 2024
038e88d
:zap: :: bind onNext ๋ ˆ์ด๋ธ” ์ œ๊ฑฐ
yongbeomkwak May 9, 2024
807c049
:bricks: :: ํฌ๋งทํŒ…
yongbeomkwak May 9, 2024
e0dd4cb
:zap: :: guard ๋ฌธ์œผ๋กœ ๋Œ€์ฒด
yongbeomkwak May 9, 2024
d6e9a06
:bricks: :: ํฌ๋งทํŒ…
yongbeomkwak May 9, 2024
8126fe9
:zap: :: currentState -> sharedState
yongbeomkwak May 9, 2024
3f0889e
:zap: cancel -> cancelButtonDidTap
yongbeomkwak May 9, 2024
091042d
Update Projects/Features/SearchFeature/Sources/ViewControllers/Searchโ€ฆ
yongbeomkwak May 9, 2024
21216dd
Update Projects/Features/SearchFeature/Sources/ViewControllers/Searchโ€ฆ
yongbeomkwak May 9, 2024
5d13622
:bug: :: ์˜คํƒ€ ํ•ด๊ฒฐ
yongbeomkwak May 9, 2024
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
Expand Up @@ -12,17 +12,12 @@ import PlayListDomain
import PlayListDomainInterface
import PlaylistFeature
import PlaylistFeatureInterface
import SearchFeature
import StorageFeature

// MARK: ๋ณ€์ˆ˜๋ช… ์ฃผ์˜
// AppComponent ๋‚ด ๋ณ€์ˆ˜ == Dependency ๋‚ด ๋ณ€์ˆ˜ ์ด๋ฆ„ ๊ฐ™์•„์•ผํ•จ

public extension AppComponent {
var beforeSearchComponent: BeforeSearchComponent {
BeforeSearchComponent(parent: self)
}

var playlistDetailFactory: any PlaylistDetailFactory {
PlayListDetailComponent(parent: self)
}
Expand Down
21 changes: 21 additions & 0 deletions Projects/App/Sources/Application/AppComponent+Search.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Foundation
import SearchFeature
import SearchFeatureInterface

extension AppComponent {
var searchFactory: any SearchFactory {
SearchComponent(parent: self)
}

var beforeSearchComponent: BeforeSearchComponent {
BeforeSearchComponent(parent: self)
}

var afterSearchComponent: AfterSearchComponent {
AfterSearchComponent(parent: self)
}

var afterSearchContentComponent: AfterSearchContentComponent {
AfterSearchContentComponent(parent: self)
}
}
21 changes: 0 additions & 21 deletions Projects/App/Sources/Application/AppComponent+Songs.swift
Original file line number Diff line number Diff line change
@@ -1,30 +1,9 @@
//
// AppComponent+Search.swift
// WaktaverseMusic
//
// Created by yongbeomkwak on 2023/02/07.
// Copyright ยฉ 2023 yongbeomkwak. All rights reserved.
//

import BaseFeature
import HomeFeature
import SearchFeature
import SongsDomain
import SongsDomainInterface

public extension AppComponent {
var searchComponent: SearchComponent {
SearchComponent(parent: self)
}

var afterSearchComponent: AfterSearchComponent {
AfterSearchComponent(parent: self)
}

var afterSearchContentComponent: AfterSearchContentComponent {
AfterSearchContentComponent(parent: self)
}

var homeComponent: HomeComponent {
HomeComponent(parent: self)
}
Expand Down
11 changes: 4 additions & 7 deletions Projects/App/Sources/Application/NeedleGenerated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import PlaylistFeature
import PlaylistFeatureInterface
import RootFeature
import SearchFeature
import SearchFeatureInterface
import SignInFeature
import SignInFeatureInterface
import SongsDomain
Expand Down Expand Up @@ -170,8 +171,8 @@ private class MainTabBarDependencycd05b79389a6a7a6c20fProvider: MainTabBarDepend
var chartComponent: ChartComponent {
return appComponent.chartComponent
}
var searchComponent: SearchComponent {
return appComponent.searchComponent
var searchFactory: any SearchFactory {
return appComponent.searchFactory
}
var artistComponent: ArtistComponent {
return appComponent.artistComponent
Expand Down Expand Up @@ -788,9 +789,6 @@ extension AppComponent: Registration {
public func registerItems() {

localTable["keychain-any Keychain"] = { [unowned self] in self.keychain as Any }
localTable["searchComponent-SearchComponent"] = { [unowned self] in self.searchComponent as Any }
localTable["afterSearchComponent-AfterSearchComponent"] = { [unowned self] in self.afterSearchComponent as Any }
localTable["afterSearchContentComponent-AfterSearchContentComponent"] = { [unowned self] in self.afterSearchContentComponent as Any }
localTable["homeComponent-HomeComponent"] = { [unowned self] in self.homeComponent as Any }
localTable["newSongsComponent-NewSongsComponent"] = { [unowned self] in self.newSongsComponent as Any }
localTable["newSongsContentComponent-NewSongsContentComponent"] = { [unowned self] in self.newSongsContentComponent as Any }
Expand All @@ -815,7 +813,6 @@ extension AppComponent: Registration {
localTable["fetchLikeNumOfSongUseCase-any FetchLikeNumOfSongUseCase"] = { [unowned self] in self.fetchLikeNumOfSongUseCase as Any }
localTable["addLikeSongUseCase-any AddLikeSongUseCase"] = { [unowned self] in self.addLikeSongUseCase as Any }
localTable["cancelLikeSongUseCase-any CancelLikeSongUseCase"] = { [unowned self] in self.cancelLikeSongUseCase as Any }
localTable["beforeSearchComponent-BeforeSearchComponent"] = { [unowned self] in self.beforeSearchComponent as Any }
localTable["playlistDetailFactory-any PlaylistDetailFactory"] = { [unowned self] in self.playlistDetailFactory as Any }
localTable["myPlayListComponent-MyPlayListComponent"] = { [unowned self] in self.myPlayListComponent as Any }
localTable["remotePlayListDataSource-any RemotePlayListDataSource"] = { [unowned self] in self.remotePlayListDataSource as Any }
Expand Down Expand Up @@ -931,7 +928,7 @@ extension MainTabBarComponent: Registration {
keyPathToName[\MainTabBarDependency.fetchNoticeUseCase] = "fetchNoticeUseCase-any FetchNoticeUseCase"
keyPathToName[\MainTabBarDependency.homeComponent] = "homeComponent-HomeComponent"
keyPathToName[\MainTabBarDependency.chartComponent] = "chartComponent-ChartComponent"
keyPathToName[\MainTabBarDependency.searchComponent] = "searchComponent-SearchComponent"
keyPathToName[\MainTabBarDependency.searchFactory] = "searchFactory-any SearchFactory"
keyPathToName[\MainTabBarDependency.artistComponent] = "artistComponent-ArtistComponent"
keyPathToName[\MainTabBarDependency.storageComponent] = "storageComponent-StorageComponent"
keyPathToName[\MainTabBarDependency.myInfoComponent] = "myInfoComponent-MyInfoComponent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ open class BaseStoryboardReactorViewController<R: Reactor>: UIViewController, St
ViewControllerFromStoryBoard {
public var disposeBag = DisposeBag()

// @available(*, unavailable)
// public required init?(coder: NSCoder) {
// fatalError("init(coder:) has not been implemented")
// }

override open func viewDidLoad() {
super.viewDidLoad()
configureUI()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import MyInfoFeature
import NeedleFoundation
import NoticeDomainInterface
import SearchFeature
import SearchFeatureInterface
import StorageFeature

public protocol MainTabBarDependency: Dependency {
var fetchNoticeUseCase: any FetchNoticeUseCase { get }
var homeComponent: HomeComponent { get }
var chartComponent: ChartComponent { get }
var searchComponent: SearchComponent { get }
var searchFactory: any SearchFactory { get }
var artistComponent: ArtistComponent { get }
var storageComponent: StorageComponent { get }
var myInfoComponent: MyInfoComponent { get }
Expand All @@ -30,7 +31,7 @@ public final class MainTabBarComponent: Component<MainTabBarDependency> {
),
homeComponent: self.dependency.homeComponent,
chartComponent: self.dependency.chartComponent,
searchComponent: self.dependency.searchComponent,
searchFactory: self.dependency.searchFactory,
artistComponent: self.dependency.artistComponent,
storageCompoent: self.dependency.storageComponent,
myInfoComponent: self.dependency.myInfoComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import NoticeDomainInterface
import RxCocoa
import RxSwift
import SearchFeature
import SearchFeatureInterface
import SnapKit
import StorageFeature
import UIKit
Expand All @@ -20,7 +21,7 @@ public final class MainTabBarViewController: BaseViewController, ViewControllerF
return [
homeComponent.makeView().wrapNavigationController,
chartComponent.makeView().wrapNavigationController,
searchComponent.makeView().wrapNavigationController,
searchFactory.makeView().wrapNavigationController,
artistComponent.makeView().wrapNavigationController,
storageComponent.makeView().wrapNavigationController,
myInfoComponent.makeView().wrapNavigationController
Expand All @@ -34,7 +35,7 @@ public final class MainTabBarViewController: BaseViewController, ViewControllerF

private var homeComponent: HomeComponent!
private var chartComponent: ChartComponent!
private var searchComponent: SearchComponent!
private var searchFactory: SearchFactory!
private var artistComponent: ArtistComponent!
private var storageComponent: StorageComponent!
private var myInfoComponent: MyInfoComponent!
Expand Down Expand Up @@ -62,7 +63,7 @@ public final class MainTabBarViewController: BaseViewController, ViewControllerF
viewModel: MainTabBarViewModel,
homeComponent: HomeComponent,
chartComponent: ChartComponent,
searchComponent: SearchComponent,
searchFactory: SearchFactory,
artistComponent: ArtistComponent,
storageCompoent: StorageComponent,
myInfoComponent: MyInfoComponent,
Expand All @@ -74,7 +75,7 @@ public final class MainTabBarViewController: BaseViewController, ViewControllerF
viewController.viewModel = viewModel
viewController.homeComponent = homeComponent
viewController.chartComponent = chartComponent
viewController.searchComponent = searchComponent
viewController.searchFactory = searchFactory
viewController.artistComponent = artistComponent
viewController.storageComponent = storageCompoent
viewController.myInfoComponent = myInfoComponent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ internal class PlayListDetailViewController: BaseStoryboardReactorViewController
override public func bindState(reactor: PlaylistDetailReactor) {
super.bindState(reactor: reactor)

let currentState = reactor.state.share(replay: 4)
let sharedState = reactor.state.share(replay: 4)

currentState.map(\.dataSource)
sharedState.map(\.dataSource)
.withUnretained(self)
.do(onNext: { owner, model in

Expand All @@ -158,15 +158,15 @@ internal class PlayListDetailViewController: BaseStoryboardReactorViewController
.bind(to: tableView.rx.items(dataSource: createDatasources()))
.disposed(by: disposeBag)

currentState.map(\.header)
sharedState.map(\.header)
.withUnretained(self)
.do(onNext: { owner, model in

let imageHeight: CGFloat = (140.0 * APP_WIDTH()) / 375.0
let newFrame: CGRect = CGRect(x: 0, y: 0, width: APP_WIDTH(), height: imageHeight + 20)
owner.tableView.tableHeaderView?.frame = newFrame
})
.bind(onNext: { owner, model in
.bind { owner, model in

guard let type = owner.reactor?.type else { return }

Expand All @@ -182,13 +182,12 @@ internal class PlayListDetailViewController: BaseStoryboardReactorViewController
owner.playListCountLabel.text = model.songCount
owner.playListNameLabel.text = model.title
owner.editPlayListNameButton.setImage(DesignSystemAsset.Storage.storageEdit.image, for: .normal)

})
}
.disposed(by: disposeBag)

currentState.map(\.selectedItemCount)
sharedState.map(\.selectedItemCount)
.withUnretained(self)
.bind(onNext: { owner, count in
.bind { owner, count in
guard let type = owner.reactor?.type else {
return
}
Expand All @@ -210,13 +209,12 @@ internal class PlayListDetailViewController: BaseStoryboardReactorViewController
owner.songCartView?.delegate = owner
}
}

})
}
.disposed(by: disposeBag)

currentState.map(\.isEditing)
sharedState.map(\.isEditing)
.withUnretained(self)
.bind(onNext: { owner, flag in
.bind { owner, flag in
owner.navigationController?.interactivePopGestureRecognizer?.delegate = flag ? owner : nil
owner.moreButton.isHidden = flag
owner.editPlayListNameButton.isHidden = !flag
Expand All @@ -225,8 +223,7 @@ internal class PlayListDetailViewController: BaseStoryboardReactorViewController

owner.tableView.isEditing = flag
owner.tableView.reloadData()

})
}
.disposed(by: disposeBag)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import BaseFeatureInterface
import UIKit

public protocol SearchFactory {
func makeView() -> UIViewController
}
4 changes: 4 additions & 0 deletions Projects/Features/SearchFeature/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ import ProjectDescriptionHelpers
let project = Project.module(
name: ModulePaths.Feature.SearchFeature.rawValue,
targets: [
.interface(module: .feature(.SearchFeature), dependencies: [
.feature(target: .BaseFeature, type: .interface)
]),
.implements(
module: .feature(.SearchFeature),
product: .staticFramework,
spec: .init(
resources: ["Resources/**"],
dependencies: [
.feature(target: .PlayerFeature),
.feature(target: .SearchFeature, type: .interface),
.feature(target: .PlaylistFeature, type: .interface),
.domain(target: .SongsDomain, type: .interface),
]
Expand Down
Loading
Loading