tagging changes implemented
This commit is contained in:
parent
29c5aa3377
commit
483a50dd98
@ -27,6 +27,10 @@ import UIKit
|
||||
return caret
|
||||
}()
|
||||
|
||||
public var baseDropdownEntryFieldModel: BaseDropdownEntryFieldModel? {
|
||||
return model as? BaseDropdownEntryFieldModel
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Property Observers
|
||||
//--------------------------------------------------
|
||||
@ -39,6 +43,14 @@ import UIKit
|
||||
}
|
||||
}
|
||||
|
||||
public var isTextChanged: Bool = false {
|
||||
didSet {
|
||||
if(isTextChanged) {
|
||||
performDropdownAction()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
//--------------------------------------------------
|
||||
@ -80,4 +92,15 @@ import UIKit
|
||||
|
||||
dropDownCaretView.setOptional(with: model.caretView, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
private func performDropdownAction() {
|
||||
if let actionModel = baseDropdownEntryFieldModel?.action, var actionMap = actionModel.toJSON() {
|
||||
if var analyticsData = actionMap[KeyAnalyticsData] as? JSONDictionary {
|
||||
let taggedValue = (analyticsData[KeyAdobeTrackerLinkName] as? String ?? "") + (text ?? "")
|
||||
analyticsData[KeyAdobeTrackerLinkName] = taggedValue
|
||||
actionMap[KeyAnalyticsData] = analyticsData
|
||||
}
|
||||
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: nil, delegateObject: delegateObject)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
//--------------------------------------------------
|
||||
|
||||
public var caretView: CaretViewModel?
|
||||
public var action: ActionModelProtocol?
|
||||
|
||||
public override class var identifier: String {
|
||||
return ""
|
||||
@ -24,6 +25,7 @@
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case caretView
|
||||
case action
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -34,6 +36,7 @@
|
||||
try super.init(from: decoder)
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
caretView = try typeContainer.decodeIfPresent(CaretViewModel.self, forKey: .caretView)
|
||||
action = try typeContainer.decodeModelIfPresent(codingKey: .action)
|
||||
}
|
||||
|
||||
public override func encode(to encoder: Encoder) throws {
|
||||
@ -41,5 +44,6 @@
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encode(caretView, forKey: .caretView)
|
||||
try container.encodeModelIfPresent(action, forKey: .action)
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,6 +101,7 @@ import UIKit
|
||||
} else {
|
||||
text = dateDropdownModel?.dateFormatter.string(from: date)
|
||||
}
|
||||
isTextChanged = true
|
||||
}
|
||||
|
||||
@objc public override func dismissFieldInput(_ sender: Any?) {
|
||||
|
||||
@ -138,6 +138,7 @@ extension ItemDropdownEntryField: UIPickerViewDelegate, UIPickerViewDataSource {
|
||||
observeDropdownChange?(text ?? "", pickerData[row])
|
||||
text = pickerData[row]
|
||||
itemDropdownEntryFieldModel?.selectedIndex = row
|
||||
isTextChanged = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -42,6 +42,8 @@ extern NSString * const KeyIsOpaque;
|
||||
|
||||
extern NSString * const KeyFieldKey;
|
||||
extern NSString * const KeyRequired;
|
||||
extern NSString * const KeyAnalyticsData;
|
||||
extern NSString * const KeyAdobeTrackerLinkName;
|
||||
|
||||
#pragma mark - Values
|
||||
|
||||
|
||||
@ -40,6 +40,8 @@ NSString * const KeyTextColor = @"textColor";
|
||||
|
||||
NSString * const KeyIsHidden = @"isHidden";
|
||||
NSString * const KeyIsOpaque = @"isOpaque";
|
||||
NSString * const KeyAnalyticsData = @"analyticsData";
|
||||
NSString * const KeyAdobeTrackerLinkName = @"vzwi.mvmapp.LinkName";
|
||||
|
||||
|
||||
#pragma mark - Values
|
||||
|
||||
Loading…
Reference in New Issue
Block a user