Merge branch 'feature/add_open_panel_callback_overtake_indicator' into 'develop'

Add overtaking indicator to openPanel callback method.

See merge request BPHV_MIPS/mvm_core_ui!195
This commit is contained in:
Pfeil, Scott Robert 2019-12-04 12:56:39 -05:00
commit 0cadf5c358
2 changed files with 22 additions and 10 deletions

View File

@ -16,7 +16,9 @@ NS_ASSUME_NONNULL_BEGIN
@optional
- (void)panelWillAppear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
- (void)panelWillAppear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel overtakingDetail:(BOOL)willOvertake;
- (void)panelDidAppear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
- (void)panelDidAppear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel overtakingDetail:(BOOL)didOvertake;
- (void)panelWillDisappear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
- (void)panelDidDisappear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;

View File

@ -357,16 +357,19 @@ CGFloat const PanelAnimationDuration = 0.2;
- (void)showLeftPanelAnimated:(BOOL)animated explict:(BOOL)explict {
[MVMCoreDispatchUtility performBlockOnMainThread:^{
if (self.mainViewLeading.constant < .1) {
BOOL shouldExtendLeftPanel = [self shouldExtendLeftPanel];
if (explict) {
self.explictlyShowingPanel = self.leftPanel;
}
void (^animations)(void) = [self getLeftPanelShowAnimationBlock];
void (^completion)(BOOL) = ^(BOOL finished){
[self panelDidAppear:self.leftPanel animated:animated];
[self panelDidAppear:self.leftPanel didExtend:shouldExtendLeftPanel animated:animated];
};
if (![self shouldExtendLeftPanel]) {
if (!shouldExtendLeftPanel) {
if ([self.leftPanel respondsToSelector:@selector(showArrow)]){
[self.leftPanel showArrow];
}
@ -389,7 +392,7 @@ CGFloat const PanelAnimationDuration = 0.2;
}
self.mainViewCoverView.hidden = NO;
[self panelWillAppear:self.leftPanel animated:animated];
[self panelWillAppear:self.leftPanel willExtend:shouldExtendLeftPanel animated:animated];
if (animated) {
[UIView animateWithDuration:PanelAnimationDuration delay:0 options:UIViewAnimationOptionCurveLinear animations:animations completion:completion];
} else {
@ -547,19 +550,22 @@ CGFloat const PanelAnimationDuration = 0.2;
- (void)showRightPanelAnimated:(BOOL)animated explict:(BOOL)explict {
[MVMCoreDispatchUtility performBlockOnMainThread:^{
if (self.mainViewTrailing.constant < .1) {
BOOL shouldExtendRightPanel = [self shouldExtendRightPanel];
if (explict) {
self.explictlyShowingPanel = self.rightPanel;
}
void (^animations)(void) = [self getRightPanelShowAnimationBlock];
void (^completion)(BOOL) = ^(BOOL finished){
[self panelDidAppear:self.rightPanel animated:animated];
[self panelDidAppear:self.rightPanel didExtend:shouldExtendRightPanel animated:animated];
self.mainView.accessibilityElementsHidden = YES;
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, self.rightPanel);
};
self.mainViewCoverView.hidden = NO;
if (![self shouldExtendRightPanel]) {
if (!shouldExtendRightPanel) {
if ([self.rightPanel respondsToSelector:@selector(showArrow)]){
[self.rightPanel showArrow];
}
@ -579,7 +585,7 @@ CGFloat const PanelAnimationDuration = 0.2;
self.rightPanelSeparator = rightPanelSeparator;
}
[self panelWillAppear:self.rightPanel animated:animated];
[self panelWillAppear:self.rightPanel willExtend:shouldExtendRightPanel animated:animated];
if (animated) {
[UIView animateWithDuration:PanelAnimationDuration delay:0 options:UIViewAnimationOptionCurveLinear animations:animations completion:completion];
} else {
@ -612,7 +618,7 @@ CGFloat const PanelAnimationDuration = 0.2;
[self hideRightPanelIfNeededAnimated:YES];
}
- (void)panelWillAppear:(UIViewController <MVMCoreUIPanelProtocol> *)panel animated:(BOOL)animated {
- (void)panelWillAppear:(UIViewController <MVMCoreUIPanelProtocol> *)panel willExtend:(BOOL)willExtend animated:(BOOL)animated {
if ([panel respondsToSelector:@selector(willAppear:)]) {
[panel willAppear:animated];
} else {
@ -621,13 +627,15 @@ CGFloat const PanelAnimationDuration = 0.2;
UIViewController *controller = [self getCurrentDetailViewController];
if ([controller.class conformsToProtocol:@protocol(MVMCoreUIDetailViewProtocol)]) {
UIViewController <MVMCoreUIDetailViewProtocol>* protocolController = (UIViewController <MVMCoreUIDetailViewProtocol>*)controller;
if ([protocolController respondsToSelector:@selector(panelWillAppear:)]) {
if ([protocolController respondsToSelector:@selector(panelWillAppear:overtakingDetail:)]) {
[protocolController panelWillAppear:panel overtakingDetail:!willExtend];
} else if ([protocolController respondsToSelector:@selector(panelWillAppear:)]) {
[protocolController panelWillAppear:panel];
}
}
}
- (void)panelDidAppear:(UIViewController <MVMCoreUIPanelProtocol> *)panel animated:(BOOL)animated {
- (void)panelDidAppear:(UIViewController <MVMCoreUIPanelProtocol> *)panel didExtend:(BOOL)didExtend animated:(BOOL)animated {
if ([panel respondsToSelector:@selector(didAppear:)]) {
[panel didAppear:animated];
} else {
@ -636,7 +644,9 @@ CGFloat const PanelAnimationDuration = 0.2;
UIViewController *controller = [self getCurrentDetailViewController];
if ([controller.class conformsToProtocol:@protocol(MVMCoreUIDetailViewProtocol)]) {
UIViewController <MVMCoreUIDetailViewProtocol>* protocolController = (UIViewController <MVMCoreUIDetailViewProtocol>*)controller;
if ([protocolController respondsToSelector:@selector(panelDidAppear:)]) {
if ([protocolController respondsToSelector:@selector(panelDidAppear:overtakingDetail:)]) {
[protocolController panelDidAppear:panel overtakingDetail:!didExtend];
} else if ([protocolController respondsToSelector:@selector(panelDidAppear:)]) {
[protocolController panelDidAppear:panel];
}
}