diff --git a/MVMCoreUI/BaseControllers/MFLoadingViewController.h b/MVMCoreUI/BaseControllers/MFLoadingViewController.h index 02586712..e8af4532 100644 --- a/MVMCoreUI/BaseControllers/MFLoadingViewController.h +++ b/MVMCoreUI/BaseControllers/MFLoadingViewController.h @@ -8,7 +8,7 @@ // The view controller used during loading. Used by the loading handler. #import -#import +@import MVMCore.MVMCoreLoadingViewControllerProtocol; @interface MFLoadingViewController : UIViewController diff --git a/MVMCoreUI/BaseControllers/MFProgrammaticTableViewController.m b/MVMCoreUI/BaseControllers/MFProgrammaticTableViewController.m index ba7df785..b728b063 100644 --- a/MVMCoreUI/BaseControllers/MFProgrammaticTableViewController.m +++ b/MVMCoreUI/BaseControllers/MFProgrammaticTableViewController.m @@ -8,7 +8,7 @@ #import "MFProgrammaticTableViewController.h" #import "NSLayoutConstraint+MFConvenience.h" -#import +@import MVMCore.NSDictionary_MFConvenience; @import MVMAnimationFramework; @interface MFProgrammaticTableViewController () @@ -101,7 +101,7 @@ return cell; } --(void)setupIntroAnimations { +- (void)setupIntroAnimations { [self.introAnimationManager addAnimationWithAnimation:[MVMAnimations animateTableViewFadeInCellsWithTableView:self.tableView]]; } diff --git a/MVMCoreUI/BaseControllers/MFScrollingViewController.m b/MVMCoreUI/BaseControllers/MFScrollingViewController.m index 5c56998f..efbf3b9a 100644 --- a/MVMCoreUI/BaseControllers/MFScrollingViewController.m +++ b/MVMCoreUI/BaseControllers/MFScrollingViewController.m @@ -7,13 +7,13 @@ // #import "MFScrollingViewController.h" -#import -#import "MFTransparentGIFView.h" -#import -#import -#import +@import MVMCore.MVMCoreDispatchUtility; +@import MVMCore.MVMCoreGetterUtility; +@import MVMCore.MVMCoreLoadObject; +@import MVMCore.NSDictionary_MFConvenience; +@import MVMCore.MVMCoreJSONConstants; #import "NSLayoutConstraint+MFConvenience.h" -#import +#import "MFTransparentGIFView.h" #import "MVMCoreUIUtility.h" #import "MVMCoreUIConstants.h" #import "MVMCoreUISession.h" diff --git a/MVMCoreUI/BaseControllers/MFViewController.h b/MVMCoreUI/BaseControllers/MFViewController.h index 5714125d..55cd6b44 100644 --- a/MVMCoreUI/BaseControllers/MFViewController.h +++ b/MVMCoreUI/BaseControllers/MFViewController.h @@ -8,24 +8,22 @@ // The base view controller. Any view controller that is part of the app flow should be subclassed from this object. #import -#import -#import -#import -#import +@import MVMCore.MVMCoreErrorObject; +@import MVMCore.MVMCoreLoadDelegateProtocol; +@import MVMCore.MVMCorePresentationDelegateProtocol; +@import MVMCore.MVMCoreActionDelegateProtocol; @import MVMCore.NSDictionary_MFConvenience; @import MVMCore.MVMCoreLoadObject; @import MVMCore.MVMCoreJSONConstants; +@import MVMCore.MVMCoreRequestParameters; +@import MVMCore.MVMCoreActionHandler; +@import MVMCore.MVMCoreTopAlertObject; +@import MVMCore.MVMCoreAlertObject; +@import MVMCore.MVMCoreViewControllerProtocol; +@import MVMCore.MVMCoreViewManagerViewControllerProtocol; #import #import - -#import -#import -#import -#import -#import -#import - #import #import diff --git a/MVMCoreUI/BaseControllers/MFViewController.m b/MVMCoreUI/BaseControllers/MFViewController.m index 69d981b0..4ba60b7c 100644 --- a/MVMCoreUI/BaseControllers/MFViewController.m +++ b/MVMCoreUI/BaseControllers/MFViewController.m @@ -7,33 +7,33 @@ // #import "MFViewController.h" -#import -#import -#import -#import "MVMCoreUISplitViewController.h" -#import -#import -#import "MVMCoreUITabBarPageControlViewController.h" -#import -#import "MFLoadImageView.h" -#import "MFFonts.h" -#import -#import -#import -#import -#import -#import -#import -#import +@import MVMCore.MVMCoreAlertHandler; +@import MVMCore.MVMCoreSessionTimeHandler; +@import MVMCore.MVMCoreAlertObject; +@import MVMCore.MVMCoreLoadHandler; +@import MVMCore.MVMCoreNavigationHandler; +@import MVMCore.MVMCoreActionHandler; +@import MVMCore.MVMCoreTopAlertObject; +@import MVMCore.MVMCoreDispatchUtility; +@import MVMCore.MVMCoreActionUtility; +@import MVMCore.NSDictionary_MFConvenience; +@import MVMCore.MVMCoreLoadObject; +@import MVMCore.NSArray_MFConvenience; +@import MVMCore.MVMCoreGetterUtility; +@import MVMCore.MVMCoreConstants; #import "NSLayoutConstraint+MFConvenience.h" #import "UIColor+MFConvenience.h" #import "MVMCoreUICommonViewsUtility.h" #import "MFStyler.h" +#import "MVMCoreUISplitViewController.h" +#import "MVMCoreUITabBarPageControlViewController.h" +#import "MFLoadImageView.h" +#import "MFFonts.h" +#import #import "MVMCoreUIUtility.h" #import "MVMCoreUIConstants.h" #import "MVMCoreUISession.h" #import "MVMCoreUILoggingHandler.h" -@import MVMCore.MVMCoreConstants; @import MVMAnimationFramework; diff --git a/MVMCoreUI/BaseControllers/ProgrammaticScrollViewController.m b/MVMCoreUI/BaseControllers/ProgrammaticScrollViewController.m index fab82151..2bfeb35d 100644 --- a/MVMCoreUI/BaseControllers/ProgrammaticScrollViewController.m +++ b/MVMCoreUI/BaseControllers/ProgrammaticScrollViewController.m @@ -7,7 +7,7 @@ // #import "ProgrammaticScrollViewController.h" -#import +@import MVMCore.NSDictionary_MFConvenience; #import "NSLayoutConstraint+MFConvenience.h" #import "MVMCoreUICommonViewsUtility.h" diff --git a/MVMCoreUI/Categories/UIColor+MFConvenience.m b/MVMCoreUI/Categories/UIColor+MFConvenience.m index e73dccd4..b4ec2ea2 100644 --- a/MVMCoreUI/Categories/UIColor+MFConvenience.m +++ b/MVMCoreUI/Categories/UIColor+MFConvenience.m @@ -7,7 +7,7 @@ // #import "UIColor+MFConvenience.h" -#import +@import MVMCore.MVMCoreDispatchUtility; @implementation UIColor (MFConvenience) diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h index 1cc1ec36..2fb3c0e6 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.h @@ -8,8 +8,8 @@ // The main splitview controller. Handles the hamburger menu and other content. Used because at the time, apple's UISplitViewController wasn't robust enough to satisfy our needs. #import -#import -#import +@import MVMCore.MVMCoreActionDelegateProtocol; +@import MVMCore.MVMCoreLoadingOverlayDelegateProtocol; #import #import diff --git a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m index 617d1836..eadd6d57 100644 --- a/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m +++ b/MVMCoreUI/Containers/SplitViewController/MVMCoreUISplitViewController.m @@ -7,11 +7,11 @@ // #import "MVMCoreUISplitViewController.h" -#import -#import -#import -#import -#import +@import MVMCore.MVMCoreNavigationHandler; +@import MVMCore.MVMCoreDispatchUtility; +@import MVMCore.MVMCoreViewControllerProtocol; +@import MVMCore.MVMCoreViewManagerProtocol; +@import MVMCore.MVMCoreObject; #import "MVMCoreUIUtility.h" #import "UIColor+MFConvenience.h" #import "NSLayoutConstraint+MFConvenience.h" diff --git a/MVMCoreUI/Containers/TabBarController/MFTabBarSwipeAnimator.h b/MVMCoreUI/Containers/TabBarController/MFTabBarSwipeAnimator.h index 90b56390..675dba6d 100644 --- a/MVMCoreUI/Containers/TabBarController/MFTabBarSwipeAnimator.h +++ b/MVMCoreUI/Containers/TabBarController/MFTabBarSwipeAnimator.h @@ -8,7 +8,7 @@ // Used for animating left and right pushing of a UIViewController, usually through swiping. #import -#import +@import MVMCore.MVMCoreViewControllerAnimatedTransitioning; @interface MFTabBarSwipeAnimator : NSObject diff --git a/MVMCoreUI/Containers/TabBarController/MVMCoreUITabBarPageControlViewController.h b/MVMCoreUI/Containers/TabBarController/MVMCoreUITabBarPageControlViewController.h index daba7599..6ee1e9e6 100644 --- a/MVMCoreUI/Containers/TabBarController/MVMCoreUITabBarPageControlViewController.h +++ b/MVMCoreUI/Containers/TabBarController/MVMCoreUITabBarPageControlViewController.h @@ -8,8 +8,7 @@ #import #import -#import - +@import MVMCore.MVMCoreViewManagerProtocol; @class MVMCoreLoadObject; @interface MVMCoreUITabBarPageControlViewController : MFViewController diff --git a/MVMCoreUI/Containers/TabBarController/MVMCoreUITabBarPageControlViewController.m b/MVMCoreUI/Containers/TabBarController/MVMCoreUITabBarPageControlViewController.m index 5b038e89..5c654a2f 100644 --- a/MVMCoreUI/Containers/TabBarController/MVMCoreUITabBarPageControlViewController.m +++ b/MVMCoreUI/Containers/TabBarController/MVMCoreUITabBarPageControlViewController.m @@ -7,16 +7,16 @@ // #import "MVMCoreUITabBarPageControlViewController.h" -#import -#import -#import -#import -#import -#import -#import +@import MVMCore.MVMCoreActionHandler; +@import MVMCore.MVMCoreNavigationHandler; +@import MVMCore.MVMCoreSessionTimeHandler; +@import MVMCore.MVMCoreLoadObject; +@import MVMCore.MVMCoreJSONConstants; +@import MVMCore.MVMCoreConstants; +@import MVMCore.MVMCoreRequestParameters; +@import MVMCore.NSArray_MFConvenience; +@import MVMCore.NSDictionary_MFConvenience; #import "UIColor+MFConvenience.h" -#import -#import #import "SeparatorView.h" #import "MFTabBarSwipeAnimator.h" #import "MFTabBarInteractor.h" @@ -321,7 +321,6 @@ } - (NSInteger)tabForPageWithPageType:(nullable NSString *)pageType { - NSInteger index = NSNotFound; if (pageType.length > 0) { @@ -370,7 +369,6 @@ } - (BOOL)shouldSelectItemAtIndex:(NSInteger)index topTabbar:(TopTabbar *)topTabbar { - if (topTabbar.selectedIndex != index) { self.previousIndex = self.selectedIndex; @@ -410,7 +408,6 @@ } - (void)handleOpenPageForRequestParameters:(MVMCoreRequestParameters *)requestParameters actionInformation:(NSDictionary *)actionInformation additionalData:(NSDictionary *)additionalData { - if ([additionalData boolForKey:@"tabBarPressed"]) { requestParameters.navigationController = self.tabNavigationController; requestParameters.loadStyle = MFLoadStyleReplaceCurrent; @@ -422,7 +419,6 @@ } - (void)topTabbar:(nonnull TopTabbar *)topTabbar didSelectItemAtIndex:(NSInteger)index { - } - (nullable id )navigationController:(nonnull UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(nonnull MFViewController *)fromVC toViewController:(nonnull MFViewController *)toVC { diff --git a/MVMCoreUI/Containers/TabBarController/TopTabbar.h b/MVMCoreUI/Containers/TabBarController/TopTabbar.h index 84b0da70..e63911e7 100644 --- a/MVMCoreUI/Containers/TabBarController/TopTabbar.h +++ b/MVMCoreUI/Containers/TabBarController/TopTabbar.h @@ -5,9 +5,6 @@ // Created by Chris Yang on 1/14/16. // Copyright © 2016 Verizon Wireless. All rights reserved. // - - - //************************************************************************************************ //* Please use datasource and delegate to populate the bar as well as set the action for each tab // @@ -18,17 +15,11 @@ //* alternately you can subclass TopTabbarViewController //************************************************************************************************ - - #import - #import - @protocol TopTabbarDataSource; - @protocol TopTabbarDelegate; - @interface TopTabbar : MFView @property (nullable, weak, nonatomic) UICollectionView *collectionView; diff --git a/MVMCoreUI/Containers/TabBarController/TopTabbar.m b/MVMCoreUI/Containers/TabBarController/TopTabbar.m index bc114d36..81686717 100644 --- a/MVMCoreUI/Containers/TabBarController/TopTabbar.m +++ b/MVMCoreUI/Containers/TabBarController/TopTabbar.m @@ -9,12 +9,12 @@ #import "TopTabbar.h" #import "MVMCoreUICommonViewsUtility.h" #import "MFStyler.h" -#import #import "UIColor+MFConvenience.h" #import "NSLayoutConstraint+MFConvenience.h" #import "MVMCoreUIUtility.h" -#import #import "MVMCoreUICommonViewsUtility.h" +@import MVMCore.MVMCoreConstants; +@import MVMCore.MVMCoreDispatchUtility; static const CGFloat ITEM_WIDTH = 32; static const CGFloat ITEM_HEIGHT = 34; @@ -31,7 +31,6 @@ static NSString * const COLLECTION_CELL_ID = @"cell"; @interface TopTabbar () - @property (weak, nonatomic) UICollectionViewLayout *collectionViewLayout; @property (weak, nonatomic) UIView *bottomLine; @property (weak, nonatomic) UIScrollView *bottomScrollView; @@ -48,10 +47,7 @@ static NSString * const COLLECTION_CELL_ID = @"cell"; @implementation TopTabbar - - - (instancetype)init { - self = [super init]; if (self) { [self setUpConstraints]; @@ -60,7 +56,6 @@ static NSString * const COLLECTION_CELL_ID = @"cell"; } - (instancetype)initWithFrame:(CGRect)frame { - self = [super initWithFrame:frame]; if (self) { [self setUpConstraints]; @@ -127,7 +122,6 @@ static NSString * const COLLECTION_CELL_ID = @"cell"; [self bringSubviewToFront:self.bottomScrollView]; } - - (void)setUpConstraints { self.collectionView.translatesAutoresizingMaskIntoConstraints = NO; [NSLayoutConstraint constraintPinSubviewToSuperview:self.collectionView]; @@ -174,7 +168,6 @@ static NSString * const COLLECTION_CELL_ID = @"cell"; } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { - UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:COLLECTION_CELL_ID forIndexPath:indexPath]; NSString *title = nil; @@ -199,7 +192,6 @@ static NSString * const COLLECTION_CELL_ID = @"cell"; label.text = title; [label layoutIfNeeded]; label.baselineAdjustment = UIBaselineAdjustmentAlignCenters; - //set up cell acceessibility label cell.isAccessibilityElement = NO; @@ -252,7 +244,6 @@ static NSString * const COLLECTION_CELL_ID = @"cell"; - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { - // Check if we should select the tab. BOOL shouldSelect = YES; if ([self.delegate respondsToSelector:@selector(shouldSelectItemAtIndex:topTabbar:)]){ @@ -280,7 +271,6 @@ static NSString * const COLLECTION_CELL_ID = @"cell"; #pragma mark - underLine - (void)moveUnderToIndex:(NSIndexPath *)indexPath animated:(BOOL)animated cell:(UICollectionViewCell *)cell { - UILabel *label = [cell viewWithTag:-10]; if (label) { @@ -311,7 +301,6 @@ static NSString * const COLLECTION_CELL_ID = @"cell"; } - (void)setUnderLineFromIndex:(NSIndexPath *)fromIndexPath toIndex:(NSIndexPath *)toIndexPath percentage:(CGFloat)percentage { - BOOL goRight = fromIndexPath.row < toIndexPath.row; UICollectionViewCell *fromCell = [self.collectionView cellForItemAtIndexPath:fromIndexPath]; @@ -360,11 +349,8 @@ static NSString * const COLLECTION_CELL_ID = @"cell"; } - (void)selectIndex:(NSInteger)index animated:(BOOL)animated { - if (self.collectionView) { - [MVMCoreDispatchUtility performBlockOnMainThread:^{ - NSInteger currentIndex = self.selectedIndex; self.selectedIndex = index; @@ -390,7 +376,6 @@ static NSString * const COLLECTION_CELL_ID = @"cell"; } - (void)deselectCurrentIndex:(NSInteger)currentIndex { - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:currentIndex inSection:0]; [self.collectionView deselectItemAtIndexPath:indexPath animated:NO]; [self.collectionView reloadItemsAtIndexPaths:@[indexPath]]; @@ -398,7 +383,6 @@ static NSString * const COLLECTION_CELL_ID = @"cell"; //this is an aux method for the cell selection animation and delegate signal fire - (void)selectItemAtIndex:(NSInteger)index animated:(BOOL)animated { - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:index inSection:0]; // Determine if the cell is visible @@ -438,5 +422,4 @@ static NSString * const COLLECTION_CELL_ID = @"cell"; [self.collectionView reloadData]; } - @end diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertBaseView.h b/MVMCoreUI/TopAlert/MVMCoreUITopAlertBaseView.h index 91177a47..9391356c 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertBaseView.h +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertBaseView.h @@ -27,9 +27,6 @@ // Adds a close button. - (nonnull MFCustomButton *)addCloseButtonWithAnimationDelegate:(nullable id )animationDelegate; -// Sets the background color based on the type -- (void)setColorForType:(nullable NSString *)type; - // Handles making various parts accessible. - (void)handleAccessibility; diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertBaseView.m b/MVMCoreUI/TopAlert/MVMCoreUITopAlertBaseView.m index 6d3a2786..4b19c49c 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertBaseView.m +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertBaseView.m @@ -82,26 +82,6 @@ } verticalCentered:YES]; } -- (void)setColorForType:(nullable NSString *)type { - /*switch (type) { - case MFTopTypeError: - self.backgroundColor = [UIColor mfPumpkinColor]; - break; - case MFTopTypeConfirmation: - self.backgroundColor = [UIColor mfShamrock]; - break; - case MFTopTypeSurvival: - self.backgroundColor = [UIColor mfPumpkinColor]; - break; - case MFTopTypeRewardAlert: - self.backgroundColor = [UIColor mfShamrock]; - break; - default: - self.backgroundColor = [UIColor mfShamrock]; - break; - }*/ -} - - (void)handleAccessibility { } diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertExpandableView.m b/MVMCoreUI/TopAlert/MVMCoreUITopAlertExpandableView.m index c6a53691..2be7c4f1 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertExpandableView.m +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertExpandableView.m @@ -18,6 +18,7 @@ #import "MFStyler.h" #import "NSLayoutConstraint+MFConvenience.h" #import "MVMCoreUIUtility.h" +#import "MVMCoreUITopAlertView.h" @interface MVMCoreUITopAlertExpandableView () @@ -99,7 +100,7 @@ if (topAlertObject.backgroundColor) { self.backgroundColor = topAlertObject.backgroundColor; } else { - [self setColorForType:topAlertObject.type]; + self.backgroundColor = [[MVMCoreUITopAlertView sharedGlobal] getBackgroundColorForType:topAlertObject.type]; } if (topAlertObject.textColor) { self.shortView.label.textColor = topAlertObject.textColor; @@ -111,8 +112,7 @@ } else { // Old style, has no top alert and main view is limited. - [self setColorForType:topAlertObject.type]; - [self setupTopMessage:nil]; + self.backgroundColor = [[MVMCoreUITopAlertView sharedGlobal] getBackgroundColorForType:topAlertObject.type]; [self setupTopMessage:nil]; MVMCoreUITopAlertMainView *topAlertWithButton = [[MVMCoreUITopAlertMainView alloc] initWithColor:self.backgroundColor message:topAlertObject.message subMessage:nil closeButton:YES animationDelegate:animationDelegate]; [self setupTopAlertWithButton:topAlertWithButton]; [self expand:NO]; diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.m b/MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.m index e0595e7c..01870572 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.m +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertMainView.m @@ -18,6 +18,7 @@ #import "MFLoadImageView.h" #import #import "MVMCoreUICommonViewsUtility.h" +#import "MVMCoreUITopAlertView.h" @interface MVMCoreUITopAlertMainView () @@ -62,7 +63,7 @@ if (topAlertObject.backgroundColor) { self.backgroundColor = topAlertObject.backgroundColor; } else { - [self setColorForType:topAlertObject.type]; + self.backgroundColor = [[MVMCoreUITopAlertView sharedGlobal] getBackgroundColorForType:topAlertObject.type]; } [self setupViewWithLabelAndImage:topAlertObject.imageNameOrURL topImage:topAlertObject.aboveTextImageString]; [self setupCloseButton:topAlertObject.useCloseButton animationDelegate:animationDelegate]; diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h index 90c60f6d..05943ee8 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h @@ -7,15 +7,16 @@ // #import -#import -#import -#import -#import -#import -#import +@import MVMCore.MVMCoreTopAlertAnimationDelegateProtocol; +@import MVMCore.MVMCoreLoadDelegateProtocol; +@import MVMCore.MVMCoreActionDelegateProtocol; +@import MVMCore.MVMCorePresentationDelegateProtocol; +@import MVMCore.MVMCoreTopAlertViewProtocol; #import +#import @class MVMCoreTopAlertObject; +@class MVMCoreUITopAlertBaseView; @interface MVMCoreUITopAlertView : MFView @@ -37,4 +38,10 @@ - (void)expandStatusBarView; - (void)collapseStatusBarView; +// Can be subclassed for custom views. +- (nonnull MVMCoreUITopAlertBaseView *)topAlertViewForTopAlertObject:(nullable MVMCoreTopAlertObject *)topAlertObject animationDelegate:(nonnull id )animationDelegate statusBarColor:(UIColor *_Nullable *_Nullable)statusBarColor; + +// Get the background color based on the type +- (nonnull UIColor *)getBackgroundColorForType:(nullable NSString *)type; + @end diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m index a236fdd2..60988f9f 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.m @@ -8,27 +8,27 @@ #import "MVMCoreUITopAlertView.h" #import "PrimaryButton.h" -#import +#import "MVMCoreUICommonViewsUtility.h" +#import "UIColor+MFConvenience.h" #import "MVMCoreUITopAlertShortView.h" -#import -#import -#import #import "MVMCoreUITopAlertMainView.h" #import "MVMCoreUITopAlertExpandableView.h" #import "MVMCoreUISplitViewController.h" #import "MFViewController.h" -#import -#import -#import -#import "MVMCoreUICommonViewsUtility.h" -#import "UIColor+MFConvenience.h" -#import #import "NSLayoutConstraint+MFConvenience.h" -#import -#import -#import #import "MVMCoreUISession.h" #import "MVMCoreUIUtility.h" +@import MVMCore.MVMCoreTopAlertObject; +@import MVMCore.MVMCoreLoadHandler; +@import MVMCore.MVMCoreNavigationHandler; +@import MVMCore.MVMCoreBlockOperation; +@import MVMCore.MVMCoreAlertObject; +@import MVMCore.MVMCoreActionHandler; +@import MVMCore.MVMCoreAlertHandler; +@import MVMCore.NSDictionary_MFConvenience; +@import MVMCore.MVMCoreRequestParameters; +@import MVMCore.MVMCoreJSONConstants; +@import MVMCore.MVMCoreDispatchUtility; NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; @@ -50,6 +50,10 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; @implementation MVMCoreUITopAlertView ++ (instancetype)mainSplitViewController { + return [MVMCoreUISession sharedGlobal].topAlertView; +} + - (void)setupView { [super setupView]; if (!self.statusBarView) { @@ -87,6 +91,22 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; } } +- (nonnull MVMCoreUITopAlertBaseView *)topAlertViewForTopAlertObject:(nullable MVMCoreTopAlertObject *)topAlertObject animationDelegate:(nonnull id )animationDelegate statusBarColor:(UIColor *_Nullable *_Nullable)statusBarColor { + MVMCoreUITopAlertExpandableView *view = [[MVMCoreUITopAlertExpandableView alloc] initWithTopAlertObject:topAlertObject animationDelegate:animationDelegate viewToLayout:self.superview]; + if (statusBarColor && view.shortView.label.text) { + *statusBarColor = view.backgroundColor; + } + return view; +} + +- (nonnull UIColor *)getBackgroundColorForType:(nullable NSString *)type { + if ([type isEqualToString:ValueTypeError]) { + return [UIColor mfPumpkinColor]; + } else { + return [UIColor mfShamrock]; + } +} + - (void)showWithTopAlertObject:(nullable MVMCoreTopAlertObject *)topAlertObject animationDelegate:(nonnull id )animationDelegate completionHandler:(void (^ __nullable)(BOOL finished))completionHandler { self.animationDelegate = animationDelegate; @@ -95,120 +115,11 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed."; self.topAlertObject = topAlertObject; self.topAlertClearspotView = nil; - MVMCoreUITopAlertBaseView *view = nil; - UIColor *statusBarColor = [UIColor whiteColor]; - if (topAlertObject.useNewStyle) { - - // New style is controlled by server. (introduced 1.5. Only worked with type error, confirmation, and familybasechild from 1.5 to build 5.15 because of bug) - MVMCoreUITopAlertExpandableView *newStyleTopAlert = [[MVMCoreUITopAlertExpandableView alloc] initWithTopAlertObject:topAlertObject animationDelegate:animationDelegate viewToLayout:self.superview]; - if (newStyleTopAlert.shortView.label.text) { - statusBarColor = newStyleTopAlert.backgroundColor; - } - view = newStyleTopAlert; - } else { - - // Old style is hardcoded based on type value. - /*switch (topAlertObject.type) { - case MFTopTypeOther: - case MFTopTypeError: - { - // no icon for 2.0 - view = [[MVMCoreUITopAlertMainView alloc] initWithColor:[UIColor mfPumpkinColor] message:topAlertObject.message subMessage:nil closeButton:YES animationDelegate:animationDelegate]; - } - break; - case MFTopTypeFamilyBaseChild: - case MFTopTypeConfirmation: - { - view = [[MVMCoreUITopAlertMainView alloc] initWithColor:[UIColor mfShamrock] message:topAlertObject.message subMessage:nil closeButton:YES animationDelegate:animationDelegate]; - } - break; - case MFTopTypeSurvival: - { - MVMCoreUITopAlertExpandableView *survivalMode = [[MVMCoreUITopAlertExpandableView alloc] initWithTopMessage:topAlertObject.title message:topAlertObject.title subMessage:topAlertObject.message actionMap:topAlertObject.buttonMap additionalData:topAlertObject.additionalData animationDelegate:animationDelegate viewToLayout:self.superview]; - [MVMCoreUITopAlertBaseView addActionToButton:survivalMode.shortView.button actionMap:topAlertObject.buttonMap additionalData:topAlertObject.additionalData]; - survivalMode.onlyShowTopMessageWhenCollapsed = YES; - survivalMode.collapseAutomaticallyAfterExpanded = YES; - [survivalMode expand:NO]; - statusBarColor = [UIColor mfPumpkinColor]; - survivalMode.backgroundColor = statusBarColor; - view = survivalMode; - } - break; - case MFTopTypeShop: - { - MVMCoreUITopAlertExpandableView *shopView = [[MVMCoreUITopAlertExpandableView alloc] initWithTopMessage:topAlertObject.message message:topAlertObject.title subMessage:nil actionMap:topAlertObject.buttonMap additionalData:topAlertObject.additionalData animationDelegate:animationDelegate viewToLayout:self.superview]; - [shopView setShortViewPressToExpand]; - shopView.collapseAutomaticallyAfterExpanded = YES; - statusBarColor = [UIColor mfCerulean]; - shopView.backgroundColor = statusBarColor; - view = shopView; - } - break; - case MFTopTypeBlueWithButton: - { - view = [[MVMCoreUITopAlertMainView alloc] initWithColor:[UIColor mfShamrock] message:topAlertObject.title subMessage:topAlertObject.message actionMap:topAlertObject.buttonMap additionalData:topAlertObject.additionalData]; - } - break; - case MFTopTypeClearspotMain: - { - // Gets the time if already sent. - NSString *topMessage = nil; - NSString *topMessageAccessibilityLabel = nil; - if (self.time) { - topMessage = [NSString stringWithFormat:@"%@ %@",self.time,self.topAlertObject.message]; - NSArray *timeArray = [self.time componentsSeparatedByString:@":"]; - topMessageAccessibilityLabel =[NSString stringWithFormat:@"%@ minutes %@ seconds %@",timeArray[0],timeArray[1],self.topAlertObject.message]; - self.time = nil; - } else { - topMessage = topAlertObject.message; - } - - MVMCoreUITopAlertExpandableView *clearspotView = [[MVMCoreUITopAlertExpandableView alloc] initWithTopMessage:topMessage message:topAlertObject.title buttonTitle:[topAlertObject.buttonMap stringForKey:KeyTitle] animationDelegate:animationDelegate viewToLayout:self.superview]; - clearspotView.collapseAutomaticallyAfterExpanded = YES; - - // Collapse if main button pressed. - [clearspotView setButtonPressToCollapse]; - - statusBarColor = [UIColor mfShamrock]; - clearspotView.backgroundColor = statusBarColor; - view = clearspotView; - self.topAlertClearspotView = clearspotView; - self.topAlertClearspotView.shortView.label.accessibilityLabel = topMessageAccessibilityLabel; - } - break; - case MFTopTypeClearspotFinished: - { - view = [[MVMCoreUITopAlertMainView alloc] initWithColor:[UIColor mfShamrock] message:topAlertObject.title subMessage:topAlertObject.message actionMap:topAlertObject.buttonMap additionalData:topAlertObject.additionalData]; - } - break; - case MFTopTypeClearspotProcessing: - view = [[MVMCoreUITopAlertMainView alloc] initWithColor:[UIColor mfShamrock] message:topAlertObject.title subMessage:topAlertObject.message closeButton:NO animationDelegate:animationDelegate]; - break; - case MFTopTypeAgentChatInSession: - { - MVMCoreUITopAlertExpandableView *chatView = [[MVMCoreUITopAlertExpandableView alloc] initWithTopMessage:topAlertObject.topMessage message:topAlertObject.title subMessage:topAlertObject.message buttonTitle:topAlertObject.buttonTitle animationDelegate:animationDelegate viewToLayout:self.superview]; - [chatView setShortViewPressToExpand]; - chatView.collapseAutomaticallyAfterExpanded = YES; - statusBarColor = [UIColor mfCerulean]; - chatView.backgroundColor = statusBarColor; - view = chatView; - } - break; - case MFTopTypeRemoteIn: - view = [[MVMCoreUITopAlertMainView alloc] initWithColor:[UIColor mfShamrock] message:topAlertObject.title subMessage:topAlertObject.message buttonTitle:topAlertObject.buttonTitle userActionHandler:topAlertObject.userActionHandler]; - break; - case MFTopTypeRewardAlert: - { - // no icons for 2.0 - view = [[MVMCoreUITopAlertMainView alloc] initWithColor:[UIColor mfShamrock] message:topAlertObject.title subMessage:topAlertObject.message actionMap:topAlertObject.buttonMap additionalData:topAlertObject.additionalData closeButton:NO animationDelegate:nil]; - - break; - } - default: - break; - }*/ - } - + UIColor *statusBarColor = nil; + MVMCoreUITopAlertBaseView *view = [self topAlertViewForTopAlertObject:topAlertObject animationDelegate:animationDelegate statusBarColor:&statusBarColor]; + if (!statusBarColor) { + statusBarColor = [UIColor whiteColor]; + } UIStatusBarStyle statusBarStyle = statusBarColor == [UIColor whiteColor] ? UIStatusBarStyleDefault : UIStatusBarStyleLightContent; [self setStatusBarColor:statusBarColor statusBarStyle:statusBarStyle]; [self showAlertView:view topAlertObject:topAlertObject completionHandler:completionHandler]; diff --git a/MVMCoreUI/Utility/MFFonts.m b/MVMCoreUI/Utility/MFFonts.m index b69efc1a..5948a527 100644 --- a/MVMCoreUI/Utility/MFFonts.m +++ b/MVMCoreUI/Utility/MFFonts.m @@ -9,7 +9,7 @@ #import "MFFonts.h" #import #import "MVMCoreUIUtility.h" -#import +@import MVMCore.MVMCoreLoggingHandler; @implementation MFFonts diff --git a/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.h b/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.h index 159edeb4..3d212499 100644 --- a/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.h +++ b/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.h @@ -55,12 +55,6 @@ // Creates and returns a common form textView, which will detect html tags, links. + (nonnull UITextView *)commonFormTextView; -// Creates and returns a common text view which can be used for user entry. Constrains the height. -+ (nonnull UITextView *)commonTextViewForUserEntry:(nullable id )delegate; - -// Creates and returns a common view containing a text view with a placeholder text. Points the passed in pointers to the created object. -+ (nonnull UIView *)commonTextView:(CustomTextView *_Nullable *_Nullable)textView withPlaceholder:(NSString *_Nullable)placeholder delegate:(nullable id )delegate; - // will setup data detector types for textview on the basis of device // For example: iPad should not detect phone number link + (void)setDataDetectorTypesForTextView:(nonnull UITextView *)textView; @@ -72,11 +66,6 @@ //if verticalCentered is true, the button will pin to the vertical center of the view instead of top right + (nonnull MFCustomButton *)addCloseButtonToView:(nullable UIView *)view action:(nonnull ButtonTapBlock)actionBlock verticalCentered:(BOOL)verticalCentered; -#pragma mark - Combination Views - -// Creates and returns a common view containing a label and a text view under it. Points the passed in pointers to the created objects. -+ (nonnull UIView *)commonTextView:(UITextView *_Nullable *_Nullable)textView withLabel:(UILabel *_Nullable *_Nullable)label delegate:(nullable id )delegate; - #pragma mark - Toolbar // seperate this to its own function to reuse while keeping styling the same. diff --git a/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.m b/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.m index efe5791c..a8a90a50 100644 --- a/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.m +++ b/MVMCoreUI/Utility/MVMCoreUICommonViewsUtility.m @@ -11,11 +11,11 @@ #import "MFTextView.h" #import "MFStyler.h" #import "UIColor+MFConvenience.h" -#import #import "NSLayoutConstraint+MFConvenience.h" #import "MVMCoreUIUtility.h" -#import -#import +@import MVMCore.NSDictionary_MFConvenience; +@import MVMCore.MVMCoreConstants; +@import MVMCore.MVMCoreGetterUtility; static const CGFloat HorizontalShadowInset = 5; static const CGFloat VertialShadowOffset = 6; @@ -212,34 +212,6 @@ static const CGFloat VertialShadowOffset = 6; return textView; } -+ (nonnull UITextView *)commonTextViewForUserEntry:(nullable id )delegate { - - UITextView *genericTextView = [[UITextView alloc] initWithFrame:CGRectZero]; - //genericTextView.font = [MFStyler fontForStandardMessageLabel]; - genericTextView.dataDetectorTypes = UIDataDetectorTypeNone; - genericTextView.delegate = delegate; - - genericTextView.layer.cornerRadius = 3.0f; - genericTextView.layer.masksToBounds = YES; - //genericTextView.layer.borderColor = [UIColor mvmWayfinderLightTextColor].CGColor; - genericTextView.layer.borderWidth = 1.0f; - - genericTextView.translatesAutoresizingMaskIntoConstraints = NO; - [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[genericTextView(==100)]" options:0 metrics:nil views:NSDictionaryOfVariableBindings(genericTextView)]]; - - return genericTextView; -} - -+ (nonnull UIView *)commonTextView:(CustomTextView *_Nullable *_Nullable)textView withPlaceholder:(NSString *_Nullable)placeholder delegate:(nullable id )delegate { - MFTextView *view = [MFTextView MFTextViewWithPlaceholderString:placeholder delegate:delegate]; - - if (view.textView) { - *textView = view.textView; - } - - return view; -} - + (void)setDataDetectorTypesForTextView:(nonnull UITextView *)textView { // Do not detect/call number on iPad @@ -279,34 +251,6 @@ static const CGFloat VertialShadowOffset = 6; return button; } -#pragma mark - Combination Views - -+ (nonnull UIView *)commonTextView:(UITextView *_Nullable *_Nullable)textView withLabel:(UILabel *_Nullable *_Nullable)label delegate:(nullable id )delegate { - - UIView *view = [MVMCoreUICommonViewsUtility commonView]; - - UILabel *genericLabel = [MVMCoreUICommonViewsUtility commonLabelB2]; - - UITextView *genericTextView = [MVMCoreUICommonViewsUtility commonTextViewForUserEntry:delegate]; - - [view addSubview:genericLabel]; - [view addSubview:genericTextView]; - - [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[genericLabel]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(genericLabel)]]; - [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[genericTextView]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(genericTextView)]]; - [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[genericLabel]-space-[genericTextView]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:@{@"space":@(4)} views:NSDictionaryOfVariableBindings(genericLabel,genericTextView)]]; - - if (label) { - *label = genericLabel; - } - - if (textView) { - *textView = genericTextView; - } - - return view; -} - #pragma mark - Toolbar + (nonnull UIToolbar *)makeEmptyToolbar { diff --git a/MVMCoreUI/Utility/Sizing/MFSizeObject.m b/MVMCoreUI/Utility/Sizing/MFSizeObject.m index 41a9cd27..1acf878b 100644 --- a/MVMCoreUI/Utility/Sizing/MFSizeObject.m +++ b/MVMCoreUI/Utility/Sizing/MFSizeObject.m @@ -8,7 +8,7 @@ #import #import "MVMCoreUISplitViewController.h" -#import +@import MVMCore.MVMCoreGetterUtility; CGFloat const MFSizeiPhone4HeightThreshold = 490; CGFloat const MFSizeiPhone5HeightThreshold = 578;