Apply invalid and rety assets.

This commit is contained in:
Matthew Chen 2018-11-08 16:11:53 -05:00
parent 934164cd12
commit 15c42642e0
9 changed files with 72 additions and 3 deletions

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "photo-error-36.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "photo-error-36@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "photo-error-36@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "retry-36.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "retry-36@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "retry-36@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -265,10 +265,33 @@ public class ConversationMediaView: UIView {
}
}
private func isFailedDownload() -> Bool {
guard let attachmentPointer = attachment as? TSAttachmentPointer else {
return false
}
return attachmentPointer.state == .failed
}
private func configureForMissingOrInvalid() {
// TODO: Get final value from design.
backgroundColor = UIColor.ows_gray45
// TODO: Add error icon.
backgroundColor = UIColor.ows_gray05
let icon: UIImage
if isFailedDownload() {
guard let asset = UIImage(named: "media_retry") else {
owsFailDebug("Missing image")
return
}
icon = asset
} else {
guard let asset = UIImage(named: "media_invalid") else {
owsFailDebug("Missing image")
return
}
icon = asset
}
let iconView = UIImageView(image: icon.withRenderingMode(.alwaysTemplate))
iconView.tintColor = Theme.primaryColor.withAlphaComponent(0.6)
self.addSubview(iconView)
iconView.autoCenterInSuperview()
}
private func tryToLoadMedia(loadMediaBlock: @escaping () -> AnyObject?,