remove encode, decode method since actionType already handled by default encode behavior

This commit is contained in:
Xinlei(Ryan) Pan 2020-03-17 16:59:30 -04:00
parent 92584d935f
commit d30b21bbd7
12 changed files with 0 additions and 326 deletions

View File

@ -15,26 +15,4 @@ import Foundation
public var analyticsData: JSONValueDictionary?
// Temporary fix till server changes
public var title: String?
public enum CodingKeys: String, CodingKey {
case actionType
case title
case extraParameters
case analyticsData
}
public required init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters)
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
}
public func encode(to encoder: Encoder) throws {
var encoderContainer = encoder.container(keyedBy: CodingKeys.self)
try encoderContainer.encodeIfPresent(actionType, forKey: .actionType)
try encoderContainer.encodeIfPresent(title, forKey: .title)
try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters)
try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData)
}
}

View File

@ -20,29 +20,4 @@ import Foundation
public init(callNumber: String) {
self.callNumber = callNumber
}
public enum CodingKeys: String, CodingKey {
case actionType
case callNumber
case title
case extraParameters
case analyticsData
}
public required init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
callNumber = try typeContainer.decode(String.self, forKey: .callNumber)
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters)
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
}
public func encode(to encoder: Encoder) throws {
var encoderContainer = encoder.container(keyedBy: CodingKeys.self)
try encoderContainer.encodeIfPresent(actionType, forKey: .actionType)
try encoderContainer.encode(callNumber, forKey: .callNumber)
try encoderContainer.encodeIfPresent(title, forKey: .title)
try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters)
try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData)
}
}

View File

@ -18,26 +18,4 @@ import UIKit
public var analyticsData: JSONValueDictionary?
public var title: String?
public enum CodingKeys: String, CodingKey {
case actionType
case title
case extraParameters
case analyticsData
}
public required init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters)
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
}
public func encode(to encoder: Encoder) throws {
var encoderContainer = encoder.container(keyedBy: CodingKeys.self)
try encoderContainer.encodeIfPresent(actionType, forKey: .actionType)
try encoderContainer.encodeIfPresent(title, forKey: .title)
try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters)
try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData)
}
}

View File

@ -20,29 +20,4 @@ import Foundation
public init(appURL: String) {
self.appURL = appURL
}
public enum CodingKeys: String, CodingKey {
case actionType
case appURL
case title
case extraParameters
case analyticsData
}
public required init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
appURL = try typeContainer.decode(String.self, forKey: .appURL)
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters)
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
}
public func encode(to encoder: Encoder) throws {
var encoderContainer = encoder.container(keyedBy: CodingKeys.self)
try encoderContainer.encodeIfPresent(actionType, forKey: .actionType)
try encoderContainer.encode(appURL, forKey: .appURL)
try encoderContainer.encodeIfPresent(title, forKey: .title)
try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters)
try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData)
}
}

View File

@ -22,32 +22,4 @@ import Foundation
public init(pageType: String) {
self.pageType = pageType
}
public enum CodingKeys: String, CodingKey {
case actionType
case pageType
case title
case extraParameters
case analyticsData
case presentationStyle
}
public required init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
pageType = try typeContainer.decode(String.self, forKey: .pageType)
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters)
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
presentationStyle = try typeContainer.decodeIfPresent(String.self, forKey: .presentationStyle)
}
public func encode(to encoder: Encoder) throws {
var encoderContainer = encoder.container(keyedBy: CodingKeys.self)
try encoderContainer.encodeIfPresent(actionType, forKey: .actionType)
try encoderContainer.encode(pageType, forKey: .pageType)
try encoderContainer.encodeIfPresent(title, forKey: .title)
try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters)
try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData)
try encoderContainer.encodeIfPresent(presentationStyle, forKey: .presentationStyle)
}
}

View File

@ -16,33 +16,4 @@ import Foundation
public var analyticsData: JSONValueDictionary?
// Temporary fix till server changes
public var title: String?
public init(panel: String) {
self.panel = panel
}
public enum CodingKeys: String, CodingKey {
case actionType
case panel
case title
case extraParameters
case analyticsData
}
public required init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
panel = try typeContainer.decode(String.self, forKey: .panel)
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters)
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
}
public func encode(to encoder: Encoder) throws {
var encoderContainer = encoder.container(keyedBy: CodingKeys.self)
try encoderContainer.encodeIfPresent(actionType, forKey: .actionType)
try encoderContainer.encode(panel, forKey: .panel)
try encoderContainer.encodeIfPresent(title, forKey: .title)
try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters)
try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData)
}
}

View File

