Skip to content

Commit

Permalink
ドキュメントに書かずにしれっとnullableにしないでください (音声が添付されている時にpreview_urlがnullに…
Browse files Browse the repository at this point in the history
…なることがあるのに対応)
  • Loading branch information
rinsuki committed Jul 22, 2020
1 parent a98ea48 commit 0c47b4a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Sources/Core/Mastodon/API/MastodonAttachment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public struct MastodonAttachment: Codable {
let id: MastodonID
public let type: MediaType
public let url: String
public let previewUrl: String
public let previewUrl: String?
let remoteUrl: String?
public let textUrl: String?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ class AttachedMediaListViewController: UIViewController, Instantiatable, Injecta
// swiftlint:disable:next force_cast
let imageView = mediaStackView.arrangedSubviews[i] as! UIImageView
imageView.image = nil
imageView.sd_setImage(with: URL(string: media.previewUrl), completed: nil)
if let previewURL = media.previewUrl {
imageView.sd_setImage(with: URL(string: previewURL), completed: nil)
}
imageView.isHidden = false
}

Expand Down

0 comments on commit 0c47b4a

Please sign in to comment.