From 0ca77eadc21b45187ee8e06dcfeb6f06b2d7c894 Mon Sep 17 00:00:00 2001 From: "Chintakrinda, Arun Kumar (Arun)" Date: Thu, 9 Jan 2020 18:24:18 +0530 Subject: [PATCH 1/4] Chatbot disable to BD users --- MVMCoreUI/BaseControllers/MFViewController.m | 2 +- MVMCoreUI/OtherHandlers/MVMCoreUISession.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/BaseControllers/MFViewController.m b/MVMCoreUI/BaseControllers/MFViewController.m index 2c8e3997..6484c7ec 100644 --- a/MVMCoreUI/BaseControllers/MFViewController.m +++ b/MVMCoreUI/BaseControllers/MFViewController.m @@ -146,7 +146,7 @@ // Avoid the setter so we are only setting the bool and wait for view will appear to update the navigation bar. _masterShouldBeAccessible = [self isMasterInitiallyAccessible]; - _supportShouldBeAccessible = [self isSupportInitiallyAccessible]; + _supportShouldBeAccessible = ![MVMCoreUISession sharedGlobal].disableSupport && [self isSupportInitiallyAccessible]; // Observe for cache updates if desired. [self observeForResponseJSONUpdates]; diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUISession.h b/MVMCoreUI/OtherHandlers/MVMCoreUISession.h index ca2db26e..ac7b2dbc 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUISession.h +++ b/MVMCoreUI/OtherHandlers/MVMCoreUISession.h @@ -31,6 +31,9 @@ NS_ASSUME_NONNULL_BEGIN //indicates if the app launched successfully @property (assign, nonatomic) BOOL launchAppLoadedSuccessfully; +//indicates if support is enabled +@property (assign, nonatomic) BOOL disableSupport; + // Allows a global overload of the title view of navigation item. - (nullable UIView *)titleViewForController:(nonnull MFViewController *)controller; From c8fcbeaefd82fd50f101b167e62ee89b62129d76 Mon Sep 17 00:00:00 2001 From: panxi Date: Thu, 9 Jan 2020 12:47:03 -0500 Subject: [PATCH 2/4] update right panel view controller --- MVMCoreUI/BaseControllers/MFViewController.m | 2 +- .../MVMCoreUISplitViewController.h | 4 ++++ .../MVMCoreUISplitViewController.m | 20 +++++++++++++++++++ MVMCoreUI/OtherHandlers/MVMCoreUISession.h | 3 --- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/BaseControllers/MFViewController.m b/MVMCoreUI/BaseControllers/MFViewController.m index 6484c7ec..2c8e3997 100644 --- a/MVMCoreUI/BaseControllers/MFViewController.m +++ b/MVMCoreUI/BaseControllers/MFViewController.m @@ -146,7 +146,7 @@ // Avoid the setter so we are only setting the bool and wait for view will appear to update the navigation bar. _masterShouldBeAccessible = [self isMasterInitiallyAccessible]; - _supportShouldBeAccessible = ![MVMCoreUISession sharedGlobal].disableSupport && [self isSupportInitiallyAccessible]; + _supportShouldBeAccessible = [self isSupportInitiallyAccessible]; // Observe for cache updates if desired. [self observeForResponseJSONUpdates]; diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h index af02281d..8c1a7715 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h @@ -120,6 +120,10 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { - (nullable UIViewController *)createLeftPanelViewController; - (nullable UIViewController *)createRightPanelViewController; +//replace gloabl panel +- (void)updateGlobalLeftPanelViewController:(nullable UIViewController *)leftPanelController; +- (void)updateGlobalRightPanelViewController:(nullable UIViewController *)rightPanelController; + // subclass to change image of back button - (nullable UIImage *)imageForBackButton; diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index b5177b9b..15dfba04 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -114,6 +114,14 @@ CGFloat const PanelAnimationDuration = 0.2; return nil; } +- (void)updateGlobalLeftPanelViewController:(nullable UIViewController *)leftPanelController { + self.globalLeftPanel = leftPanelController; +} + +- (void)updateGlobalRightPanelViewController:(nullable UIViewController *)rightPanelController { + self.globalRightPanel = rightPanelController; +} + - (nullable NSArray *)additionalLeftButtons { return nil; } @@ -316,6 +324,9 @@ CGFloat const PanelAnimationDuration = 0.2; } - (void)hideLeftPanelAnimated:(BOOL)animated checkingForOtherExtendedDrawers:(BOOL)checkingForOtherExtendedDrawers { + if (!self.globalLeftPanel) { + return; + } [MVMCoreDispatchUtility performBlockOnMainThread:^{ if (self.mainViewLeading.constant > .1) { if (checkingForOtherExtendedDrawers && self.explictlyShowingPanel == self.leftPanel) { @@ -355,6 +366,9 @@ CGFloat const PanelAnimationDuration = 0.2; } - (void)showLeftPanelAnimated:(BOOL)animated explict:(BOOL)explict { + if (!self.globalLeftPanel) { + return; + } [MVMCoreDispatchUtility performBlockOnMainThread:^{ if (self.mainViewLeading.constant < .1) { BOOL shouldExtendLeftPanel = [self shouldExtendLeftPanel]; @@ -509,6 +523,9 @@ CGFloat const PanelAnimationDuration = 0.2; } - (void)hideRightPanelAnimated:(BOOL)animated checkingForOtherExtendedDrawers:(BOOL)checkingForOtherExtendedDrawers { + if (!self.globalRightPanel) { + return; + } [MVMCoreDispatchUtility performBlockOnMainThread:^{ if (self.mainViewTrailing.constant > .1) { if (checkingForOtherExtendedDrawers && self.explictlyShowingPanel == self.rightPanel) { @@ -548,6 +565,9 @@ CGFloat const PanelAnimationDuration = 0.2; } - (void)showRightPanelAnimated:(BOOL)animated explict:(BOOL)explict { + if (!self.globalRightPanel) { + return; + } [MVMCoreDispatchUtility performBlockOnMainThread:^{ if (self.mainViewTrailing.constant < .1) { BOOL shouldExtendRightPanel = [self shouldExtendRightPanel]; diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUISession.h b/MVMCoreUI/OtherHandlers/MVMCoreUISession.h index ac7b2dbc..ca2db26e 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUISession.h +++ b/MVMCoreUI/OtherHandlers/MVMCoreUISession.h @@ -31,9 +31,6 @@ NS_ASSUME_NONNULL_BEGIN //indicates if the app launched successfully @property (assign, nonatomic) BOOL launchAppLoadedSuccessfully; -//indicates if support is enabled -@property (assign, nonatomic) BOOL disableSupport; - // Allows a global overload of the title view of navigation item. - (nullable UIView *)titleViewForController:(nonnull MFViewController *)controller; From 8816a06fe5c7eea7412cfbf60cdc84a950fb157d Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Tue, 21 Jan 2020 11:58:08 -0500 Subject: [PATCH 3/4] public globalLeftPanel/globalRightPanel --- .../MVMCoreUISplitViewController.h | 15 +++++---- .../MVMCoreUISplitViewController.m | 33 ++++++------------- 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h index 8c1a7715..1a72a190 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h @@ -24,8 +24,12 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { @interface MVMCoreUISplitViewController : UIViewController // Reference to the panels. -@property (nullable, weak, nonatomic, readonly) UIViewController *leftPanel; -@property (nullable, weak, nonatomic, readonly) UIViewController *rightPanel; +@property (nullable, weak, nonatomic) UIViewController *leftPanel; +@property (nullable, weak, nonatomic) UIViewController *rightPanel; + +// For keeping +@property (nullable, strong, nonatomic) UIViewController *globalLeftPanel; +@property (nullable, strong, nonatomic) UIViewController *globalRightPanel; // Can be of protocol MVMCoreUIPanelButtonProtocol @property (nullable, strong, nonatomic) UIBarButtonItem *leftPanelButton; @@ -79,6 +83,9 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { // contains speicaly logic to set the icon color - (void)setNavigationIconColor:(nullable UIColor *)color; +///create right and left panel. if left and right panel is already created, will replace them +- (void)createPanels; + /// Updates the panels that are used. - (void)setupPanels; @@ -120,10 +127,6 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) { - (nullable UIViewController *)createLeftPanelViewController; - (nullable UIViewController *)createRightPanelViewController; -//replace gloabl panel -- (void)updateGlobalLeftPanelViewController:(nullable UIViewController *)leftPanelController; -- (void)updateGlobalRightPanelViewController:(nullable UIViewController *)rightPanelController; - // subclass to change image of back button - (nullable UIImage *)imageForBackButton; diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index 15dfba04..cd36d2a7 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -44,12 +44,6 @@ typedef NS_OPTIONS(NSInteger, MFExtendedDrawer) { @property (weak, nonatomic) UIView *leftPanelSeparator; @property (weak, nonatomic) UIView *rightPanelSeparator; -// For keeping -@property (strong, nonatomic, readwrite) UIViewController *globalLeftPanel; -@property (strong, nonatomic, readwrite) UIViewController *globalRightPanel; - -@property (weak, nonatomic, readwrite) UIViewController *leftPanel; -@property (weak, nonatomic, readwrite) UIViewController *rightPanel; @property (weak, nonatomic, readwrite) NavigationController *navigationController; // A view that covers the detail view when the master is out. @@ -114,14 +108,6 @@ CGFloat const PanelAnimationDuration = 0.2; return nil; } -- (void)updateGlobalLeftPanelViewController:(nullable UIViewController *)leftPanelController { - self.globalLeftPanel = leftPanelController; -} - -- (void)updateGlobalRightPanelViewController:(nullable UIViewController *)rightPanelController { - self.globalRightPanel = rightPanelController; -} - - (nullable NSArray *)additionalLeftButtons { return nil; } @@ -366,7 +352,7 @@ CGFloat const PanelAnimationDuration = 0.2; } - (void)showLeftPanelAnimated:(BOOL)animated explict:(BOOL)explict { - if (!self.globalLeftPanel) { + if (!self.leftPanel) { return; } [MVMCoreDispatchUtility performBlockOnMainThread:^{ @@ -523,9 +509,6 @@ CGFloat const PanelAnimationDuration = 0.2; } - (void)hideRightPanelAnimated:(BOOL)animated checkingForOtherExtendedDrawers:(BOOL)checkingForOtherExtendedDrawers { - if (!self.globalRightPanel) { - return; - } [MVMCoreDispatchUtility performBlockOnMainThread:^{ if (self.mainViewTrailing.constant > .1) { if (checkingForOtherExtendedDrawers && self.explictlyShowingPanel == self.rightPanel) { @@ -565,7 +548,7 @@ CGFloat const PanelAnimationDuration = 0.2; } - (void)showRightPanelAnimated:(BOOL)animated explict:(BOOL)explict { - if (!self.globalRightPanel) { + if (!self.rightPanel) { return; } [MVMCoreDispatchUtility performBlockOnMainThread:^{ @@ -786,6 +769,13 @@ CGFloat const PanelAnimationDuration = 0.2; } } +- (void)createPanels { + // Create panels + self.globalLeftPanel = [self createLeftPanelViewController]; + self.globalRightPanel = [self createRightPanelViewController]; + [self setupPanels]; +} + - (void)setupPanels { [self forceHideBothDrawers]; [self setupLeftPanel]; @@ -882,10 +872,7 @@ CGFloat const PanelAnimationDuration = 0.2; [NSLayoutConstraint constraintWithItem:coverView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0].active = YES; [NSLayoutConstraint constraintWithItem:coverView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES; - // Create panels - self.globalLeftPanel = [self createLeftPanelViewController]; - self.globalRightPanel = [self createRightPanelViewController]; - [self setupPanels]; + [self createPanels]; } - (void)viewDidLoad { From 2de914296971535b04922faa30c3401a6199555c Mon Sep 17 00:00:00 2001 From: "Xinlei(Ryan) Pan" Date: Tue, 21 Jan 2020 12:00:28 -0500 Subject: [PATCH 4/4] remove one more line --- .../SplitViewController/MVMCoreUISplitViewController.m | 3 --- 1 file changed, 3 deletions(-) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index cd36d2a7..93aeb6fd 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -310,9 +310,6 @@ CGFloat const PanelAnimationDuration = 0.2; } - (void)hideLeftPanelAnimated:(BOOL)animated checkingForOtherExtendedDrawers:(BOOL)checkingForOtherExtendedDrawers { - if (!self.globalLeftPanel) { - return; - } [MVMCoreDispatchUtility performBlockOnMainThread:^{ if (self.mainViewLeading.constant > .1) { if (checkingForOtherExtendedDrawers && self.explictlyShowingPanel == self.leftPanel) {