Merge branch 'bugfix/missing_prepare_navigation' into 'feature/develop_mvp_3'

fix missing prepare statements

See merge request BPHV_MIPS/mvm_core!201
This commit is contained in:
Hedden, Kyle Matthew 2022-03-25 20:00:12 +00:00
commit edeaefc346

View File

@ -137,6 +137,7 @@
if (self.navigationObject.navigationController.viewControllers.count > 1) {
// Although the post animation state is currently fine with pop, store anyway as a precaution
self.futureViewControllers = [self.navigationObject.navigationController.viewControllers subarrayWithRange:NSMakeRange(0, self.navigationObject.navigationController.viewControllers.count - 1)];
[self prepareDisplay];
[self.navigationObject.navigationController popViewControllerAnimated:self.navigationObject.animated];
} else {
[self markAsFinished];
@ -183,7 +184,7 @@
// Store post animation state.
NSInteger index = [[self.navigationObject.navigationController viewControllers] indexOfObject:self.navigationObject.viewController];
self.futureViewControllers = [self.navigationObject.navigationController.viewControllers subarrayWithRange:NSMakeRange(0, index + 1)];
[self prepareDisplay];
[self.navigationObject.navigationController popToViewController:self.navigationObject.viewController animated:self.navigationObject.animated];
} else {
[self markAsFinished];
@ -195,7 +196,7 @@
if (self.navigationObject.navigationController.viewControllers.count > 1) {
// Store post animation state.
self.futureViewControllers = @[self.navigationObject.navigationController.viewControllers.firstObject];
[self prepareDisplay];
[self.navigationObject.navigationController popToRootViewControllerAnimated:self.navigationObject.animated];
} else {
[self markAsFinished];
@ -213,14 +214,14 @@
- (void)pushViewController {
// Although the post animation state is currently fine with push, store anyway as a precaution
self.futureViewControllers = [self.navigationObject.navigationController.viewControllers arrayByAddingObject:self.navigationObject.viewController];
[self navigationController:self.navigationObject.navigationController prepareDisplayForViewController:self.navigationObject.viewController];
[self prepareDisplay];
[self.navigationObject.navigationController pushViewController:self.navigationObject.viewController animated:self.navigationObject.animated];
}
- (void)setViewControllers:(NSArray *)viewControllers {
self.futureViewControllers = viewControllers;
if (![self.navigationObject.navigationController.viewControllers isEqualToArray:viewControllers]) {
[self navigationController:self.navigationObject.navigationController prepareDisplayForViewController:viewControllers.lastObject];
self.futureViewControllers = viewControllers;
[self prepareDisplay];
[self.navigationObject.navigationController setViewControllers:viewControllers animated:self.navigationObject.animated];
} else {
@ -230,8 +231,9 @@
}
// Notify delegates to prepare for the controller to be added to the navigation controller.
- (void)navigationController:(UINavigationController *)navigationController prepareDisplayForViewController:(UIViewController *)viewController {
- (void)prepareDisplay {
UINavigationController *navigationController = self.navigationObject.navigationController;
UIViewController *viewController = self.futureViewControllers.lastObject;
if (self.delegate && [self.delegate respondsToSelector:@selector(navigationController:prepareDisplayForViewController:)]) {
[self.delegate navigationController:navigationController
prepareDisplayForViewController:viewController];