top alert fix

This commit is contained in:
Pfeil, Scott Robert 2019-01-16 15:51:30 -05:00
parent d4ed766298
commit 18e8d59a97
24 changed files with 121 additions and 325 deletions

View File

@ -8,7 +8,7 @@
// The view controller used during loading. Used by the loading handler.
#import <UIKit/UIKit.h>
#import <MVMCore/MVMCoreLoadingViewControllerProtocol.h>
@import MVMCore.MVMCoreLoadingViewControllerProtocol;
@interface MFLoadingViewController : UIViewController <MVMCoreLoadingViewControllerProtocol>

View File

@ -8,7 +8,7 @@
#import "MFProgrammaticTableViewController.h"
#import "NSLayoutConstraint+MFConvenience.h"
#import <MVMCore/NSDictionary+MFConvenience.h>
@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]];
}

View File

@ -7,13 +7,13 @@
//
#import "MFScrollingViewController.h"
#import <MVMCore/MVMCoreDispatchUtility.h>
#import "MFTransparentGIFView.h"
#import <MVMCore/MVMCoreGetterUtility.h>
#import <MVMCore/MVMCoreLoadObject.h>
#import <MVMCore/NSDictionary+MFConvenience.h>
@import MVMCore.MVMCoreDispatchUtility;
@import MVMCore.MVMCoreGetterUtility;
@import MVMCore.MVMCoreLoadObject;
@import MVMCore.NSDictionary_MFConvenience;
@import MVMCore.MVMCoreJSONConstants;
#import "NSLayoutConstraint+MFConvenience.h"
#import <MVMCore/MVMCoreJSONConstants.h>
#import "MFTransparentGIFView.h"
#import "MVMCoreUIUtility.h"
#import "MVMCoreUIConstants.h"
#import "MVMCoreUISession.h"

View File

@ -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 <UIKit/UIKit.h>
#import <MVMCore/MVMCoreErrorObject.h>
#import <MVMCore/MVMCoreLoadDelegateProtocol.h>
#import <MVMCore/MVMCorePresentationDelegateProtocol.h>
#import <MVMCore/MVMCoreActionDelegateProtocol.h>
@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 <MVMCoreUI/MFTextField.h>
#import <MVMCoreUI/ButtonDelegateProtocol.h>
#import <MVMCore/MVMCoreRequestParameters.h>
#import <MVMCore/MVMCoreActionHandler.h>
#import <MVMCore/MVMCoreTopAlertObject.h>
#import <MVMCore/MVMCoreAlertObject.h>
#import <MVMCore/MVMCoreViewControllerProtocol.h>
#import <MVMCore/MVMCoreViewManagerViewControllerProtocol.h>
#import <MVMCoreUI/MFStyler.h>
#import <MVMCoreUI/MVMCoreUIDetailViewProtocol.h>

View File

@ -7,33 +7,33 @@
//
#import "MFViewController.h"
#import <MVMCore/MVMCoreAlertHandler.h>
#import <MVMCore/MVMCoreSessionTimeHandler.h>
#import <MVMCore/MVMCoreAlertObject.h>
#import "MVMCoreUISplitViewController.h"
#import <MVMCore/MVMCoreLoadHandler.h>
#import <MVMCore/MVMCoreNavigationHandler.h>
#import "MVMCoreUITabBarPageControlViewController.h"
#import <MVMCore/MVMCoreActionHandler.h>
#import "MFLoadImageView.h"
#import "MFFonts.h"
#import <MVMCoreUI/MFSizeObject.h>
#import <MVMCore/MVMCoreTopAlertObject.h>
#import <MVMCore/MVMCoreDispatchUtility.h>
#import <MVMCore/MVMCoreActionUtility.h>
#import <MVMCore/NSDictionary+MFConvenience.h>
#import <MVMCore/MVMCoreLoadObject.h>
#import <MVMCore/NSArray+MFConvenience.h>
#import <MVMCore/MVMCoreGetterUtility.h>
@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 <MVMCoreUI/MFSizeObject.h>
#import "MVMCoreUIUtility.h"
#import "MVMCoreUIConstants.h"
#import "MVMCoreUISession.h"
#import "MVMCoreUILoggingHandler.h"
@import MVMCore.MVMCoreConstants;
@import MVMAnimationFramework;

View File

@ -7,7 +7,7 @@
//
#import "ProgrammaticScrollViewController.h"
#import <MVMCore/NSDictionary+MFConvenience.h>
@import MVMCore.NSDictionary_MFConvenience;
#import "NSLayoutConstraint+MFConvenience.h"
#import "MVMCoreUICommonViewsUtility.h"

View File

