Skip to content

Commit

Permalink
Merge pull request #2 from rambler-ios/close-module-fix
Browse files Browse the repository at this point in the history
Fixed Issue #1
  • Loading branch information
AndreyZarembo committed Nov 15, 2015
2 parents b1eca61 + 9fd913b commit 0568204
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,16 @@ - (RamblerViperOpenModulePromise*)openModuleUsingFactory:(RamblerViperModuleFact
}
// Method removes/closes module
- (void)closeCurrentModule {
if (self.presentingViewController) {
[self dismissViewControllerAnimated:YES completion:nil];
}
else if ([self.parentViewController isKindOfClass:[UINavigationController class]]) {
BOOL isInNavigationStack = [self.parentViewController isKindOfClass:[UINavigationController class]];
BOOL hasManyControllersInStack = isInNavigationStack ? ((UINavigationController *)viewController.parentViewController).childViewControllers.count > 1 : NO;

if (isInNavigationStack && hasManyControllersInStack) {
UINavigationController *navigationController = (UINavigationController*)self.parentViewController;
[navigationController popViewControllerAnimated:YES];
}
else if (viewController.presentingViewController) {
[viewController dismissViewControllerAnimated:YES completion:nil];
}
else if (self.view.superview != nil){
[self removeFromParentViewController];
[self.view removeFromSuperview];
Expand Down

0 comments on commit 0568204

Please sign in to comment.