Merge pull request #9 in BPHVB/mvm_core_ui from feature/detail_view_protocol_right_left_button to develop
* commit '82dabe019b5b933de833bc9d8bfa0be66116f6df': rightPanelLinkDict code review isOverridingLeftButton code review detail_view_protocol_right_left_button
This commit is contained in:
commit
8ec19228bf
@ -324,6 +324,19 @@
|
|||||||
return [self.loadObject.pageJSON lenientBoolForKey:@"showRightPanel"];
|
return [self.loadObject.pageJSON lenientBoolForKey:@"showRightPanel"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (BOOL)isOverridingRightButton {
|
||||||
|
NSDictionary *rightPanelLinkDict = [self.loadObject.pageJSON dict:@"rightPanelButtonLink"];
|
||||||
|
if (rightPanelLinkDict) {
|
||||||
|
[[MVMCoreActionHandler sharedActionHandler] handleActionWithDictionary:rightPanelLinkDict
|
||||||
|
additionalData:nil
|
||||||
|
delegate:self];
|
||||||
|
return YES;
|
||||||
|
} else {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setSupportShouldBeAccessible:(BOOL)supportShouldBeAccessible {
|
- (void)setSupportShouldBeAccessible:(BOOL)supportShouldBeAccessible {
|
||||||
|
|
||||||
MVMCoreUISplitViewController *splitViewController = [MVMCoreUISession sharedGlobal].splitViewController;
|
MVMCoreUISplitViewController *splitViewController = [MVMCoreUISession sharedGlobal].splitViewController;
|
||||||
|
|||||||
@ -24,6 +24,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
// Called when the back button is pressed. Overwrite for special functionality.
|
// Called when the back button is pressed. Overwrite for special functionality.
|
||||||
- (void)backButtonPressed;
|
- (void)backButtonPressed;
|
||||||
|
|
||||||
|
// View Controller can override this method and do custom action instead of opening the right panel
|
||||||
|
- (BOOL)isOverridingRightButton;
|
||||||
|
|
||||||
|
// View Controller can override this method and do custom action instead of opening the left panel
|
||||||
|
- (BOOL)isOverridingLeftButton;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@ -142,11 +142,18 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
|
|
||||||
- (IBAction)leftPanelButtonPressed:(id)sender {
|
- (IBAction)leftPanelButtonPressed:(id)sender {
|
||||||
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
||||||
|
UIViewController *viewController = self.navigationController.topViewController;
|
||||||
|
|
||||||
|
// If Viewcontroller confirms to protocol and implements the the method leftPanelButtonPressed
|
||||||
|
if ([viewController conformsToProtocol:@protocol(MVMCoreUIDetailViewProtocol)]
|
||||||
|
&& [viewController respondsToSelector:@selector(isOverridingLeftButton)]
|
||||||
|
&& [((UIViewController <MVMCoreUIDetailViewProtocol> *)viewController) isOverridingLeftButton]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (self.mainViewLeading.constant < .1) {
|
if (self.mainViewLeading.constant < .1) {
|
||||||
|
|
||||||
// Hide the keyboard
|
// Hide the keyboard
|
||||||
[self.navigationController.topViewController.view endEditing:YES];
|
[viewController.view endEditing:YES];
|
||||||
|
|
||||||
// Show
|
// Show
|
||||||
[self showLeftPanelAnimated:YES];
|
[self showLeftPanelAnimated:YES];
|
||||||
} else {
|
} else {
|
||||||
@ -169,10 +176,18 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
|
|
||||||
- (IBAction)rightPanelButtonPressed:(id)sender {
|
- (IBAction)rightPanelButtonPressed:(id)sender {
|
||||||
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
||||||
|
UIViewController *viewController = self.navigationController.topViewController;
|
||||||
|
|
||||||
|
// If Viewcontroller confirms to protocol and implements the the method rightPanelButtonPressed
|
||||||
|
if ([viewController conformsToProtocol:@protocol(MVMCoreUIDetailViewProtocol)]
|
||||||
|
&& [viewController respondsToSelector:@selector(isOverridingRightButton)]
|
||||||
|
&& [((UIViewController <MVMCoreUIDetailViewProtocol> *)viewController) isOverridingRightButton]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (self.mainViewTrailing.constant < .1) {
|
if (self.mainViewTrailing.constant < .1) {
|
||||||
// Hide the keyboard
|
// Hide the keyboard
|
||||||
[self.navigationController.topViewController.view endEditing:YES];
|
[viewController.view endEditing:YES];
|
||||||
|
|
||||||
// Show
|
// Show
|
||||||
[self showRightPanelAnimated:YES];
|
[self showRightPanelAnimated:YES];
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user