From 2e8834d4316ea66036a84b81767991505d7f22a7 Mon Sep 17 00:00:00 2001 From: Alex Hamilton Date: Wed, 19 Dec 2018 11:03:16 +0000 Subject: [PATCH 1/3] A quick fix to our social object Post to handle different types for the same field in different JFS files --- DigiMeSDK/Repository/Classes/Objects/Social/Post.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/DigiMeSDK/Repository/Classes/Objects/Social/Post.swift b/DigiMeSDK/Repository/Classes/Objects/Social/Post.swift index d984e6713..d2ab5ccbf 100644 --- a/DigiMeSDK/Repository/Classes/Objects/Social/Post.swift +++ b/DigiMeSDK/Repository/Classes/Objects/Social/Post.swift @@ -56,7 +56,9 @@ public class Post: NSObject, BaseObjectDecodable { public let likeCount: Int public let links: [Link]? public let longitude: Double - public let originalPostIdentifier: String? + public var originalPostIdentifier: String? { + return String(describing: originalPostIdentifierRaw) + } public let originalPostUrl: String public let personIdentifier: String public let personFileUrl: String @@ -109,6 +111,7 @@ public class Post: NSObject, BaseObjectDecodable { private let typeRaw: Int private let postReplyCountRaw: AnyJSONType? private let originalCrossPostIdentifierRaw: AnyJSONType? + private let originalPostIdentifierRaw: AnyJSONType? // MARK: - Decodable enum CodingKeys: String, CodingKey { @@ -129,7 +132,7 @@ public class Post: NSObject, BaseObjectDecodable { case links = "links" case longitude = "longitude" case originalCrossPostIdentifierRaw = "originalcrosspostid" - case originalPostIdentifier = "originalpostid" + case originalPostIdentifierRaw = "originalpostid" case originalPostUrl = "originalposturl" case personIdentifier = "personentityid" case personFileUrl = "personfileurl" From 40be5cc3b3d4911b20e514cebf66f82397cc2644 Mon Sep 17 00:00:00 2001 From: Alex Hamilton Date: Wed, 19 Dec 2018 12:13:11 +0000 Subject: [PATCH 2/3] PR requested changes --- .../Repository/Classes/Objects/Social/Post.swift | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/DigiMeSDK/Repository/Classes/Objects/Social/Post.swift b/DigiMeSDK/Repository/Classes/Objects/Social/Post.swift index d2ab5ccbf..991556bc6 100644 --- a/DigiMeSDK/Repository/Classes/Objects/Social/Post.swift +++ b/DigiMeSDK/Repository/Classes/Objects/Social/Post.swift @@ -57,7 +57,10 @@ public class Post: NSObject, BaseObjectDecodable { public let links: [Link]? public let longitude: Double public var originalPostIdentifier: String? { - return String(describing: originalPostIdentifierRaw) + guard let originalPostId = originalPostIdentifierRaw else { + return nil + } + return String(describing: originalPostId) } public let originalPostUrl: String public let personIdentifier: String @@ -66,7 +69,10 @@ public class Post: NSObject, BaseObjectDecodable { public let personUsername: String public let postIdentifier: String public var postReplyCount: String? { - return String(describing: postReplyCountRaw) + guard let replayCount = postReplyCountRaw else { + return nil + } + return String(describing: replayCount) } public let postUrl: String @@ -90,7 +96,11 @@ public class Post: NSObject, BaseObjectDecodable { public let postEntityIdentifier: String? public let personFileRelativePath: String? public var originalCrossPostIdentifier: String? { - return String(describing: originalCrossPostIdentifierRaw) + guard let originalCrossPostId = originalCrossPostIdentifierRaw else { + return nil + } + + return String(describing: originalCrossPostId) } // MARK: - Objective-C Representations of non-optional primitives From 1d3cd89dc30b0f3bf40dfa902c1ee7d0ded7393b Mon Sep 17 00:00:00 2001 From: michaeleustace Date: Wed, 19 Dec 2018 12:15:00 +0000 Subject: [PATCH 3/3] Fix typo --- DigiMeSDK/Repository/Classes/Objects/Social/Post.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DigiMeSDK/Repository/Classes/Objects/Social/Post.swift b/DigiMeSDK/Repository/Classes/Objects/Social/Post.swift index 991556bc6..d5e742e1e 100644 --- a/DigiMeSDK/Repository/Classes/Objects/Social/Post.swift +++ b/DigiMeSDK/Repository/Classes/Objects/Social/Post.swift @@ -60,6 +60,7 @@ public class Post: NSObject, BaseObjectDecodable { guard let originalPostId = originalPostIdentifierRaw else { return nil } + return String(describing: originalPostId) } public let originalPostUrl: String @@ -69,10 +70,11 @@ public class Post: NSObject, BaseObjectDecodable { public let personUsername: String public let postIdentifier: String public var postReplyCount: String? { - guard let replayCount = postReplyCountRaw else { + guard let replyCount = postReplyCountRaw else { return nil } - return String(describing: replayCount) + + return String(describing: replyCount) } public let postUrl: String