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

πŸ”€ :: (#569) μ„€μ • ν™”λ©΄ μ»΄ν¬λ„ŒνŠΈλ₯Ό Stub ν•˜κΈ° μœ„ν•œ λ‚΄λΆ€ λͺ¨λ“ˆ Stub #580

Merged
merged 9 commits into from
Jun 11, 2024
8 changes: 8 additions & 0 deletions Projects/Features/MyInfoFeature/Interface/Interface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ public protocol MyInfoFactory {
public protocol SettingFactory {
func makeView() -> UIViewController
}

public protocol AppPushSettingFactory {
func makeView() -> UIViewController
}

public protocol OpenSourceLicenseFactory {
func makeView() -> UIViewController
}
1 change: 1 addition & 0 deletions Projects/Features/MyInfoFeature/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ let project = Project.module(
)
),
.testing(module: .feature(.MyInfoFeature), dependencies: [
.feature(target: .MyInfoFeature),
.feature(target: .MyInfoFeature, type: .interface),
.feature(target: .BaseFeature, type: .testing),
.feature(target: .SignInFeature, type: .testing)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import BaseFeatureInterface
// import BaseFeatureInterface
import MyInfoFeatureInterface
import NeedleFoundation
import UIKit

public protocol AppPushSettingDependency: Dependency {}

public final class AppPushSettingComponent: Component<AppPushSettingDependency> {
public final class AppPushSettingComponent: Component<AppPushSettingDependency>, AppPushSettingFactory {
public func makeView() -> UIViewController {
return AppPushSettingViewController.viewController(
reactor: AppPushSettingReactor()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
//
// OpenSourceLicenseComponent.swift
// CommonFeature
//
// Created by KTH on 2023/05/17.
// Copyright Β© 2023 yongbeomkwak. All rights reserved.
//

import Foundation
import MyInfoFeatureInterface
import NeedleFoundation
import UIKit

public protocol OpenSourceLicenseDependency: Dependency {}

public final class OpenSourceLicenseComponent: Component<OpenSourceLicenseDependency> {
public func makeView() -> OpenSourceLicenseViewController {
public final class OpenSourceLicenseComponent: Component<OpenSourceLicenseDependency>, OpenSourceLicenseFactory {
public func makeView() -> UIViewController {
return OpenSourceLicenseViewController.viewController(
viewModel: OpenSourceLicenseViewModel()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public final class SettingComponent: Component<SettingDependency>, SettingFactor
),
textPopUpFactory: dependency.textPopUpFactory,
signInFactory: dependency.signInFactory,
appPushSettingComponent: dependency.appPushSettingComponent,
serviceTermsComponent: dependency.serviceTermsComponent,
privacyComponent: dependency.privacyComponent,
openSourceLicenseComponent: dependency.openSourceLicenseComponent
appPushSettingFactory: dependency.appPushSettingComponent,
serviceTermsFactory: dependency.serviceTermsComponent,
privacyFactory: dependency.privacyComponent,
openSourceLicenseFactory: dependency.openSourceLicenseComponent
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import Utility
final class SettingViewController: BaseReactorViewController<SettingReactor> {
private var textPopUpFactory: TextPopUpFactory!
private var signInFactory: SignInFactory!
private var appPushSettingComponent: AppPushSettingComponent!
private var serviceTermsComponent: ServiceTermsComponent!
private var privacyComponent: PrivacyComponent!
private var openSourceLicenseComponent: OpenSourceLicenseComponent!
private var appPushSettingFactory: AppPushSettingFactory!
private var serviceTermsFactory: ServiceTermFactory!
private var privacyFactory: PrivacyFactory!
private var openSourceLicenseFactory: OpenSourceLicenseFactory!

let settingView = SettingView()

Expand All @@ -29,18 +29,18 @@ final class SettingViewController: BaseReactorViewController<SettingReactor> {
reactor: SettingReactor,
textPopUpFactory: TextPopUpFactory,
signInFactory: SignInFactory,
appPushSettingComponent: AppPushSettingComponent,
serviceTermsComponent: ServiceTermsComponent,
privacyComponent: PrivacyComponent,
openSourceLicenseComponent: OpenSourceLicenseComponent
appPushSettingFactory: AppPushSettingFactory,
serviceTermsFactory: ServiceTermFactory,
privacyFactory: PrivacyFactory,
openSourceLicenseFactory: OpenSourceLicenseFactory
) -> SettingViewController {
let viewController = SettingViewController(reactor: reactor)
viewController.textPopUpFactory = textPopUpFactory
viewController.signInFactory = signInFactory
viewController.appPushSettingComponent = appPushSettingComponent
viewController.serviceTermsComponent = serviceTermsComponent
viewController.privacyComponent = privacyComponent
viewController.openSourceLicenseComponent = openSourceLicenseComponent
viewController.appPushSettingFactory = appPushSettingFactory
viewController.serviceTermsFactory = serviceTermsFactory
viewController.privacyFactory = privacyFactory
viewController.openSourceLicenseFactory = openSourceLicenseFactory
return viewController
}

Expand All @@ -52,18 +52,18 @@ final class SettingViewController: BaseReactorViewController<SettingReactor> {
case .dismiss:
owner.navigationController?.popViewController(animated: true)
case .appPushSetting:
let vc = owner.appPushSettingComponent.makeView()
let vc = owner.appPushSettingFactory.makeView()
owner.navigationController?.pushViewController(vc, animated: true)
case .serviceTerms:
let vc = owner.serviceTermsComponent.makeView()
let vc = owner.serviceTermsFactory.makeView()
vc.modalPresentationStyle = .overFullScreen
owner.present(vc, animated: true)
case .privacy:
let vc = owner.privacyComponent.makeView()
let vc = owner.privacyFactory.makeView()
vc.modalPresentationStyle = .overFullScreen
owner.present(vc, animated: true)
case .openSource:
let vc = owner.openSourceLicenseComponent.makeView()
let vc = owner.openSourceLicenseFactory.makeView()
owner.navigationController?.pushViewController(vc, animated: true)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@testable import MyInfoFeature
import MyInfoFeatureInterface
import UIKit

public final class AppPushSettingComponentStub: AppPushSettingFactory {
public func makeView() -> UIViewController {
return AppPushSettingViewController.viewController(
reactor: AppPushSettingReactor()
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Foundation
@testable import MyInfoFeature
import MyInfoFeatureInterface
import UIKit

public final class OpenSourceLicenseComponentStub: OpenSourceLicenseFactory {
public func makeView() -> UIViewController {
return OpenSourceLicenseViewController.viewController(
viewModel: OpenSourceLicenseViewModel()
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import AuthDomainInterface
@testable import AuthDomainTesting
import BaseFeatureInterface
@testable import BaseFeatureTesting
@testable import MyInfoFeature
import MyInfoFeatureInterface
import SignInFeatureInterface
@testable import SignInFeatureTesting
import UIKit
import UserDomainInterface
@testable import UserDomainTesting

public final class SettingComponentStub: SettingFactory {
public func makeView() -> UIViewController {
return SettingViewController.viewController(
reactor: SettingReactor(
withDrawUserInfoUseCase: WithdrawUserInfoUseCaseSpy(),
logoutUseCase: LogoutUseCaseSpy()
),
textPopUpFactory: TextPopUpComponentStub(),
signInFactory: SignInComponentStub(),
appPushSettingFactory: AppPushSettingComponentStub(),
serviceTermsFactory: ServiceTermComponentStub(),
privacyFactory: PrivacyComponentStub(),
openSourceLicenseFactory: OpenSourceLicenseComponentStub()
)
}
}
2 changes: 1 addition & 1 deletion Projects/Features/MyInfoFeature/Testing/testing.swift
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// for γ……uist
// for tuist
Loading