@ -7,7 +7,7 @@
//
#import "UIColor+MFConvenience.h"
#import <MVMCore/MVMCoreDispatchUtility.h>
@import MVMCore.MVMCoreDispatchUtility;
@implementation UIColor (MFConvenience)

View File

@ -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 <UIKit/UIKit.h>
#import <MVMCore/MVMCoreActionDelegateProtocol.h>
#import <MVMCore/MVMCoreLoadingOverlayDelegateProtocol.h>
@import MVMCore.MVMCoreActionDelegateProtocol;
@import MVMCore.MVMCoreLoadingOverlayDelegateProtocol;
#import <MVMCoreUI/MVMCoreUIPanelProtocol.h>
#import <MVMCoreUI/MVMCoreUIPanelButtonProtocol.h>

View File

@ -7,11 +7,11 @@
//
#import "MVMCoreUISplitViewController.h"
#import <MVMCore/MVMCoreNavigationHandler.h>
#import <MVMCore/MVMCoreDispatchUtility.h>
#import <MVMCore/MVMCoreViewControllerProtocol.h>
#import <MVMCore/MVMCoreViewManagerProtocol.h>
#import <MVMCore/MVMCoreObject.h>
@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"

View File

@ -8,7 +8,7 @@
// Used for animating left and right pushing of a UIViewController, usually through swiping.
#import <UIKit/UIKit.h>
#import <MVMCore/MVMCoreViewControllerAnimatedTransitioning.h>
@import MVMCore.MVMCoreViewControllerAnimatedTransitioning;
@interface MFTabBarSwipeAnimator : NSObject <MVMCoreViewControllerAnimatedTransitioning>

View File

@ -8,8 +8,7 @@
#import <MVMCoreUI/MFViewController.h>
#import <MVMCoreUI/TopTabbar.h>
#import <MVMCore/MVMCoreViewManagerProtocol.h>
@import MVMCore.MVMCoreViewManagerProtocol;
@class MVMCoreLoadObject;
@interface MVMCoreUITabBarPageControlViewController : MFViewController <TopTabbarDataSource,TopTabbarDelegate,MVMCoreViewManagerProtocol>

View File

@ -7,16 +7,16 @@
//
#import "MVMCoreUITabBarPageControlViewController.h"
#import <MVMCore/MVMCoreActionHandler.h>
#import <MVMCore/MVMCoreNavigationHandler.h>
#import <MVMCore/MVMCoreSessionTimeHandler.h>
#import <MVMCore/MVMCoreLoadObject.h>
#import <MVMCore/MVMCoreJSONConstants.h>
#import <MVMCore/MVMCoreConstants.h>
#import <MVMCore/MVMCoreRequestParameters.h>
@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 <MVMCore/NSArray+MFConvenience.h>
#import <MVMCore/NSDictionary+MFConvenience.h>
#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 <UIViewControllerAnimatedTransitioning>)navigationController:(nonnull UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(nonnull MFViewController *)fromVC toViewController:(nonnull MFViewController *)toVC {

View File

@ -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 <UIKit/UIKit.h>
#import <MVMCoreUI/MFView.h>
@protocol TopTabbarDataSource;
@protocol TopTabbarDelegate;
@interface TopTabbar : MFView
@property (nullable, weak, nonatomic) UICollectionView *collectionView;

View File

@ -9,12 +9,12 @@
#import "TopTabbar.h"
#import "MVMCoreUICommonViewsUtility.h"
#import "MFStyler.h"
#import <MVMCore/MVMCoreConstants.h>
#import "UIColor+MFConvenience.h"
#import "NSLayoutConstraint+MFConvenience.h"
#import "MVMCoreUIUtility.h"
#import <MVMCore/MVMCoreDispatchUtility.h>
#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 () <UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
@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

View File

@ -27,9 +27,6 @@
// Adds a close button.
- (nonnull MFCustomButton *)addCloseButtonWithAnimationDelegate:(nullable id <MVMCoreTopAlertAnimationDelegateProtocol>)animationDelegate;
// Sets the background color based on the type
- (void)setColorForType:(nullable NSString *)type;
// Handles making various parts accessible.
- (void)handleAccessibility;

View File

@ -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 {
}

View File

@ -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];

View File

@ -18,6 +18,7 @@
#import "MFLoadImageView.h"
#import <MVMCore/MVMCoreJSONConstants.h>
#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];

View File

