Commit 851cd549 by Dmitriy Stepanets

Finished InMobiShorts model mapping

parent f58f3a79
......@@ -12,7 +12,7 @@
<key>OneWeatherNotificationServiceExtension.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>57</integer>
<integer>55</integer>
</dict>
<key>PG (Playground) 1.xcscheme</key>
<dict>
......
......@@ -3,38 +3,4 @@
uuid = "55281C35-FE9F-4CED-865E-FBED0E7393F6"
type = "0"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "7E92F321-211B-4E2A-A0ED-7D8541E572CA"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "InMobiShortsSource/InMobiShortsSource/InMobiShortSource.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "88"
endingLineNumber = "88"
landmarkName = "updateShorts(completion:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "A47DA89D-0414-467A-9D69-CB580EA7F2F1"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "InMobiShortsSource/InMobiShortsSource/InMobiShortSource.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "80"
endingLineNumber = "80"
landmarkName = "updateShorts(completion:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
......@@ -4,6 +4,27 @@
<dict>
<key>SchemeUserState</key>
<dict>
<key>InMobiShortsPG (Playground) 1.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>64</integer>
</dict>
<key>InMobiShortsPG (Playground) 2.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>65</integer>
</dict>
<key>InMobiShortsPG (Playground).xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>63</integer>
</dict>
<key>OneWeatherCorePlayground (Playground) 1.xcscheme</key>
<dict>
<key>isShown</key>
......@@ -135,7 +156,7 @@
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>60</integer>
<integer>61</integer>
</dict>
<key>PG (Playground) 1.xcscheme</key>
<dict>
......@@ -268,7 +289,7 @@
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>61</integer>
<integer>62</integer>
</dict>
</dict>
</dict>
......
import UIKit
let urlString = "https://kiowacountypress.net/content/hurricanes-wildfires-tornadoes-floods-–-whatever-your-local-risk-heres-how-be-more-weather"
let encodedString = urlString.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
let url = URL(string: encodedString!)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios' buildActiveScheme='true' importAppTypes='true'>
<timeline fileName='timeline.xctimeline'/>
</playground>
\ No newline at end of file
......@@ -31,6 +31,7 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
CD2C227E2670AC6D001ADA9A /* InMobiShortsPG.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = InMobiShortsPG.playground; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
CD427D1E266F657900B4350A /* OneWeatherCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = OneWeatherCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
CD427D22266F715900B4350A /* OneWeatherAnalytics.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = OneWeatherAnalytics.framework; sourceTree = BUILT_PRODUCTS_DIR; };
CDFE3F08266E407A00E72910 /* InMobiShortsSource.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = InMobiShortsSource.framework; sourceTree = BUILT_PRODUCTS_DIR; };
......@@ -80,6 +81,7 @@
CDFE3EFE266E407A00E72910 = {
isa = PBXGroup;
children = (
CD2C227E2670AC6D001ADA9A /* InMobiShortsPG.playground */,
CDFE3F0A266E407A00E72910 /* InMobiShortsSource */,
CDFE3F15266E407A00E72910 /* InMobiShortsSourceTests */,
CDFE3F09266E407A00E72910 /* Products */,
......
......@@ -135,14 +135,14 @@ public class InMobiShortSource: ShortSource {
updatedAtInSecs: glanceDetails.updatedAtInSecs,
startsAtInSecs: glanceDetails.startsAtInSecs,
endsAtInSecs: glanceDetails.endsAtInSecs,
shareURL: glanceDetails.shareURL,
shareURL: glanceDetails.encodedShareURL,
title: glanceDetails.peekData.title,
summaryText: glanceDetails.peek.articlePeek.summary,
sourceName: glanceDetails.peekData.sourceName,
heartCount: glanceDetails.peekData.heartCount,
shortURL: glanceDetails.peekData.shortURL,
shortURL: glanceDetails.peekData.encodedShortURL,
ctaText: glanceDetails.peekData.ctaText,
ctaURL: glanceDetails.peek.articlePeek.cta.url,
ctaURL: glanceDetails.peek.articlePeek.cta.encodedUrl,
likeCount: glanceDetails.glanceInteractionDetails.likeCount,
shareCount: glanceDetails.glanceInteractionDetails.shareCount)
}
......
......@@ -13,13 +13,19 @@ struct GlanceInteractionDetails: Codable {
}
struct GlanceDetails: Codable {
public let id: String
public let image: GlanceImage
public let updatedAtInSecs: TimeInterval
public let startsAtInSecs: TimeInterval
public let endsAtInSecs: TimeInterval
public let shareURL: URL?
public let peekData: PeekData
public let peek: Peek
public let glanceInteractionDetails: GlanceInteractionDetails
let id: String
let image: GlanceImage
let updatedAtInSecs: TimeInterval
let startsAtInSecs: TimeInterval
let endsAtInSecs: TimeInterval
var encodedShareURL:URL? {
guard let urlStirng = shareUrl else {
return nil
}
return URL(string: urlStirng)
}
let peekData: PeekData
let peek: Peek
let glanceInteractionDetails: GlanceInteractionDetails
private let shareUrl: String?
}
......@@ -17,7 +17,14 @@ struct ArticlePeek: Codable {
}
struct GlanceCTA: Codable {
let url: URL?
var encodedUrl: URL? {
guard let urlString = url?.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else {
return nil
}
return URL(string: urlString)
}
private let url: String?
let text: String
}
......@@ -11,6 +11,12 @@ struct PeekData: Codable {
let title:String
let sourceName:String
let heartCount:Int
let shortURL:URL?
var encodedShortURL:URL? {
guard let urlString = shortUrl else {
return nil
}
return URL(string: urlString)
}
let ctaText:String
private let shortUrl:String?
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment