added analytics data for AlertModel
This commit is contained in:
parent
3c8046587b
commit
bd729b514a
@ -36,11 +36,14 @@ public extension MVMCoreAlertObject {
|
||||
actions: actionsForAlert,
|
||||
isGreedy: false)
|
||||
|
||||
alertObject?.pageJson = actionJson?.optionalDictionaryForKey(KeyPage)
|
||||
if let alertStyle = alertJson.optionalStringForKey("style") {
|
||||
alertObject?.alertStyle = UIAlertController.Style(rawValue: alertStyle)
|
||||
}
|
||||
|
||||
if let analyticsData = alertJson.optionalDictionaryForKey("analyticsData") {
|
||||
alertObject?.pageJson = ["analyticsData": analyticsData]
|
||||
}
|
||||
|
||||
return alertObject
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MVMCore
|
||||
|
||||
|
||||
public class AlertButtonModel: Codable {
|
||||
@ -69,6 +70,7 @@ public class AlertModel: Codable {
|
||||
public var message: String
|
||||
public var style: UIAlertController.Style = .alert
|
||||
public var alertActions: [AlertButtonModel]
|
||||
public var analyticsData: JSONValueDictionary?
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
@ -89,6 +91,7 @@ public class AlertModel: Codable {
|
||||
case message
|
||||
case alertActions
|
||||
case style
|
||||
case analyticsData
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -100,7 +103,8 @@ public class AlertModel: Codable {
|
||||
title = try typeContainer.decode(String.self, forKey: .title)
|
||||
message = try typeContainer.decode(String.self, forKey: .message)
|
||||
alertActions = try typeContainer.decode([AlertButtonModel].self, forKey: .alertActions)
|
||||
|
||||
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
|
||||
|
||||
if let style = try typeContainer.decodeIfPresent(String.self, forKey: .style) {
|
||||
self.style = UIAlertController.Style(rawValue: style)
|
||||
}
|
||||
@ -112,5 +116,6 @@ public class AlertModel: Codable {
|
||||
try container.encode(message, forKey: .message)
|
||||
try container.encode(alertActions, forKey: .alertActions)
|
||||
try container.encode(style.rawValueString, forKey: .style)
|
||||
try container.encodeIfPresent(analyticsData, forKey: .analyticsData)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user