Merge branch 'develop' into feature/test_no_arm64_config
This commit is contained in:
commit
c0a6700a81
@ -92,9 +92,9 @@ import UIKit
|
||||
}
|
||||
|
||||
func performDropdownAction() {
|
||||
if let baseDropdownEntryFieldModel = baseDropdownEntryFieldModel, let actionModel = baseDropdownEntryFieldModel.action, let actionMap = actionModel.toJSON() {
|
||||
if let baseDropdownEntryFieldModel = baseDropdownEntryFieldModel, let actionModel = baseDropdownEntryFieldModel.action {
|
||||
let additionalDataWithSource = additionalData.dictionaryAdding(key: KeySourceModel, value: baseDropdownEntryFieldModel)
|
||||
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalDataWithSource, delegateObject: delegateObject)
|
||||
MVMCoreActionHandler.shared()?.asyncHandleAction(with: actionModel, additionalData: additionalDataWithSource, delegateObject: delegateObject)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -389,11 +389,9 @@ import MVMCore
|
||||
}
|
||||
|
||||
private func performCheckboxAction(with actionModel: ActionModelProtocol, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
if let actionMap = actionModel.toJSON() {
|
||||
var additionalDatatoUpdate = additionalData ?? [:]
|
||||
additionalDatatoUpdate[KeySourceModel] = checkboxModel
|
||||
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalDatatoUpdate, delegateObject: delegateObject)
|
||||
}
|
||||
var additionalDataToUpdate = additionalData ?? [:]
|
||||
additionalDataToUpdate[KeySourceModel] = checkboxModel
|
||||
MVMCoreActionHandler.shared()?.asyncHandleAction(with: actionModel, additionalData: additionalDataToUpdate, delegateObject: delegateObject)
|
||||
}
|
||||
|
||||
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
|
||||
@ -390,21 +390,17 @@ public typealias ActionBlockConfirmation = () -> (Bool)
|
||||
accessibilityLabel = accessibileString
|
||||
}
|
||||
|
||||
let actionMap = model.action?.toJSON()
|
||||
let alternateActionMap = model.alternateAction?.toJSON()
|
||||
let additionalDataWithSource = additionalData.dictionaryAdding(key: KeySourceModel, value: model)
|
||||
if actionMap != nil || alternateActionMap != nil {
|
||||
if model.action != nil || model.alternateAction != nil {
|
||||
didToggleAction = { [weak self] in
|
||||
guard let self = self else { return }
|
||||
if self.isOn {
|
||||
if actionMap != nil {
|
||||
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalDataWithSource, delegateObject: delegateObject)
|
||||
if let action = model.action {
|
||||
MVMCoreActionHandler.shared()?.asyncHandleAction(with: action, additionalData: additionalDataWithSource, delegateObject: delegateObject)
|
||||
}
|
||||
} else {
|
||||
if alternateActionMap != nil {
|
||||
MVMCoreActionHandler.shared()?.handleAction(with: alternateActionMap, additionalData: additionalDataWithSource, delegateObject: delegateObject)
|
||||
} else if actionMap != nil {
|
||||
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalDataWithSource, delegateObject: delegateObject)
|
||||
if let action = model.alternateAction ?? model.action {
|
||||
MVMCoreActionHandler.shared()?.asyncHandleAction(with: action, additionalData: additionalDataWithSource, delegateObject: delegateObject)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -381,9 +381,7 @@ public typealias ActionBlock = () -> ()
|
||||
}
|
||||
case let actionAtt as LabelAttributeActionModel:
|
||||
addTappableLinkAttribute(range: NSRange(location: range.location, length: range.length)) {
|
||||
if let data = try? actionAtt.action.encode(using: JSONEncoder()), let actionMap = try? JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.init()) as? [AnyHashable: Any] {
|
||||
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject)
|
||||
}
|
||||
MVMCoreActionHandler.shared()?.asyncHandleAction(with: actionAtt.action, additionalData: additionalData, delegateObject: delegateObject)
|
||||
}
|
||||
addActionAttributes(range: range, string: attributedString)
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
// MARK: - Outlets
|
||||
//--------------------------------------------------
|
||||
|
||||
public let leftImage = LoadImageView()
|
||||
public let leftImage = LoadImageView(pinnedEdges: .all)
|
||||
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
|
||||
public let rightLabel = Label(fontStyle: .RegularBodySmall)
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
// MARK: - Outlets
|
||||
//--------------------------------------------------
|
||||
|
||||
public let leftImage = LoadImageView()
|
||||
public let leftImage = LoadImageView(pinnedEdges: .all)
|
||||
public let headlineBody = HeadlineBody()
|
||||
public let rightLabel = Label(fontStyle: .RegularBodySmall)
|
||||
public let rightLabelStackItem: StackItem
|
||||
|
||||
@ -21,7 +21,8 @@
|
||||
//--------------------------------------------------
|
||||
|
||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
stack = Stack<StackModel>.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .top)), (view: rightLabel, model: StackItemModel(horizontalAlignment:.fill))], axis: .horizontal)
|
||||
// Fill for left vertical alignment because bottom constraint was breaking with leading. CXTDT-145456
|
||||
stack = Stack<StackModel>.createStack(with: [(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading, verticalAlignment: .fill)), (view: rightLabel, model: StackItemModel(horizontalAlignment:.fill, verticalAlignment: .leading))], axis: .horizontal)
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
}
|
||||
|
||||
@ -47,7 +48,7 @@
|
||||
if let heroCenter = heroCenter,
|
||||
let stackItem = stack.stackItems.last as? StackItem {
|
||||
let convertedPoint = stack.convert(heroCenter, from: self)
|
||||
stackItem.containerHelper.alignCenterVerticalConstraint?.constant = convertedPoint.y - stack.bounds.midY
|
||||
stackItem.containerHelper.topConstraint?.constant = max(convertedPoint.y - rightLabel.bounds.midY, 0.0)
|
||||
}
|
||||
|
||||
return heroCenter
|
||||
@ -61,7 +62,6 @@
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
|
||||
guard let model = model as? ListRightVariableRightCaretAllTextAndLinksModel else { return }
|
||||
|
||||
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
|
||||
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
|
||||
updateAccessibilityLabel()
|
||||
|
||||
@ -54,8 +54,11 @@
|
||||
var tabs: [UITabBarItem] = []
|
||||
for (index, tab) in model.tabs.enumerated() {
|
||||
let tabBarItem = UITabBarItem(title: tab.title, image: MVMCoreCache.shared()?.getImageFromRegisteredBundles(tab.image), tag: index)
|
||||
tabBarItem.titlePositionAdjustment = UIOffset(horizontal: 0, vertical: -3)
|
||||
tabBarItem.setTitleTextAttributes([NSAttributedString.Key.font: MFFonts.mfFontTXRegular(8)], for: .normal)
|
||||
if #available(iOS 13.0, *) {
|
||||
} else {
|
||||
tabBarItem.titlePositionAdjustment = UIOffset(horizontal: 0, vertical: -3)
|
||||
tabBarItem.setTitleTextAttributes([NSAttributedString.Key.font: MFFonts.mfFontTXRegular(8)], for: .normal)
|
||||
}
|
||||
tabs.append(tabBarItem)
|
||||
}
|
||||
setItems(tabs, animated: false)
|
||||
|
||||
@ -60,7 +60,7 @@ public class TabBarModel: MoleculeModelProtocol {
|
||||
}
|
||||
|
||||
public class TabBarItemModel: Codable {
|
||||
var title: String
|
||||
var title: String?
|
||||
var image: String
|
||||
var action: ActionModelProtocol
|
||||
|
||||
@ -70,7 +70,7 @@ public class TabBarItemModel: Codable {
|
||||
case action
|
||||
}
|
||||
|
||||
public init(with title: String, image: String, action: ActionModelProtocol) {
|
||||
public init(with title: String?, image: String, action: ActionModelProtocol) {
|
||||
self.title = title
|
||||
self.image = image
|
||||
self.action = action
|
||||
@ -78,14 +78,14 @@ public class TabBarItemModel: Codable {
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
title = try typeContainer.decode(String.self, forKey: .title)
|
||||
title = try typeContainer.decodeIfPresent(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.encodeIfPresent(title, forKey: .title)
|
||||
try container.encode(image, forKey: .image)
|
||||
try container.encodeModel(action, forKey: .action)
|
||||
}
|
||||
|
||||
@ -19,19 +19,15 @@ open class HeadlineBody: View {
|
||||
// MARK: - Constraints
|
||||
//--------------------------------------------------
|
||||
|
||||
var spaceBetweenLabelsConstant = PaddingOne
|
||||
var spaceBetweenLabelsConstant = Padding.One
|
||||
var spaceBetweenLabels: NSLayoutConstraint?
|
||||
var leftConstraintTitle: NSLayoutConstraint?
|
||||
var rightConstraintTitle: NSLayoutConstraint?
|
||||
var leftConstraintMessage: NSLayoutConstraint?
|
||||
var rightConstraintMessage: NSLayoutConstraint?
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Methods
|
||||
//--------------------------------------------------
|
||||
|
||||
func hasText() -> Bool {
|
||||
return headlineLabel.hasText || messageLabel.hasText
|
||||
headlineLabel.hasText || messageLabel.hasText
|
||||
}
|
||||
|
||||
// MARK: - Styling
|
||||
@ -57,13 +53,13 @@ open class HeadlineBody: View {
|
||||
func styleLandingPageHeader() {
|
||||
headlineLabel.setFontStyle(.Title2XLarge)
|
||||
messageLabel.setFontStyle(.RegularBodySmall)
|
||||
spaceBetweenLabelsConstant = PaddingTwo
|
||||
spaceBetweenLabelsConstant = Padding.Two
|
||||
}
|
||||
|
||||
func stylePageHeader() {
|
||||
headlineLabel.setFontStyle(.BoldTitleLarge)
|
||||
messageLabel.setFontStyle(.RegularBodySmall)
|
||||
spaceBetweenLabelsConstant = PaddingOne
|
||||
spaceBetweenLabelsConstant = Padding.One
|
||||
}
|
||||
|
||||
func styleListItem() {
|
||||
@ -86,48 +82,41 @@ open class HeadlineBody: View {
|
||||
super.setupView()
|
||||
|
||||
backgroundColor = .clear
|
||||
clipsToBounds = true
|
||||
isAccessibilityElement = false
|
||||
shouldGroupAccessibilityChildren = true
|
||||
accessibilityElements = [headlineLabel, messageLabel]
|
||||
|
||||
let view = MVMCoreUICommonViewsUtility.commonView()
|
||||
addSubview(view)
|
||||
NSLayoutConstraint.constraintPinSubview(toSuperview: view)
|
||||
|
||||
view.isAccessibilityElement = false
|
||||
view.shouldGroupAccessibilityChildren = true
|
||||
view.accessibilityElements = [headlineLabel, messageLabel]
|
||||
|
||||
view.addSubview(headlineLabel)
|
||||
view.addSubview(messageLabel)
|
||||
addSubview(headlineLabel)
|
||||
addSubview(messageLabel)
|
||||
|
||||
headlineLabel.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
headlineLabel.setContentHuggingPriority(.required, for: .vertical)
|
||||
messageLabel.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
messageLabel.setContentHuggingPriority(.required, for: .vertical)
|
||||
view.setContentHuggingPriority(.required, for: .vertical)
|
||||
|
||||
headlineLabel.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
|
||||
headlineLabel.topAnchor.constraint(equalTo: topAnchor).isActive = true
|
||||
|
||||
spaceBetweenLabels = messageLabel.topAnchor.constraint(equalTo: headlineLabel.bottomAnchor, constant: spaceBetweenLabelsConstant)
|
||||
spaceBetweenLabels?.isActive = true
|
||||
|
||||
leftConstraintTitle = headlineLabel.leftAnchor.constraint(equalTo: view.leftAnchor)
|
||||
leftConstraintTitle?.isActive = true
|
||||
|
||||
rightConstraintTitle = view.rightAnchor.constraint(equalTo: headlineLabel.rightAnchor)
|
||||
rightConstraintTitle?.isActive = true
|
||||
|
||||
leftConstraintMessage = messageLabel.leftAnchor.constraint(equalTo: view.leftAnchor)
|
||||
leftConstraintMessage?.isActive = true
|
||||
|
||||
rightConstraintMessage = view.rightAnchor.constraint(equalTo: messageLabel.rightAnchor)
|
||||
rightConstraintMessage?.isActive = true
|
||||
|
||||
view.bottomAnchor.constraint(equalTo: messageLabel.bottomAnchor).isActive = true
|
||||
NSLayoutConstraint.activate([
|
||||
headlineLabel.leadingAnchor.constraint(equalTo: leadingAnchor),
|
||||
trailingAnchor.constraint(equalTo: headlineLabel.trailingAnchor),
|
||||
messageLabel.leadingAnchor.constraint(equalTo: leadingAnchor),
|
||||
trailingAnchor.constraint(equalTo: messageLabel.trailingAnchor),
|
||||
bottomAnchor.constraint(equalTo: messageLabel.bottomAnchor)
|
||||
])
|
||||
}
|
||||
|
||||
open override func updateView(_ size: CGFloat) {
|
||||
super.updateView(size)
|
||||
setSpacing()
|
||||
headlineLabel.updateView(size)
|
||||
messageLabel.updateView(size)
|
||||
setSpacing()
|
||||
|
||||
// Provide the label additional size information to help calculate its intrinsic height.
|
||||
let padding = MFStyler.defaultHorizontalPadding(forSize: size) * 2
|
||||
messageLabel.preferredMaxLayoutWidth = size - padding
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -146,19 +135,18 @@ open class HeadlineBody: View {
|
||||
// MARK: - MoleculeViewProtocol
|
||||
//--------------------------------------------------
|
||||
|
||||
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 58
|
||||
}
|
||||
public override class func estimatedHeight(with model: MoleculeModelProtocol,
|
||||
_ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { 58 }
|
||||
|
||||
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
|
||||
guard let headlineBodyModel = model as? HeadlineBodyModel else { return }
|
||||
guard let model = model as? HeadlineBodyModel else { return }
|
||||
|
||||
style(with: headlineBodyModel.style)
|
||||
style(with: model.style)
|
||||
|
||||
headlineLabel.setOptional(with: headlineBodyModel.headline, delegateObject, additionalData)
|
||||
messageLabel.setOptional(with: headlineBodyModel.body, delegateObject, additionalData)
|
||||
headlineLabel.setOptional(with: model.headline, delegateObject, additionalData)
|
||||
messageLabel.setOptional(with: model.body, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
|
||||
@ -29,14 +29,10 @@ open class ModalMoleculeListTemplate: MoleculeListTemplate {
|
||||
super.handleNewData()
|
||||
|
||||
closeButton = MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: { [weak self] _ in
|
||||
guard let self = self else {
|
||||
return
|
||||
}
|
||||
guard let model = self.templateModel as? ModalListPageTemplateModel, let actionMap = model.closeAction else {
|
||||
MVMCoreActionHandler.shared()?.handleAction(with: ActionBackModel().toJSON(), additionalData: nil, delegateObject: self.delegateObjectIVar)
|
||||
return
|
||||
}
|
||||
MVMCoreActionHandler.shared()?.handleAction(with: actionMap.toJSON(), additionalData: nil, delegateObject: self.delegateObjectIVar)
|
||||
guard let self = self else { return }
|
||||
let closeAction = (self.templateModel as? ModalListPageTemplateModel)?.closeAction ??
|
||||
ActionBackModel()
|
||||
MVMCoreActionHandler.shared()?.asyncHandleAction(with: closeAction, additionalData: nil, delegateObject: self.delegateObjectIVar)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -18,15 +18,10 @@ open class ModalMoleculeStackTemplate: MoleculeStackTemplate {
|
||||
override open func handleNewData() {
|
||||
super.handleNewData()
|
||||
_ = MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: {[weak self] _ in
|
||||
guard let self = self else {
|
||||
return
|
||||
}
|
||||
|
||||
guard let model = self.templateModel as? ModalStackPageTemplateModel, let actionMap = model.closeAction else {
|
||||
MVMCoreActionHandler.shared()?.handleAction(with: ActionBackModel().toJSON(), additionalData: nil, delegateObject: self.delegateObjectIVar)
|
||||
return
|
||||
}
|
||||
MVMCoreActionHandler.shared()?.handleAction(with: actionMap.toJSON(), additionalData: nil, delegateObject: self.delegateObjectIVar)
|
||||
guard let self = self else { return }
|
||||
let closeAction = (self.templateModel as? ModalStackPageTemplateModel)?.closeAction ??
|
||||
ActionBackModel()
|
||||
MVMCoreActionHandler.shared()?.asyncHandleAction(with: closeAction, additionalData: nil, delegateObject: self.delegateObjectIVar)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,12 +19,9 @@ open class ModalSectionListTemplate: SectionListTemplate {
|
||||
super.handleNewData()
|
||||
_ = MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: {[weak self] _ in
|
||||
guard let self = self else { return }
|
||||
guard let model = self.templateModel as? ModalSectionListTemplateModel,
|
||||
let actionMap = model.closeAction else {
|
||||
MVMCoreActionHandler.shared()?.handleAction(with: ActionBackModel().toJSON(), additionalData: nil, delegateObject: self.delegateObjectIVar)
|
||||
return
|
||||
}
|
||||
MVMCoreActionHandler.shared()?.handleAction(with: actionMap.toJSON(), additionalData: nil, delegateObject: self.delegateObjectIVar)
|
||||
let closeAction = (self.templateModel as? ModalSectionListTemplateModel)?.closeAction ??
|
||||
ActionBackModel()
|
||||
MVMCoreActionHandler.shared()?.asyncHandleAction(with: closeAction, additionalData: nil, delegateObject: self.delegateObjectIVar)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,19 @@ extension UIStackView: MVMCoreViewProtocol {
|
||||
(view as? MVMCoreViewProtocol)?.updateView(size)
|
||||
}
|
||||
}
|
||||
|
||||
/// A convenience function for updating molecules. If model is nil, view is hidden.
|
||||
open func updateContainedMolecules(with models: [MoleculeModelProtocol?], _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
for (index, item) in arrangedSubviews.enumerated() {
|
||||
if let model = models[index] {
|
||||
(item as? MoleculeViewProtocol)?.set(with: model, delegateObject, additionalData)
|
||||
item.isHidden = false
|
||||
} else {
|
||||
item.isHidden = true
|
||||
}
|
||||
}
|
||||
layoutIfNeeded()
|
||||
}
|
||||
}
|
||||
|
||||
extension UIStackView: MoleculeViewProtocol {
|
||||
@ -23,3 +36,4 @@ extension UIStackView: MoleculeViewProtocol {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -27,20 +27,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
// Shows a topnotification new molecular
|
||||
- (void)topNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject;
|
||||
|
||||
#pragma mark - Deprecated
|
||||
|
||||
// Shows a popup
|
||||
- (void)popupAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject <MVMCoreLoadDelegateProtocol, MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate __deprecated;
|
||||
|
||||
// Shows a top alert
|
||||
- (void)topAlertAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject <MVMCoreLoadDelegateProtocol, MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate __deprecated;
|
||||
|
||||
// Shows a molecular top alert
|
||||
- (void)topNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject <MVMCoreLoadDelegateProtocol, MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate __deprecated;
|
||||
|
||||
// Collapses the current top notification
|
||||
- (void)collapseNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject <MVMCoreLoadDelegateProtocol, MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate __deprecated;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@ -122,70 +122,4 @@
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Deprecated
|
||||
|
||||
- (BOOL)handleOtherActions:(nullable NSString *)actionType actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject <MVMCoreLoadDelegateProtocol, MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate {
|
||||
if ([actionType isEqualToString:KeyActionTypePopup]) {
|
||||
[self popupAction:actionInformation additionalData:additionalData delegate:delegate];
|
||||
return YES;
|
||||
} else if ([actionType isEqualToString:KeyActionTypeTopAlert]) {
|
||||
[self topAlertAction:actionInformation additionalData:additionalData delegate:delegate];
|
||||
return YES;
|
||||
} else if ([actionType isEqualToString:KeyActionTypeCollapseNotification]) {
|
||||
[self collapseNotificationAction:actionInformation additionalData:additionalData delegate:delegate];
|
||||
return YES;
|
||||
} else if ([actionType isEqualToString:KeyActionTypeTopNotification]) {
|
||||
[self topNotificationAction:actionInformation additionalData:additionalData delegate:delegate];
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)popupAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject <MVMCoreLoadDelegateProtocol, MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate {
|
||||
// Perform a popup.
|
||||
NSString *pageTypeForPopup = [actionInformation stringForKey:KeyPageType];
|
||||
[[MVMCoreCache sharedCache] fetchJSONForPageType:pageTypeForPopup queue:nil waitUntilFinished:YES completionHandler:^(NSDictionary * _Nullable jsonDictionary) {
|
||||
|
||||
MVMCoreErrorObject *error = nil;
|
||||
MVMCoreAlertObject *alertObject = [MVMCoreAlertObject alertObjectWithPage:jsonDictionary isGreedy:NO additionalData:additionalData delegate:delegate error:&error];
|
||||
if ([delegate respondsToSelector:@selector(willShowPopupWithAlertObject:alertJson:)]) {
|
||||
[((id <MVMCoreUIActionDelegateProtocol>)delegate) willShowPopupWithAlertObject:alertObject alertJson:jsonDictionary];
|
||||
}
|
||||
|
||||
if (alertObject) {
|
||||
[[MVMCoreAlertHandler sharedAlertHandler] showAlertWithAlertObject:alertObject];
|
||||
} else {
|
||||
[self handleActionError:error actionInformation:actionInformation additionalData:additionalData delegate:delegate];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)topAlertAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject <MVMCoreLoadDelegateProtocol, MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate {
|
||||
// Perform a top alert.
|
||||
NSString *pageTypeForTopAlert = [actionInformation stringForKey:KeyPageType];
|
||||
[[MVMCoreCache sharedCache] fetchJSONForPageType:pageTypeForTopAlert queue:nil waitUntilFinished:YES completionHandler:^(NSDictionary * _Nullable jsonDictionary) {
|
||||
|
||||
NSDictionary *responseInfo = [jsonDictionary dict:KeyResponseInfo];
|
||||
if (responseInfo) {
|
||||
MVMCoreAlertObject *alertObject = [MVMCoreAlertObject alertObjectForPageType:pageTypeForTopAlert responseInfo:responseInfo additionalData:additionalData actionDelegate:delegate];
|
||||
if ([delegate respondsToSelector:@selector(willShowTopAlertWithAlertObject:alertJson:)]) {
|
||||
alertObject = [((id <MVMCoreUIActionDelegateProtocol>)delegate) willShowTopAlertWithAlertObject:alertObject alertJson:jsonDictionary];
|
||||
}
|
||||
[alertObject showAlert];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)collapseNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject <MVMCoreLoadDelegateProtocol, MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate {
|
||||
// Collapse the current notification.
|
||||
if ([[CoreUIObject sharedInstance].globalTopAlertDelegate respondsToSelector:@selector(getTopAlertView)]) {
|
||||
[[[CoreUIObject sharedInstance].globalTopAlertDelegate getTopAlertView] collapseNotification];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)topNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegate:(nullable NSObject <MVMCoreLoadDelegateProtocol, MVMCorePresentationDelegateProtocol,MVMCoreActionDelegateProtocol>*)delegate {
|
||||
//Handle molecular topnotification
|
||||
[[MVMCoreUITopAlertView sharedGlobal] showTopAlertWith:[actionInformation dict:@"topNotification"] ?: @{}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -211,7 +211,7 @@
|
||||
|
||||
if (topMessage && (!self.onlyShowTopMessageWhenCollapsed || !self.expanded)) {
|
||||
self.shortViewHeight.active = NO;
|
||||
} else if (!topMessage && self.onlyShowTopMessageWhenCollapsed && self.expanded) {
|
||||
} else if (!topMessage || (self.onlyShowTopMessageWhenCollapsed && self.expanded)) {
|
||||
self.shortViewHeight.active = YES;
|
||||
}
|
||||
}];
|
||||
|
||||
@ -113,8 +113,8 @@ NSString * const MFAccTopAlertClosed = @"Top alert notification is closed.";
|
||||
|
||||
- (void)pinATopViewController:(UIViewController *)viewController {
|
||||
self.statusBarHeightConstraint.active = NO;
|
||||
id topGuide = viewController.topLayoutGuide;
|
||||
self.statusBarBottomConstraint = [NSLayoutConstraint constraintWithItem:self.statusBarView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:topGuide attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
|
||||
id topGuide = viewController.view.safeAreaLayoutGuide;
|
||||
self.statusBarBottomConstraint = [NSLayoutConstraint constraintWithItem:self.statusBarView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:topGuide attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
|
||||
self.statusBarBottomConstraint.active = YES;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user