mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Apply invalid and rety assets.
This commit is contained in:
parent
934164cd12
commit
15c42642e0
9 changed files with 72 additions and 3 deletions
23
Signal/Images.xcassets/media_invalid.imageset/Contents.json
vendored
Normal file
23
Signal/Images.xcassets/media_invalid.imageset/Contents.json
vendored
Normal 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"
|
||||
}
|
||||
}
|
BIN
Signal/Images.xcassets/media_invalid.imageset/photo-error-36.png
vendored
Normal file
BIN
Signal/Images.xcassets/media_invalid.imageset/photo-error-36.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 485 B |
BIN
Signal/Images.xcassets/media_invalid.imageset/photo-error-36@2x.png
vendored
Normal file
BIN
Signal/Images.xcassets/media_invalid.imageset/photo-error-36@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
BIN
Signal/Images.xcassets/media_invalid.imageset/photo-error-36@3x.png
vendored
Normal file
BIN
Signal/Images.xcassets/media_invalid.imageset/photo-error-36@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
23
Signal/Images.xcassets/media_retry.imageset/Contents.json
vendored
Normal file
23
Signal/Images.xcassets/media_retry.imageset/Contents.json
vendored
Normal 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"
|
||||
}
|
||||
}
|
BIN
Signal/Images.xcassets/media_retry.imageset/retry-36.png
vendored
Normal file
BIN
Signal/Images.xcassets/media_retry.imageset/retry-36.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 561 B |
BIN
Signal/Images.xcassets/media_retry.imageset/retry-36@2x.png
vendored
Normal file
BIN
Signal/Images.xcassets/media_retry.imageset/retry-36@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
Signal/Images.xcassets/media_retry.imageset/retry-36@3x.png
vendored
Normal file
BIN
Signal/Images.xcassets/media_retry.imageset/retry-36@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
|
@ -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?,
|
||||
|
|
Loading…
Reference in a new issue