fixes
This commit is contained in:
parent
1698b21dd8
commit
724c1afd7c
@ -21,7 +21,7 @@ public extension MVMCoreAlertObject {
|
|||||||
|
|
||||||
var actionsForAlert: [UIAlertAction] = []
|
var actionsForAlert: [UIAlertAction] = []
|
||||||
for actionJson in actionsList {
|
for actionJson in actionsList {
|
||||||
let style = UIAlertAction.Style(rawValue: Int(actionJson.int32ForKey("style"))) ?? UIAlertAction.Style.default
|
let style = UIAlertAction.Style.getStyle(for: actionJson.stringForkey("style"))
|
||||||
let alertAction = UIAlertAction(title: actionJson.optionalStringForKey(KeyTitle), style: style) { (action) in
|
let alertAction = UIAlertAction(title: actionJson.optionalStringForKey(KeyTitle), style: style) { (action) in
|
||||||
MVMCoreActionHandler.shared()?.handleAction(with: actionJson.optionalDictionaryForKey("action"), additionalData: additionalData, delegateObject: delegateObject)
|
MVMCoreActionHandler.shared()?.handleAction(with: actionJson.optionalDictionaryForKey("action"), additionalData: additionalData, delegateObject: delegateObject)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,11 +28,10 @@ public class AlertButtonModel: Codable {
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
title = try typeContainer.decode(String.self, forKey: .title)
|
title = try typeContainer.decode(String.self, forKey: .title)
|
||||||
|
|
||||||
if let style = try? typeContainer.decodeIfPresent(String.self, forKey: .style) {
|
if let style = try? typeContainer.decodeIfPresent(String.self, forKey: .style) {
|
||||||
self.style = UIAlertAction.Style.getStyle(for: style)
|
self.style = UIAlertAction.Style.getStyle(for: style)
|
||||||
}
|
}
|
||||||
|
|
||||||
action = try typeContainer.decodeModel(codingKey: .action)
|
action = try typeContainer.decodeModel(codingKey: .action)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ enum AlertActionError: Error {
|
|||||||
case notAnAlertAction
|
case notAnAlertAction
|
||||||
}
|
}
|
||||||
|
|
||||||
extension UIAlertAction.Style: RawRepresentable {
|
extension UIAlertAction.Style: Codable {
|
||||||
|
|
||||||
public init(from decoder: Decoder) throws {
|
public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.singleValueContainer()
|
let typeContainer = try decoder.singleValueContainer()
|
||||||
@ -79,5 +79,4 @@ extension UIAlertAction.Style: RawRepresentable {
|
|||||||
return "default"
|
return "default"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user