@ -7,15 +7,16 @@
//
#import <UIKit/UIKit.h>
#import <MVMCore/MVMCoreTopAlertAnimationDelegateProtocol.h>
#import <MVMCore/MVMCoreLoadDelegateProtocol.h>
#import <MVMCore/MVMCoreActionDelegateProtocol.h>
#import <MVMCoreUI/ButtonDelegateProtocol.h>
#import <MVMCore/MVMCorePresentationDelegateProtocol.h>
#import <MVMCore/MVMCoreTopAlertViewProtocol.h>
@import MVMCore.MVMCoreTopAlertAnimationDelegateProtocol;
@import MVMCore.MVMCoreLoadDelegateProtocol;
@import MVMCore.MVMCoreActionDelegateProtocol;
@import MVMCore.MVMCorePresentationDelegateProtocol;
@import MVMCore.MVMCoreTopAlertViewProtocol;
#import <MVMCoreUI/MFView.h>
#import <MVMCoreUI/ButtonDelegateProtocol.h>
@class MVMCoreTopAlertObject;
@class MVMCoreUITopAlertBaseView;
@interface MVMCoreUITopAlertView : MFView <MVMCoreTopAlertViewProtocol,MVMCoreLoadDelegateProtocol,MVMCoreActionDelegateProtocol,MVMCorePresentationDelegateProtocol,ButtonDelegateProtocol>
@ -37,4 +38,10 @@
- (void)expandStatusBarView;
- (void)collapseStatusBarView;
// Can be subclassed for custom views.
- (nonnull MVMCoreUITopAlertBaseView *)topAlertViewForTopAlertObject:(nullable MVMCoreTopAlertObject *)topAlertObject animationDelegate:(nonnull id <MVMCoreTopAlertAnimationDelegateProtocol>)animationDelegate statusBarColor:(UIColor *_Nullable *_Nullable)statusBarColor;
// Get the background color based on the type
- (nonnull UIColor *)getBackgroundColorForType:(nullable NSString *)type;
@end

View File

@ -8,27 +8,27 @@
#import "MVMCoreUITopAlertView.h"
#import "PrimaryButton.h"
#import <MVMCore/MVMCoreTopAlertObject.h>
#import "MVMCoreUICommonViewsUtility.h"
#import "UIColor+MFConvenience.h"
#import "MVMCoreUITopAlertShortView.h"
#import <MVMCore/MVMCoreLoadHandler.h>
#import <MVMCore/MVMCoreNavigationHandler.h>
#import <MVMCore/MVMCoreBlockOperation.h>
#import "MVMCoreUITopAlertMainView.h"
#import "MVMCoreUITopAlertExpandableView.h"
#import "MVMCoreUISplitViewController.h"
#import "MFViewController.h"
#import <MVMCore/MVMCoreAlertObject.h>
#import <MVMCore/MVMCoreActionHandler.h>
#import <MVMCore/MVMCoreAlertHandler.h>
#import "MVMCoreUICommonViewsUtility.h"
#import "UIColor+MFConvenience.h"
#import <MVMCore/NSDictionary+MFConvenience.h>
#import "NSLayoutConstraint+MFConvenience.h"
#import <MVMCore/MVMCoreRequestParameters.h>
#import <MVMCore/MVMCoreJSONConstants.h>
#import <MVMCore/MVMCoreDispatchUtility.h>
#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 <MVMCoreTopAlertAnimationDelegateProtocol>)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 <MVMCoreTopAlertAnimationDelegateProtocol>)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];

View File

@ -9,7 +9,7 @@
#import "MFFonts.h"
#import <CoreText/CoreText.h>
#import "MVMCoreUIUtility.h"
#import <MVMCore/MVMCoreLoggingHandler.h>
@import MVMCore.MVMCoreLoggingHandler;
@implementation MFFonts

View File

@ -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 <UITextViewDelegate>)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 <UITextViewDelegate>)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 <UITextViewDelegate>)delegate;
#pragma mark - Toolbar
// seperate this to its own function to reuse while keeping styling the same.

View File

@ -11,11 +11,11 @@
#import "MFTextView.h"
#import "MFStyler.h"
#import "UIColor+MFConvenience.h"
#import <MVMCore/NSDictionary+MFConvenience.h>
#import "NSLayoutConstraint+MFConvenience.h"
#import "MVMCoreUIUtility.h"
#import <MVMCore/MVMCoreConstants.h>
#import <MVMCore/MVMCoreGetterUtility.h>
@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 <UITextViewDelegate>)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 <UITextViewDelegate>)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 <UITextViewDelegate>)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 {

View File

@ -8,7 +8,7 @@
#import <MVMCoreUI/MFSizeObject.h>
#import "MVMCoreUISplitViewController.h"
#import <MVMCore/MVMCoreGetterUtility.h>
@import MVMCore.MVMCoreGetterUtility;
CGFloat const MFSizeiPhone4HeightThreshold = 490;
CGFloat const MFSizeiPhone5HeightThreshold = 578;