Merge branch 'bugfix/popupAlert_analytics' into 'develop'

Setting pageJSON for alertobject

See merge request BPHV_MIPS/mvm_core_ui!781
This commit is contained in:
Pfeil, Scott Robert 2021-12-21 14:40:16 +00:00
commit a87d7f68e3
2 changed files with 10 additions and 1 deletions

View File

@ -40,6 +40,10 @@ public extension MVMCoreAlertObject {
alertObject?.alertStyle = UIAlertController.Style(rawValue: alertStyle)
}
if let analyticsData = alertJson.optionalDictionaryForKey("analyticsData") {
alertObject?.pageJson = ["analyticsData": analyticsData]
}
return alertObject
}
}

View File

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