Skip to content

Commit

Permalink
delete: 화면 진입 시 memberInfo 호출 구문 삭제 (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlarjsdn3 committed Jan 16, 2024
1 parent c080fcd commit c504a9c
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ public final class FamilyManagementDIContainer {
return FamilyManagementViewController(reactor: makeReactor())
}

public func makeMeRepository() -> MeRepositoryProtocol {
return MeAPIs.Worker()
}

public func makeMeUseCase() -> MeUseCaseProtocol {
return MeUseCase(meRepository: makeMeRepository())
}

public func makeFamilyUseCase() -> FamilyViewUseCaseProtocol {
return FamilyViewUseCase(familyRepository: makeFamilyRepository())
}
Expand All @@ -43,7 +35,6 @@ public final class FamilyManagementDIContainer {

public func makeReactor() -> FamilyManagementViewReactor {
return FamilyManagementViewReactor(
meUseCase: makeMeUseCase(),
familyUseCase: makeFamilyUseCase(),
provider: globalState
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public final class FamilyManagementViewReactor: Reactor {
// MARK: - Action
public enum Action {
case didTapShareButton
case fetchMeInfo
case fetchFamilyMemebers
}

Expand Down Expand Up @@ -46,15 +45,13 @@ public final class FamilyManagementViewReactor: Reactor {
// MARK: - Properties
public let initialState: State

public let meUseCase: MeUseCaseProtocol
public let familyUseCase: FamilyViewUseCaseProtocol
public let provider: GlobalStateProviderProtocol

private let memberId: String? = App.Repository.member.memberID.value

// MARK: - Intializer
init(
meUseCase: MeUseCaseProtocol,
familyUseCase: FamilyViewUseCaseProtocol,
provider: GlobalStateProviderProtocol
) {
Expand All @@ -68,7 +65,6 @@ public final class FamilyManagementViewReactor: Reactor {
shouldShowProgressView: false
)

self.meUseCase = meUseCase
self.familyUseCase = familyUseCase
self.provider = provider
}
Expand Down Expand Up @@ -102,16 +98,6 @@ public final class FamilyManagementViewReactor: Reactor {
Observable.just(.setProgressView(false))
)

case .fetchMeInfo:
return meUseCase.getMemberInfo()
.asObservable()
.flatMap {
guard let familyId: String = $0?.familyId else {
return Observable<Mutation>.just(.injectFamilyId(nil))
}
return Observable<Mutation>.just(.injectFamilyId(familyId))
}

case .fetchFamilyMemebers:
return familyUseCase.executeFetchFamilyMembers()
.withUnretained(self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ public final class FamilyManagementViewController: BaseViewController<FamilyMana
}

private func bindInput(reactor: FamilyManagementViewReactor) {
Observable<Void>.just(())
.map { Reactor.Action.fetchMeInfo }
.bind(to: reactor.action)
.disposed(by: disposeBag)

Observable<Void>.just(())
.map { Reactor.Action.fetchFamilyMemebers }
.bind(to: reactor.action)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,11 @@ public final class HomeDIContainer {
public func makeFamilyRepository() -> SearchFamilyRepository {
return FamilyAPIs.Worker()
}

public func makeMeRepository() -> MeRepositoryProtocol {
return MeAPIs.Worker()
}


public func makeInviteFamilyRepository() -> FamilyRepositoryProtocol {
return FamilyRepository()
}

func makeMeUseCase() -> MeUseCaseProtocol {
return MeUseCase(meRepository: makeMeRepository())
}

func makePostUseCase() -> PostListUseCaseProtocol {
return PostListUseCase(postListRepository: makePostRepository())
}
Expand All @@ -52,7 +44,7 @@ public final class HomeDIContainer {
}

public func makeReactor() -> Reactor {
return HomeViewReactor(meRepository: makeMeUseCase(), postRepository: makePostUseCase())
return HomeViewReactor(postRepository: makePostUseCase())
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import RxDataSources

public final class HomeViewReactor: Reactor {
public enum Action {
case fetchMeInfo
case getTodayPostList
case refreshCollectionview
case startTimer
Expand Down Expand Up @@ -48,25 +47,16 @@ public final class HomeViewReactor: Reactor {
}

public let initialState: State = State()
private let meRepository: MeUseCaseProtocol
private let postRepository: PostListUseCaseProtocol

init(meRepository: MeUseCaseProtocol, postRepository: PostListUseCaseProtocol) {
self.meRepository = meRepository
init(postRepository: PostListUseCaseProtocol) {
self.postRepository = postRepository
}
}

extension HomeViewReactor {
public func mutate(action: Action) -> Observable<Mutation> {
switch action {
case .fetchMeInfo:
return meRepository.getMemberInfo()
.asObservable()
.flatMap { _ in
return Observable<Mutation>.empty()
}

case .getTodayPostList:
let query: PostListQuery = PostListQuery(page: 1, size: 20, date: Date().toFormatString(with: "YYYY-MM-DD"), memberId: "", sort: .desc)
return postRepository.excute(query: query)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,6 @@ extension HomeViewController {
postCollectionView.rx.setDelegate(self)
.disposed(by: disposeBag)

Observable<Void>.just(())
.map { Reactor.Action.fetchMeInfo }
.bind(to: reactor.action)
.disposed(by: disposeBag)

Observable.just(())
.map { Reactor.Action.startTimer }
.bind(to: reactor.action)
Expand Down

0 comments on commit c504a9c

Please sign in to comment.