@ -31,54 +31,4 @@ import Foundation
public init(browserUrl: String) {
self.browserUrl = browserUrl
}
public enum CodingKeys: String, CodingKey {
case actionType
case browserUrl
case title
case extraParameters
case analyticsData
case openOauthWebView
case showNativeNavigation
case openInWebview
case customUserAgent
case postRequest
case dontShowProgress
case headerParameters
}
public required init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
browserUrl = try typeContainer.decode(String.self, forKey: .browserUrl)
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters)
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
openOauthWebView = try typeContainer.decodeIfPresent(Bool.self, forKey: .openOauthWebView)
showNativeNavigation = try typeContainer.decodeIfPresent(Bool.self, forKey: .showNativeNavigation)
openInWebview = try typeContainer.decodeIfPresent(Bool.self, forKey: .openInWebview)
customUserAgent = try typeContainer.decodeIfPresent(String.self, forKey: .customUserAgent)
postRequest = try typeContainer.decodeIfPresent(Bool.self, forKey: .postRequest)
dontShowProgress = try typeContainer.decodeIfPresent(Bool.self, forKey: .dontShowProgress)
headerParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .headerParameters)
}
public func encode(to encoder: Encoder) throws {
var encoderContainer = encoder.container(keyedBy: CodingKeys.self)
try encoderContainer.encodeIfPresent(actionType, forKey: .actionType)
try encoderContainer.encode(browserUrl, forKey: .browserUrl)
try encoderContainer.encodeIfPresent(title, forKey: .title)
try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters)
try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData)
try encoderContainer.encodeIfPresent(openOauthWebView, forKey: .openOauthWebView)
try encoderContainer.encodeIfPresent(showNativeNavigation, forKey: .showNativeNavigation)
try encoderContainer.encodeIfPresent(openInWebview, forKey: .openInWebview)
try encoderContainer.encodeIfPresent(customUserAgent, forKey: .customUserAgent)
try encoderContainer.encodeIfPresent(postRequest, forKey: .postRequest)
try encoderContainer.encodeIfPresent(dontShowProgress, forKey: .dontShowProgress)
try encoderContainer.encodeIfPresent(headerParameters, forKey: .headerParameters)
}
}

View File

@ -19,29 +19,4 @@ import Foundation
public init(pageType: String) {
self.pageType = pageType
}
public enum CodingKeys: String, CodingKey {
case actionType
case pageType
case title
case extraParameters
case analyticsData
}
public required init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
pageType = try typeContainer.decode(String.self, forKey: .pageType)
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters)
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
}
public func encode(to encoder: Encoder) throws {
var encoderContainer = encoder.container(keyedBy: CodingKeys.self)
try encoderContainer.encodeIfPresent(actionType, forKey: .actionType)
try encoderContainer.encode(pageType, forKey: .pageType)
try encoderContainer.encodeIfPresent(title, forKey: .title)
try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters)
try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData)
}
}

View File

@ -18,26 +18,4 @@ import UIKit
public var analyticsData: JSONValueDictionary?
public var title: String?
public enum CodingKeys: String, CodingKey {
case actionType
case title
case extraParameters
case analyticsData
}
public required init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters)
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
}
public func encode(to encoder: Encoder) throws {
var encoderContainer = encoder.container(keyedBy: CodingKeys.self)
try encoderContainer.encodeIfPresent(actionType, forKey: .actionType)
try encoderContainer.encodeIfPresent(title, forKey: .title)
try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters)
try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData)
}
}

View File

@ -21,29 +21,4 @@ import UIKit
///Optional pageType, if pageType is nil, will start with pageType launchApp
public var pageType: String?
public enum CodingKeys: String, CodingKey {
case actionType
case pageType
case title
case extraParameters
case analyticsData
}
public required init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
pageType = try typeContainer.decodeIfPresent(String.self, forKey: .pageType)
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters)
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
}
public func encode(to encoder: Encoder) throws {
var encoderContainer = encoder.container(keyedBy: CodingKeys.self)
try encoderContainer.encodeIfPresent(actionType, forKey: .actionType)
try encoderContainer.encodeIfPresent(pageType, forKey: .pageType)
try encoderContainer.encodeIfPresent(title, forKey: .title)
try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters)
try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData)
}
}

View File

@ -21,29 +21,4 @@ import UIKit
///String type for pageType, currently only support "location" and "push"
public var pageType: String
public enum CodingKeys: String, CodingKey {
case actionType
case pageType
case title
case extraParameters
case analyticsData
}
public required init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
pageType = try typeContainer.decode(String.self, forKey: .pageType)
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters)
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
}
public func encode(to encoder: Encoder) throws {
var encoderContainer = encoder.container(keyedBy: CodingKeys.self)
try encoderContainer.encodeIfPresent(actionType, forKey: .actionType)
try encoderContainer.encode(pageType, forKey: .pageType)
try encoderContainer.encodeIfPresent(title, forKey: .title)
try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters)
try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData)
}
}

View File

@ -30,32 +30,4 @@ import UIKit
self.sharedType = sharedType
self.sharedText = sharedText
}
public enum CodingKeys: String, CodingKey {
case actionType
case sharedType
case sharedText
case title
case extraParameters
case analyticsData
}
public required init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
sharedType = try typeContainer.decode(String.self, forKey: .sharedType)
sharedText = try typeContainer.decode(String.self, forKey: .sharedText)
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
extraParameters = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .extraParameters)
analyticsData = try typeContainer.decodeIfPresent(JSONValueDictionary.self, forKey: .analyticsData)
}
public func encode(to encoder: Encoder) throws {
var encoderContainer = encoder.container(keyedBy: CodingKeys.self)
try encoderContainer.encodeIfPresent(actionType, forKey: .actionType)
try encoderContainer.encode(sharedType, forKey: .sharedType)
try encoderContainer.encode(sharedText, forKey: .sharedText)
try encoderContainer.encodeIfPresent(title, forKey: .title)
try encoderContainer.encodeIfPresent(extraParameters, forKey: .extraParameters)
try encoderContainer.encodeIfPresent(analyticsData, forKey: .analyticsData)
}
}