Skip to content

Commit

Permalink
Merge pull request #160 from TheM4hd1/sb/bugfixes
Browse files Browse the repository at this point in the history
Fix #159
  • Loading branch information
TheM4hd1 authored Mar 4, 2020
2 parents 8e395ff + 0c1baa3 commit 873f0eb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion SwiftyInsta.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "SwiftyInsta"
s.version = "2.2.4"
s.version = "2.2.5"
s.summary = "Private and Tokenless Instagram RESTful API."

s.homepage = "https://github.com/TheM4hd1/SwiftyInsta"
Expand Down
6 changes: 3 additions & 3 deletions SwiftyInsta/API/Handlers/StoryHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public final class StoryHandler: Handler {
}

/// Get reels media feed.
public func reelsMedia(_ feeds: [String], completionHandler: @escaping (Result<[String: Tray], Error>) -> Void) {
public func reelsMedia(_ feeds: [String], completionHandler: @escaping (Result<[String: TrayElement], Error>) -> Void) {
guard let storage = handler.response?.storage else {
return completionHandler(.failure(GenericError.custom("Invalid `Authentication.Response` in `APIHandler.respone`. Log in again.")))
}
Expand All @@ -294,11 +294,11 @@ public final class StoryHandler: Handler {
Headers.igSignatureVersionKey: Headers.igSignatureVersionValue
]

requests.request([String: Tray].self,
requests.request([String: TrayElement].self,
method: .post,
endpoint: Endpoint.Feed.reelsMedia,
body: .parameters(body),
process: { $0.reels.dictionary?.compactMapValues { Tray(rawResponse: $0) } ?? [:] },
process: { $0.reels.dictionary?.compactMapValues { TrayElement(rawResponse: $0) } ?? [:] },
completion: completionHandler)
} catch { completionHandler(.failure(error)) }
}
Expand Down
3 changes: 1 addition & 2 deletions SwiftyInsta/Local/Responses/StoryResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public struct Tray: IdentifiableParsedResponse {

/// The actual `TrayElement`s.
public var items: [TrayElement] {
return (rawResponse.tray.array ?? rawResponse.items.array)?
.compactMap { TrayElement(rawResponse: $0) } ?? []
return rawResponse.tray.array?.compactMap { TrayElement(rawResponse: $0) } ?? []
}

// MARK: Codable
Expand Down
2 changes: 1 addition & 1 deletion SwiftyInsta/UI/LoginWebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ public class LoginWebViewController: UIViewController {
dismiss(animated: true, completion: nil)
}
}
#endif
#endif

0 comments on commit 873f0eb

Please sign in to comment.