Tab updates
This commit is contained in:
parent
ac7576a74c
commit
059696141c
@ -329,6 +329,9 @@
|
||||
D28A839123CD4FD400DFE4FC /* CornerLabelsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A839023CD4FD400DFE4FC /* CornerLabelsModel.swift */; };
|
||||
D28A839323CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A839223CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift */; };
|
||||
D28BA730247EC2EB00B75CB8 /* NavigationButtomModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28BA72F247EC2EB00B75CB8 /* NavigationButtomModelProtocol.swift */; };
|
||||
D28BA741248025A300B75CB8 /* TabBarModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28BA740248025A300B75CB8 /* TabBarModel.swift */; };
|
||||
D28BA7432480284E00B75CB8 /* TabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28BA7422480284E00B75CB8 /* TabBar.swift */; };
|
||||
D28BA7452481652D00B75CB8 /* TabBarProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28BA7442481652D00B75CB8 /* TabBarProtocol.swift */; };
|
||||
D296E14722A5984C0051EBE7 /* MVMCoreUIViewConstrainingProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D29B771022C281F400D6ACE0 /* ModuleMolecule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D29B770F22C281F400D6ACE0 /* ModuleMolecule.swift */; };
|
||||
D29C94D5242901C9003813BA /* MVMCoreUICommonViewsUtility+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D29C94D4242901C9003813BA /* MVMCoreUICommonViewsUtility+Extension.swift */; };
|
||||
@ -758,6 +761,9 @@
|
||||
D28A839023CD4FD400DFE4FC /* CornerLabelsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CornerLabelsModel.swift; sourceTree = "<group>"; };
|
||||
D28A839223CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyCaretLinkImageModel.swift; sourceTree = "<group>"; };
|
||||
D28BA72F247EC2EB00B75CB8 /* NavigationButtomModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationButtomModelProtocol.swift; sourceTree = "<group>"; };
|
||||
D28BA740248025A300B75CB8 /* TabBarModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarModel.swift; sourceTree = "<group>"; };
|
||||
D28BA7422480284E00B75CB8 /* TabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBar.swift; sourceTree = "<group>"; };
|
||||
D28BA7442481652D00B75CB8 /* TabBarProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarProtocol.swift; sourceTree = "<group>"; };
|
||||
D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIViewConstrainingProtocol.h; sourceTree = "<group>"; };
|
||||
D29B770F22C281F400D6ACE0 /* ModuleMolecule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModuleMolecule.swift; sourceTree = "<group>"; };
|
||||
D29C94D4242901C9003813BA /* MVMCoreUICommonViewsUtility+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreUICommonViewsUtility+Extension.swift"; sourceTree = "<group>"; };
|
||||
@ -1219,6 +1225,8 @@
|
||||
017BEB372360C6AC0024EF95 /* RadioButtonLabel.swift */,
|
||||
D28764FA245A33A500CB882D /* TwoLinkViewModel.swift */,
|
||||
D28764F8245A327200CB882D /* TwoLinkView.swift */,
|
||||
D28BA740248025A300B75CB8 /* TabBarModel.swift */,
|
||||
D28BA7422480284E00B75CB8 /* TabBar.swift */,
|
||||
);
|
||||
path = HorizontalCombinationViews;
|
||||
sourceTree = "<group>";
|
||||
@ -1868,6 +1876,7 @@
|
||||
012A88C7238DB02000FE3DA1 /* MoleculeDelegateProtocol.swift */,
|
||||
017BEB47236230DB0024EF95 /* MoleculeViewProtocol.swift */,
|
||||
012A88AC238C418100FE3DA1 /* TemplateProtocol.swift */,
|
||||
D28BA7442481652D00B75CB8 /* TabBarProtocol.swift */,
|
||||
011B58EE23A2AA850085F53C /* ModelProtocols */,
|
||||
);
|
||||
path = Protocols;
|
||||
@ -2017,6 +2026,7 @@
|
||||
D264FAAA2440F97600D98315 /* CollectionView.swift in Sources */,
|
||||
0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */,
|
||||
D2FB151D23A40F1500C20E10 /* MoleculeStackItem.swift in Sources */,
|
||||
D28BA7452481652D00B75CB8 /* TabBarProtocol.swift in Sources */,
|
||||
AA11A41F23F15D3100D7962F /* ListRightVariablePayments.swift in Sources */,
|
||||
D28764AA2458980300CB882D /* ThreeLayerFillMiddleTemplate.swift in Sources */,
|
||||
0116A4E5228B19640094F3ED /* RadioButtonSelectionHelper.swift in Sources */,
|
||||
@ -2257,6 +2267,7 @@
|
||||
D20FB165241A5D75004AFC3A /* NavigationItemModel.swift in Sources */,
|
||||
AA2AD118244EE48C00BBFFE3 /* ListDeviceComplexLinkMediumModel.swift in Sources */,
|
||||
DB06250B2293456500B72DD3 /* LeftRightLabelView.swift in Sources */,
|
||||
D28BA741248025A300B75CB8 /* TabBarModel.swift in Sources */,
|
||||
D224798A2314445E003FCCF9 /* LabelToggle.swift in Sources */,
|
||||
D2A92882241AAB67004E01C6 /* ScrollingViewController.swift in Sources */,
|
||||
C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */,
|
||||
@ -2355,6 +2366,7 @@
|
||||
0AB764D324460FA400E7FE72 /* UIPickerView+Extension.swift in Sources */,
|
||||
D29DF29E21E7AE3B003B2FB9 /* MFStyler.m in Sources */,
|
||||
94C661D923CCF4B400D9FE5B /* LeftRightLabelModel.swift in Sources */,
|
||||
D28BA7432480284E00B75CB8 /* TabBar.swift in Sources */,
|
||||
AA26850C244840AE00CE34CC /* HeadersH2TinyButton.swift in Sources */,
|
||||
011D95AB2405C553000E3791 /* FormItemProtocol.swift in Sources */,
|
||||
D21EE53C23AD3AD4003D1A30 /* NSLayoutConstraintAxis+Extension.swift in Sources */,
|
||||
|
||||
@ -0,0 +1,79 @@
|
||||
//
|
||||
// TabBar.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 5/28/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
@objcMembers open class TabBar: UITabBar, MoleculeViewProtocol, TabBarProtocol, UITabBarDelegate {
|
||||
|
||||
public var model: TabBarModel
|
||||
public var delegateObject: MVMCoreUIDelegateObject?
|
||||
|
||||
required public init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
guard let model = model as? TabBarModel else {
|
||||
fatalError("model is not TabBarModel")
|
||||
}
|
||||
self.model = model
|
||||
super.init(frame: .zero)
|
||||
translatesAutoresizingMaskIntoConstraints = false
|
||||
delegate = self
|
||||
set(with: model, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
required public init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
guard let model = model as? TabBarModel else { return }
|
||||
self.model = model
|
||||
|
||||
// Set appearance
|
||||
if #available(iOS 13.0, *) {
|
||||
let appearance = UITabBarAppearance()
|
||||
appearance.backgroundColor = model.backgroundColor?.uiColor
|
||||
setTabBarItemColors(appearance.stackedLayoutAppearance, model: model)
|
||||
setTabBarItemColors(appearance.inlineLayoutAppearance, model: model)
|
||||
setTabBarItemColors(appearance.compactInlineLayoutAppearance, model: model)
|
||||
standardAppearance = appearance
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
backgroundColor = model.backgroundColor?.uiColor
|
||||
tintColor = model.selectedColor.uiColor
|
||||
unselectedItemTintColor = model.unSelectedColor.uiColor
|
||||
barTintColor = model.backgroundColor?.uiColor
|
||||
isTranslucent = false
|
||||
}
|
||||
|
||||
// Add buttons
|
||||
var tabs: [UITabBarItem] = []
|
||||
for (index, tab) in model.tabs.enumerated() {
|
||||
let tabBarItem = UITabBarItem(title: tab.title, image: UIImage(named: tab.image, in: MVMCoreCache.shared()?.bundleToUseForImages(), compatibleWith: nil), tag: index)
|
||||
tabs.append(tabBarItem)
|
||||
}
|
||||
setItems(tabs, animated: false)
|
||||
selectedItem = tabs[model.selectedTab]
|
||||
}
|
||||
|
||||
/// Sets the item colors.
|
||||
@available(iOS 13.0, *)
|
||||
private func setTabBarItemColors(_ itemAppearance: UITabBarItemAppearance, model: TabBarModel) {
|
||||
itemAppearance.normal.iconColor = model.unSelectedColor.uiColor
|
||||
itemAppearance.normal.titleTextAttributes = [NSAttributedString.Key.foregroundColor: model.unSelectedColor.uiColor]
|
||||
|
||||
itemAppearance.selected.iconColor = model.selectedColor.uiColor
|
||||
itemAppearance.selected.titleTextAttributes = [NSAttributedString.Key.foregroundColor: model.selectedColor.uiColor]
|
||||
}
|
||||
|
||||
// MARK: - UITabBarDelegate
|
||||
public func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {
|
||||
Button.performButtonAction(with: model.tabs[item.tag].action, button: item, delegateObject: delegateObject, additionalData: nil)
|
||||
}
|
||||
}
|
||||
|
||||
extension UITabBarItem: MFButtonProtocol {
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
//
|
||||
// TabBarModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 5/28/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public class TabBarModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "tabBar"
|
||||
public var backgroundColor: Color? = Color(uiColor: .white)
|
||||
public var tabs: [TabBarItemModel]
|
||||
public var selectedColor = Color(uiColor: .mvmBlack)
|
||||
public var unSelectedColor = Color(uiColor: .mvmCoolGray3)
|
||||
|
||||
// Must be capped to 0...(tabs.count - 1)
|
||||
public var selectedTab: Int = 0
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case backgroundColor
|
||||
case tabs
|
||||
case selectedColor
|
||||
case unSelectedColor
|
||||
case selectedTab
|
||||
}
|
||||
|
||||
public init(with tabs: [TabBarItemModel]) {
|
||||
self.tabs = tabs
|
||||
}
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
tabs = try typeContainer.decode([TabBarItemModel].self, forKey: .tabs)
|
||||
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) {
|
||||
backgroundColor = color
|
||||
}
|
||||
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .unSelectedColor) {
|
||||
unSelectedColor = color
|
||||
}
|
||||
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .selectedColor) {
|
||||
selectedColor = color
|
||||
}
|
||||
if let index = try typeContainer.decodeIfPresent(Int.self, forKey: .selectedTab) {
|
||||
selectedTab = index
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encode(tabs, forKey: .tabs)
|
||||
try container.encode(backgroundColor, forKey: .backgroundColor)
|
||||
try container.encode(selectedColor, forKey: .selectedColor)
|
||||
try container.encode(unSelectedColor, forKey: .unSelectedColor)
|
||||
try container.encode(selectedTab, forKey: .selectedTab)
|
||||
}
|
||||
}
|
||||
|
||||
public class TabBarItemModel: Codable {
|
||||
var title: String
|
||||
var image: String
|
||||
var action: ActionModelProtocol
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case title
|
||||
case image
|
||||
case action
|
||||
}
|
||||
|
||||
public init(with title: String, image: String, action: ActionModelProtocol) {
|
||||
self.title = title
|
||||
self.image = image
|
||||
self.action = action
|
||||
}
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
title = try typeContainer.decode(String.self, forKey: .title)
|
||||
image = try typeContainer.decode(String.self, forKey: .image)
|
||||
action = try typeContainer.decodeModel(codingKey: .action)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(title, forKey: .title)
|
||||
try container.encode(image, forKey: .image)
|
||||
try container.encodeModel(action, forKey: .action)
|
||||
}
|
||||
}
|
||||
|
||||
@objc public class TabBarHelper: NSObject {
|
||||
@objc public class func get() -> UITabBar {
|
||||
let model = TabBarModel(with: [TabBarItemModel(with: "Home", image: "Home", action: ActionOpenPageModel(pageType: "myFeed", presentationStyle: "root", tabBarIndex: 0)),
|
||||
TabBarItemModel(with: "Account", image: "Account", action: ActionOpenPageModel(pageType: "account", presentationStyle: "root", tabBarIndex: 1)),
|
||||
TabBarItemModel(with: "Shop", image: "Bag", action: ActionOpenPageModel(pageType: "shop", presentationStyle: "root", tabBarIndex: 2)),
|
||||
TabBarItemModel(with: "Verizon Up", image: "Verizon Up", action: ActionOpenPageModel(pageType: "vzup", presentationStyle: "root", tabBarIndex: 3)),
|
||||
TabBarItemModel(with: "More", image: "More", action: ActionOpenPageModel(pageType: "more", presentationStyle: "root", tabBarIndex: 4))])
|
||||
let tabBar = TabBar(model: model, nil, nil)
|
||||
return tabBar
|
||||
}
|
||||
}
|
||||
@ -78,5 +78,4 @@ public class TabItemModel: Codable {
|
||||
try container.encodeModel(label, forKey: .label)
|
||||
try container.encodeModelIfPresent(action, forKey: .action)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
13
MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift
Normal file
13
MVMCoreUI/Atomic/Protocols/TabBarProtocol.swift
Normal file
@ -0,0 +1,13 @@
|
||||
//
|
||||
// TabBarProtocol.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 5/29/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
@objc public protocol TabBarProtocol {
|
||||
|
||||
}
|
||||
@ -78,11 +78,15 @@ public typealias ButtonAction = (Button) -> ()
|
||||
|
||||
addActionBlock(event: .touchUpInside) { [weak self] sender in
|
||||
guard let self = self else { return }
|
||||
if let data = try? actionModel.encode(using: JSONEncoder()),
|
||||
let actionMap = try? JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.init()) as? [AnyHashable: Any],
|
||||
delegateObject?.buttonDelegate?.button?(self, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? true {
|
||||
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject)
|
||||
}
|
||||
Self.performButtonAction(with: actionModel, button: self, delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
}
|
||||
|
||||
open class func performButtonAction(with model: ActionModelProtocol, button: MFButtonProtocol, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
if let data = try? model.encode(using: JSONEncoder()),
|
||||
let actionMap = try? JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.init()) as? [AnyHashable: Any],
|
||||
delegateObject?.buttonDelegate?.button?(button, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? true {
|
||||
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -11,9 +11,11 @@
|
||||
@import MVMCore.MVMCoreActionDelegateProtocol;
|
||||
#import <MVMCoreUI/MVMCoreUIPanelProtocol.h>
|
||||
#import <MVMCoreUI/MVMCoreUIPanelButtonProtocol.h>
|
||||
|
||||
@class MVMCoreUITopAlertView;
|
||||
@class MFViewController;
|
||||
@class NavigationController;
|
||||
@protocol TabBarProtocol;
|
||||
|
||||
typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
|
||||
MFNoDrawer = 0,
|
||||
@ -47,6 +49,9 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
|
||||
@property (nonatomic, readonly) BOOL rightPanelIsAccessible;
|
||||
@property (nullable, weak, nonatomic, readonly) UIViewController *navigationItemViewController;
|
||||
|
||||
/// Reference to the tabbar.
|
||||
@property (weak, nonatomic) UIView <TabBarProtocol>*tabBar;
|
||||
|
||||
// Convenience getter
|
||||
+ (nullable instancetype)mainSplitViewController;
|
||||
|
||||
@ -141,4 +146,12 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
|
||||
- (IBAction)backButtonPressed:(nullable id)sender;
|
||||
- (IBAction)rightPanelButtonPressed:(nullable id)sender;
|
||||
|
||||
#pragma mark - TabBar
|
||||
|
||||
/// Called when split view is loaded to create the initial tabbar. Default is nil.
|
||||
- (nullable UIView <TabBarProtocol>*)createTabBar;
|
||||
|
||||
/// Adds any tabbar at the bottom of the split view.
|
||||
- (void)addTabBar:(nonnull UIView <TabBarProtocol>*)tabBar;
|
||||
|
||||
@end
|
||||
|
||||
@ -43,6 +43,8 @@ typedef NS_OPTIONS(NSInteger, MFExtendedDrawer) {
|
||||
@property (weak, nonatomic) UIView *leftPanelSeparator;
|
||||
@property (weak, nonatomic) UIView *rightPanelSeparator;
|
||||
|
||||
@property (weak, nonatomic) NSLayoutConstraint *bottomConstraint;
|
||||
|
||||
@property (weak, nonatomic, readwrite) NavigationController *navigationController;
|
||||
|
||||
// A view that covers the detail view when the master is out.
|
||||
@ -771,6 +773,26 @@ CGFloat const PanelAnimationDuration = 0.2;
|
||||
[self.view layoutIfNeeded];
|
||||
}
|
||||
|
||||
#pragma mark - TabBar
|
||||
|
||||
- (nullable UIView <TabBarProtocol>*)createTabBar {
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)addTabBar:(nonnull UIView <TabBarProtocol>*)tabBar {
|
||||
[self.view addSubview:tabBar];
|
||||
[tabBar.topAnchor constraintEqualToAnchor:self.mainView.bottomAnchor].active = YES;
|
||||
[NSLayoutConstraint constraintWithItem:tabBar attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0].active = YES;
|
||||
[NSLayoutConstraint constraintWithItem:tabBar attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.mainView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0].active = YES;
|
||||
|
||||
self.bottomConstraint.active = NO;
|
||||
NSLayoutConstraint *bottom = [self.view.safeAreaLayoutGuide.bottomAnchor constraintEqualToAnchor:tabBar.bottomAnchor];
|
||||
bottom.active = YES;
|
||||
self.bottomConstraint = bottom;
|
||||
|
||||
self.tabBar = tabBar;
|
||||
}
|
||||
|
||||
#pragma mark - Bottom Progress Bar
|
||||
|
||||
- (void)setBottomProgressBarProgress:(float)progress {
|
||||
@ -840,27 +862,21 @@ CGFloat const PanelAnimationDuration = 0.2;
|
||||
bottomProgressHeight.active = YES;
|
||||
self.bottomProgressBarHeightConstraint = bottomProgressHeight;
|
||||
|
||||
UITabBar *tabs = [[UITabBar alloc] init];
|
||||
tabs.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
tabs.tintColor = [UIColor mfRedColor];
|
||||
tabs.backgroundColor = [UIColor whiteColor];
|
||||
NSArray *tabList = @[[[UITabBarItem alloc] initWithTitle:nil image:[[MVMCoreUIUtility imageNamed:@"Home"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] tag:0],
|
||||
[[UITabBarItem alloc] initWithTitle:nil image:[[MVMCoreUIUtility imageNamed:@"Account"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] tag:1],
|
||||
[[UITabBarItem alloc] initWithTitle:nil image:[[MVMCoreUIUtility imageNamed:@"Bag"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] tag:2],
|
||||
[[UITabBarItem alloc] initWithTitle:nil image:[[MVMCoreUIUtility imageNamed:@"Verizon Up"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] tag:3],
|
||||
[[UITabBarItem alloc] initWithTitle:nil image:[[MVMCoreUIUtility imageNamed:@"More"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] tag:4]];
|
||||
[tabs setItems:tabList animated:NO];
|
||||
[tabs setSelectedItem:tabList[0]];
|
||||
tabs.delegate = self;
|
||||
[self.view addSubview:tabs];
|
||||
[NSLayoutConstraint constraintWithItem:tabs attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0].active = YES;
|
||||
[NSLayoutConstraint constraintWithItem:tabs attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0].active = YES;
|
||||
if (topAlertView) {
|
||||
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[topAlertView]-0-[mainView]-0-[progressView]-0-[tabs]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topAlertView, mainView, progressView, tabs)]];
|
||||
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[topAlertView]-0-[mainView]-0-[progressView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topAlertView, mainView, progressView)]];
|
||||
} else {
|
||||
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[mainView]-0-[progressView]-0-[tabs]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(mainView, progressView, tabs)]];
|
||||
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[mainView]-0-[progressView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(mainView, progressView)]];
|
||||
}
|
||||
|
||||
// Add tabbar if we have it.
|
||||
UIView <TabBarProtocol>*tabs = [self createTabBar];
|
||||
if (tabs) {
|
||||
[self addTabBar:tabs];
|
||||
} else {
|
||||
NSLayoutConstraint *bottom = [self.view.safeAreaLayoutGuide.bottomAnchor constraintEqualToAnchor:progressView.bottomAnchor];
|
||||
bottom.active = YES;
|
||||
self.bottomConstraint = bottom;
|
||||
}
|
||||
[[self.view.safeAreaLayoutGuide.bottomAnchor constraintEqualToAnchor:tabs.bottomAnchor] setActive:YES];
|
||||
|
||||
// Cover View
|
||||
UIView *coverView = [MVMCoreUICommonViewsUtility commonView];
|
||||
@ -877,50 +893,6 @@ CGFloat const PanelAnimationDuration = 0.2;
|
||||
[self setupPanels];
|
||||
}
|
||||
|
||||
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
|
||||
switch (item.tag) {
|
||||
case 0:{
|
||||
MVMCoreRequestParameters *params = [[MVMCoreRequestParameters alloc] initWithPageType:@"myFeed" extraParameters:nil];
|
||||
params.loadStyle = MFLoadStyleBecomeRoot;
|
||||
params.shouldNotAnimatePush = YES;
|
||||
[[MVMCoreLoadHandler sharedGlobal] loadRequest:params dataForPage:nil delegateObject:nil];
|
||||
}
|
||||
break;
|
||||
case 1:{
|
||||
MVMCoreRequestParameters *params = [[MVMCoreRequestParameters alloc] initWithPageType:@"accountLanding" extraParameters:nil];
|
||||
params.loadStyle = MFLoadStyleBecomeRoot;
|
||||
params.shouldNotAnimatePush = YES;
|
||||
[[MVMCoreLoadHandler sharedGlobal] loadRequest:params dataForPage:nil delegateObject:nil];
|
||||
}
|
||||
break;
|
||||
case 2:{
|
||||
MVMCoreRequestParameters *params = [[MVMCoreRequestParameters alloc] initWithPageType:@"shopHomePage" extraParameters:nil];
|
||||
params.loadStyle = MFLoadStyleBecomeRoot;
|
||||
params.shouldNotAnimatePush = YES;
|
||||
[[MVMCoreLoadHandler sharedGlobal] loadRequest:params dataForPage:nil delegateObject:nil];
|
||||
}
|
||||
break;
|
||||
case 3:{
|
||||
MVMCoreRequestParameters *params = [[MVMCoreRequestParameters alloc] initWithPageType:@"loyaltyEligibiltySelector" extraParameters:nil];
|
||||
params.loadStyle = MFLoadStyleBecomeRoot;
|
||||
params.shouldNotAnimatePush = YES;
|
||||
[[MVMCoreLoadHandler sharedGlobal] loadRequest:params dataForPage:nil delegateObject:nil];
|
||||
}
|
||||
break;
|
||||
case 4:{
|
||||
UIAlertController *controller = [UIAlertController alertControllerWithTitle:@"More" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
[controller addAction:[UIAlertAction actionWithTitle:@"Bill" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
||||
[[MVMCoreLoadHandler sharedGlobal] loadRequest:[[MVMCoreRequestParameters alloc] initWithPageType:@"billOverview" extraParameters:nil] dataForPage:nil delegateObject:nil];
|
||||
}]];
|
||||
[controller addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];
|
||||
[[MVMCoreNavigationHandler sharedNavigationHandler] presentViewController:controller animated:YES];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self.topAlertView pinATopViewController:self];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user