Skip to content

Commit

Permalink
[Refactor] #239 - cleanup the code
Browse files Browse the repository at this point in the history
  • Loading branch information
mini-min committed Jan 20, 2025
1 parent bb5865a commit ef8ae99
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ private extension TabBarCoordinator {
vc.onTimerScene = { [weak self] navController in
self?.startTimerCoordinator(navController: navController)
}
vc.didSelectPlusTab = { [weak self] in

vc.onPlusScene = { [weak self] in
self?.handlePlusTabSelection()
}
self.tabBarController = vc
Expand Down Expand Up @@ -118,6 +119,7 @@ private extension TabBarCoordinator {
self?.showSelectClipVC(linkURL: linkURL)
}
vc.onPopToRoot = { [weak self] in
self?.tabBarController?.selectTab(0)
self?.router.popToRoot(animated: false)
}
router.push(vc, animated: false)
Expand All @@ -127,6 +129,7 @@ private extension TabBarCoordinator {
let vc = ViewControllerFactory.shared.makeSelectClipVC(isNavigationBarHidden: false)
vc.linkURL = linkURL
vc.onPopToRoot = { [weak self] in
self?.tabBarController?.selectTab(0)
self?.router.popToRoot(animated: false)
}
router.push(vc, animated: true)
Expand Down
14 changes: 1 addition & 13 deletions TOASTER-iOS/Present/TabBar/TabBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ final class TabBarController: UITabBarController {
var onPlusScene: (() -> Void)?
var onSearchScene: Scene?
var onTimerScene: Scene?

var didSelectPlusTab: (() -> Void)?


// MARK: - Life Cycle

override func viewDidLoad() {
Expand Down Expand Up @@ -117,14 +115,4 @@ extension TabBarController: UITabBarControllerDelegate {
default: return
}
}

func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
if viewController == viewControllers?[2] {
didSelectPlusTab?()
selectedIndex = 0
currentIndex = selectedIndex
return false
}
return true
}
}

0 comments on commit ef8ae99

Please sign in to comment.