Skip to content

Commit

Permalink
Merge pull request #100 from AckeeCZ/fix/flash-news
Browse files Browse the repository at this point in the history
🐛 Fix navigation controller's delegate on flow coordinator that is navigation root
  • Loading branch information
LukasHromadnik authored Dec 7, 2020
2 parents 856eb48 + a7902ec commit 0a09403
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ACKategories-iOS/Base/FlowCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,17 @@ extension Base {
// MARK: - UINavigationControllerDelegate

public func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {
if let rootViewController = rootViewController, !navigationController.viewControllers.contains(rootViewController) {
// Check if the root is not dead
guard let rootViewController = rootViewController else { return }

// If the navigation controller is the current root view controller
// then this method shouldn't get called.
// But that's not possible with our current implementation.
guard self.navigationController != rootViewController else { return }

// If `rootViewController` is not present in the navigation stack
// we have to stop the current flow
if !navigationController.viewControllers.contains(rootViewController) {
navigationController.delegate = parentCoordinator
stop()
}
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

### Fixed

- Check if `navigationController != rootViewController` before running navigation delegate method ([#100](https://github.com/AckeeCZ/ACKategories/pull/100), kudos to @lukashromadnik)
- `GradientView` has `isUserInteractionEnabled = false` as it is not supposed to be interactive by design ([#99](https://github.com/AckeeCZ/ACKategories/pull/99), kudos to @olejnjak)
- Check the value of `rootViewController` before stopping the flow ([#98](https://github.com/AckeeCZ/ACKategories/pull/98), kudos to @lukashromadnik)

Expand Down

0 comments on commit 0a09403

Please sign in to comment.