diff --git a/SOPT-iOS/Projects/Features/PokeFeature/Interface/Sources/PokeFeatureBuildable.swift b/SOPT-iOS/Projects/Features/PokeFeature/Interface/Sources/PokeFeatureBuildable.swift index afcff5e63..cca957857 100644 --- a/SOPT-iOS/Projects/Features/PokeFeature/Interface/Sources/PokeFeatureBuildable.swift +++ b/SOPT-iOS/Projects/Features/PokeFeature/Interface/Sources/PokeFeatureBuildable.swift @@ -12,7 +12,7 @@ import Domain import BaseFeatureDependency public protocol PokeFeatureBuildable { - func makePokeMain(isRouteFromTabBar: Bool, coordinator: Coordinator) -> PokeMainPresentable + func makePokeMain(coordinator: Coordinator) -> PokeMainPresentable func makePokeMyFriends(coordinator: Coordinator) -> PokeMyFriendsPresentable func makePokeMyFriendsList(relation: PokeRelation) -> PokeMyFriendsListPresentable func makePokeOnboarding(coordinator: AnyCoordinatorObject) -> PokeOnboardingPresentable diff --git a/SOPT-iOS/Projects/Features/PokeFeature/Interface/Sources/PokeMainPresentable.swift b/SOPT-iOS/Projects/Features/PokeFeature/Interface/Sources/PokeMainPresentable.swift index 6de1210b2..c15a76143 100644 --- a/SOPT-iOS/Projects/Features/PokeFeature/Interface/Sources/PokeMainPresentable.swift +++ b/SOPT-iOS/Projects/Features/PokeFeature/Interface/Sources/PokeMainPresentable.swift @@ -15,7 +15,6 @@ import Domain public protocol PokeMainViewControllable: LegacyViewControllable { } public protocol PokeMainRoutingTrigger { - var onNaviBackTap: (() -> Void)? { get set } var onPokeNotificationsTap: (() -> Void)? { get set } var onMyFriendsTap: (() -> Void)? { get set } var onProfileImageTapped: ((Int) -> Void)? { get set } diff --git a/SOPT-iOS/Projects/Features/PokeFeature/Sources/Coordinator/LegacyPokeBuilder.swift b/SOPT-iOS/Projects/Features/PokeFeature/Sources/Coordinator/LegacyPokeBuilder.swift index 822340ca6..4845a9779 100644 --- a/SOPT-iOS/Projects/Features/PokeFeature/Sources/Coordinator/LegacyPokeBuilder.swift +++ b/SOPT-iOS/Projects/Features/PokeFeature/Sources/Coordinator/LegacyPokeBuilder.swift @@ -24,7 +24,7 @@ extension LegacyPokeBuilder: LegacyPokeFeatureBuildable { public func makePokeMain(isRouteFromRoot: Bool, coordinator: Coordinator) -> PokeFeatureInterface.LegacyPokeMainPresentable { let useCase = DefaultPokeMainUseCase(repository: pokeMainRepository) let viewModel = PokeMainViewModel(useCase: useCase, coordinator: coordinator) - let pokeMainVC = PokeMainVC(viewModel: viewModel, isRouteFromTabBar: true) + let pokeMainVC = PokeMainVC(viewModel: viewModel) return (pokeMainVC, viewModel) } diff --git a/SOPT-iOS/Projects/Features/PokeFeature/Sources/Coordinator/LegacyPokeCoordinator.swift b/SOPT-iOS/Projects/Features/PokeFeature/Sources/Coordinator/LegacyPokeCoordinator.swift index f9c1c5835..0e67855e6 100644 --- a/SOPT-iOS/Projects/Features/PokeFeature/Sources/Coordinator/LegacyPokeCoordinator.swift +++ b/SOPT-iOS/Projects/Features/PokeFeature/Sources/Coordinator/LegacyPokeCoordinator.swift @@ -33,12 +33,7 @@ final class LegacyPokeCoordinator: BaseCoordinator { } public func showPokeMain(isRouteFromRoot: Bool) { - var pokeMain = factory.makePokeMain(isRouteFromRoot: isRouteFromRoot, coordinator: self) - - pokeMain.vm.onNaviBackTap = { [weak self] in - self?.router.dismissModule(animated: true) - self?.finishFlow?() - } + var pokeMain = factory.makePokeMain(isRouteFromRoot: isRouteFromRoot, coordinator: self) pokeMain.vm.onPokeNotificationsTap = { [weak self] in self?.runPokeNotificationListFlow() diff --git a/SOPT-iOS/Projects/Features/PokeFeature/Sources/Coordinator/PokeBuilder.swift b/SOPT-iOS/Projects/Features/PokeFeature/Sources/Coordinator/PokeBuilder.swift index da4e57324..ff07c6fbc 100644 --- a/SOPT-iOS/Projects/Features/PokeFeature/Sources/Coordinator/PokeBuilder.swift +++ b/SOPT-iOS/Projects/Features/PokeFeature/Sources/Coordinator/PokeBuilder.swift @@ -29,10 +29,10 @@ extension PokeBuilder: PokeFeatureBuildable { return (viewController, viewModel) } - public func makePokeMain(isRouteFromTabBar: Bool, coordinator: Coordinator) -> PokeFeatureInterface.PokeMainPresentable { + public func makePokeMain(coordinator: Coordinator) -> PokeFeatureInterface.PokeMainPresentable { let useCase = DefaultPokeMainUseCase(repository: pokeMainRepository) let viewModel = PokeMainViewModel(useCase: useCase, coordinator: coordinator) - let pokeMainVC = PokeMainVC(viewModel: viewModel, isRouteFromTabBar: isRouteFromTabBar) + let pokeMainVC = PokeMainVC(viewModel: viewModel) return (pokeMainVC, viewModel) } diff --git a/SOPT-iOS/Projects/Features/PokeFeature/Sources/Coordinator/PokeCoordinator.swift b/SOPT-iOS/Projects/Features/PokeFeature/Sources/Coordinator/PokeCoordinator.swift index 0a85817b7..6d8921496 100644 --- a/SOPT-iOS/Projects/Features/PokeFeature/Sources/Coordinator/PokeCoordinator.swift +++ b/SOPT-iOS/Projects/Features/PokeFeature/Sources/Coordinator/PokeCoordinator.swift @@ -35,32 +35,16 @@ public final class PokeCoordinator: BaseCoordinator { // MARK: - Coordinator Life Cycle - public func start(isRouteFromTabBar: Bool = true) { - showPokeMain(isRouteFromTabBar: isRouteFromTabBar) - } - public override func start() { - start(isRouteFromTabBar: true) + showPokeMain() } // MARK: - Navigation - public func showPokeMain(isRouteFromTabBar: Bool) { - var pokeMain = factory.makePokeMain(isRouteFromTabBar: isRouteFromTabBar, coordinator: self) - - if isRouteFromTabBar { - self.rootController = self.navigationController - self.navigationController?.setViewControllers([pokeMain.vc], animated: false) - } else { - let newNav = UINavigationController(rootViewController: pokeMain.vc) - newNav.modalPresentationStyle = .overFullScreen - self.rootController = newNav - pokeMain.vm.onNaviBackTap = { [weak self] in - self?.navigationController?.dismiss(animated: true) - } - - self.navigationController?.present(newNav, animated: true) - } + public func showPokeMain() { + var pokeMain = factory.makePokeMain(coordinator: self) + self.rootController = self.navigationController + self.navigationController?.setViewControllers([pokeMain.vc], animated: false) pokeMain.vm.onPokeOnboardingNeeded = { [weak self] isNeeded in if isNeeded { self?.runPokeOnboardingFlow() } diff --git a/SOPT-iOS/Projects/Features/PokeFeature/Sources/PokeMainScene/VC/PokeMainVC.swift b/SOPT-iOS/Projects/Features/PokeFeature/Sources/PokeMainScene/VC/PokeMainVC.swift index 8e174c839..e769bc579 100644 --- a/SOPT-iOS/Projects/Features/PokeFeature/Sources/PokeMainScene/VC/PokeMainVC.swift +++ b/SOPT-iOS/Projects/Features/PokeFeature/Sources/PokeMainScene/VC/PokeMainVC.swift @@ -21,15 +21,10 @@ public final class PokeMainVC: UIViewController, PokeMainViewControllable { // MARK: - Properties public var viewModel: PokeMainViewModel - private var isRouteFromTabBar: Bool private var cancelBag = CancelBag() // MARK: - UI Components - private let backButton = UIButton().then { - $0.setImage(DSKitAsset.Assets.xMark.image.withTintColor(DSKitAsset.Colors.gray30.color), for: .normal) - } - private let serviceTitleLabel = UILabel().then { $0.font = UIFont.MDS.heading6.font $0.textColor = DSKitAsset.Colors.gray30.color @@ -37,7 +32,7 @@ public final class PokeMainVC: UIViewController, PokeMainViewControllable { } private lazy var navigationView = UIStackView( - arrangedSubviews: [backButton, serviceTitleLabel] + arrangedSubviews: [serviceTitleLabel] ).then { $0.axis = .horizontal $0.spacing = 2 @@ -92,11 +87,9 @@ public final class PokeMainVC: UIViewController, PokeMainViewControllable { // MARK: - initialization public init( - viewModel: PokeMainViewModel, - isRouteFromTabBar: Bool + viewModel: PokeMainViewModel ) { self.viewModel = viewModel - self.isRouteFromTabBar = isRouteFromTabBar super.init(nibName: nil, bundle: nil) } @@ -122,8 +115,6 @@ extension PokeMainVC { private func setUI() { self.navigationController?.isNavigationBarHidden = true view.backgroundColor = DSKitAsset.Colors.semanticBackground.color - - backButton.isHidden = isRouteFromTabBar } private func setDelegate() { @@ -165,11 +156,6 @@ extension PokeMainVC { private func setLayout() { self.view.addSubviews(navigationView, scrollView) - backButton.snp.makeConstraints { make in - make.width.equalTo(40) - make.height.equalTo(40) - } - navigationView.snp.makeConstraints { make in make.top.equalTo(view.safeAreaLayoutGuide) make.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(20) @@ -235,9 +221,6 @@ extension PokeMainVC { let input = PokeMainViewModel .Input( viewDidLoad: Just(()).asDriver(), - naviBackButtonTap: self.backButton - .publisher(for: .touchUpInside) - .mapVoid().asDriver(), pokedSectionHeaderButtonTap: pokedSectionHeaderView .rightButtonTap, friendSectionHeaderButtonTap: friendSectionHeaderView diff --git a/SOPT-iOS/Projects/Features/PokeFeature/Sources/PokeMainScene/ViewModel/PokeMainViewModel.swift b/SOPT-iOS/Projects/Features/PokeFeature/Sources/PokeMainScene/ViewModel/PokeMainViewModel.swift index 50126324f..66a5b5b80 100644 --- a/SOPT-iOS/Projects/Features/PokeFeature/Sources/PokeMainScene/ViewModel/PokeMainViewModel.swift +++ b/SOPT-iOS/Projects/Features/PokeFeature/Sources/PokeMainScene/ViewModel/PokeMainViewModel.swift @@ -21,7 +21,6 @@ public class PokeMainViewModel: PokeMainViewModelType { // MARK: - Trigger - public var onNaviBackTap: (() -> Void)? public var onPokeNotificationsTap: (() -> Void)? public var onMyFriendsTap: (() -> Void)? public var onProfileImageTapped: ((Int) -> Void)? @@ -41,7 +40,6 @@ public class PokeMainViewModel: PokeMainViewModelType { public struct Input { let viewDidLoad: Driver - let naviBackButtonTap: Driver let pokedSectionHeaderButtonTap: Driver let friendSectionHeaderButtonTap: Driver let pokedSectionKokButtonTap: Driver @@ -88,13 +86,7 @@ extension PokeMainViewModel { .sink { [weak self] _ in self?.useCase.checkPokeOnboardingNeeded() self?.eventTracker.trackViewEvent(with: .viewPokeMain) - }.store(in: cancelBag) - - input.naviBackButtonTap - .sink { [weak self] _ in - self?.eventTracker.trackViewEvent(with: .clickPokeQuit) - self?.onNaviBackTap?() - }.store(in: cancelBag) + }.store(in: cancelBag) input.pokedSectionHeaderButtonTap .sink { [weak self] _ in diff --git a/SOPT-iOS/Projects/Features/RootFeature/Sources/ApplicationCoordinator+Delegate.swift b/SOPT-iOS/Projects/Features/RootFeature/Sources/ApplicationCoordinator+Delegate.swift index 9ba920361..1f35a6dc3 100644 --- a/SOPT-iOS/Projects/Features/RootFeature/Sources/ApplicationCoordinator+Delegate.swift +++ b/SOPT-iOS/Projects/Features/RootFeature/Sources/ApplicationCoordinator+Delegate.swift @@ -112,7 +112,7 @@ extension ApplicationCoordinator: NotificationCoordinatorDelegate { switch destination { case .deepLink(let url): self.notificationHandler.receive(deepLink: url) - guard let deepLink = self.notificationHandler.deepLink.value else { return } + guard let deepLink = self.notificationHandler.deepLink.value else { return } handleDeepLink(deepLink: deepLink) case .webLink(let url): self.notificationHandler.receive(webLink: url) diff --git a/SOPT-iOS/Projects/Features/RootFeature/Sources/ApplicationCoordinator.swift b/SOPT-iOS/Projects/Features/RootFeature/Sources/ApplicationCoordinator.swift index 51a8d4762..e15fe566b 100644 --- a/SOPT-iOS/Projects/Features/RootFeature/Sources/ApplicationCoordinator.swift +++ b/SOPT-iOS/Projects/Features/RootFeature/Sources/ApplicationCoordinator.swift @@ -172,7 +172,7 @@ public final class ApplicationCoordinator: BaseCoordinator { private func handleNewDeepLink(deepLink: DeepLinkComponentsExecutable) { self.rootNavigationController.popToRootViewController(animated: false) - deepLink.execute(coordinator: self) + deepLink.execute(coordinator: self) } // MARK: - handleWebLink @@ -627,7 +627,7 @@ extension ApplicationCoordinator { extension ApplicationCoordinator { @discardableResult - internal func runPokeFlow(isRouteFromTabBar: Bool = true) -> BaseCoordinator { + internal func runPokeFlow() -> BaseCoordinator { var coordinator: BaseCoordinator switch Config.coordinatorFlag { @@ -650,7 +650,7 @@ extension ApplicationCoordinator { navigationController: pokeNavigationController, factory: PokeBuilder() ) - newCoordinator.start(isRouteFromTabBar: isRouteFromTabBar) + newCoordinator.start() coordinator = newCoordinator } diff --git a/SOPT-iOS/Projects/Features/RootFeature/Sources/DeepLinks/PokeDeepLink.swift b/SOPT-iOS/Projects/Features/RootFeature/Sources/DeepLinks/PokeDeepLink.swift index 8c54b1298..155470246 100644 --- a/SOPT-iOS/Projects/Features/RootFeature/Sources/DeepLinks/PokeDeepLink.swift +++ b/SOPT-iOS/Projects/Features/RootFeature/Sources/DeepLinks/PokeDeepLink.swift @@ -9,6 +9,7 @@ import Foundation import BaseFeatureDependency import PokeFeature +import Core public struct PokeDeepLink: DeepLinkExecutable { public let name = "poke" @@ -18,11 +19,13 @@ public struct PokeDeepLink: DeepLinkExecutable { public func execute(with coordinator: Coordinator, queryItems: [URLQueryItem]?) -> Coordinator? { guard let coordinator = coordinator as? ApplicationCoordinator else { return nil } + let userType = UserDefaultKeyList.Auth.getUserType() + coordinator.tabBarController?.selectedIndex = TabBarItemType.poke.getTabIndex(userType: userType) + if self.isDestination == true { - coordinator.runTabBarFlow(initSelectedTabType: .poke) return coordinator } - - return coordinator.runPokeFlow(isRouteFromTabBar: false) + + return coordinator.runPokeFlow() } }