Skip to content

Commit

Permalink
[Fix] sopt-makers#348 - 찌르기 알림 푸시알림을 여러개 터치 시 중복으로 뷰가 쌓이는 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
lsj8706 committed Jan 4, 2024
1 parent 6726f07 commit eb962e8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import SafariServices
/// RouterProtocol은 Coordinator에서 화면전환의 종류를 지정합니다.
public protocol RouterProtocol: ViewControllable {

var topViewController: UIViewController? { get }

func present(_ module: ViewControllable?)
func present(_ module: ViewControllable?, animated: Bool)
func present(_ module: ViewControllable?, animated: Bool, modalPresentationSytle: UIModalPresentationStyle)
Expand Down Expand Up @@ -74,6 +76,10 @@ final class Router: NSObject, RouterProtocol {
private var completions: [UIViewController : () -> Void]
private var transition: UIViewControllerAnimatedTransitioning?

public var topViewController: UIViewController? {
self.rootController?.topViewController
}

// MARK: - ViewControllable

public var viewController: UIViewController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ extension PokeNotificationListCoordinator {
}

self.rootController = viewController.vc.asNavigationController
self.router.push(viewController.vc)

var willAnimate = true
if let top = router.topViewController, type(of: top) == type(of: viewController.vc) {
willAnimate = false
router.popModule(transition: nil, animated: false)
}

self.router.push(viewController.vc, transition: nil, animated: willAnimate)
}
}

0 comments on commit eb962e8

Please sign in to comment.