|
|
@ -81,7 +81,7 @@ public class ConversationMediaView: UIView {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
guard let progress = attachmentDownloads.downloadProgress(forAttachmentId: attachmentId) else {
|
|
|
|
guard nil != attachmentDownloads.downloadProgress(forAttachmentId: attachmentId) else {
|
|
|
|
// Not being downloaded.
|
|
|
|
// Not being downloaded.
|
|
|
|
configureForMissingOrInvalid()
|
|
|
|
configureForMissingOrInvalid()
|
|
|
|
return
|
|
|
|
return
|
|
|
@ -94,7 +94,7 @@ public class ConversationMediaView: UIView {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private func addUploadProgressIfNecessary(_ subview: UIView,
|
|
|
|
private func addUploadProgressIfNecessary(_ subview: UIView,
|
|
|
|
progressCallback: @escaping ProgressCallback) {
|
|
|
|
progressCallback: ProgressCallback? = nil) {
|
|
|
|
guard isOutgoing else {
|
|
|
|
guard isOutgoing else {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -105,8 +105,10 @@ public class ConversationMediaView: UIView {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let uploadView = AttachmentUploadView(attachment: attachmentStream) { (isAttachmentReady) in
|
|
|
|
let uploadView = AttachmentUploadView(attachment: attachmentStream) { (isAttachmentReady) in
|
|
|
|
|
|
|
|
if let progressCallback = progressCallback {
|
|
|
|
progressCallback(isAttachmentReady)
|
|
|
|
progressCallback(isAttachmentReady)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
subview.addSubview(uploadView)
|
|
|
|
subview.addSubview(uploadView)
|
|
|
|
uploadView.autoPinEdgesToSuperviewEdges()
|
|
|
|
uploadView.autoPinEdgesToSuperviewEdges()
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -127,8 +129,8 @@ public class ConversationMediaView: UIView {
|
|
|
|
animatedImageView.backgroundColor = Theme.offBackgroundColor
|
|
|
|
animatedImageView.backgroundColor = Theme.offBackgroundColor
|
|
|
|
addSubview(animatedImageView)
|
|
|
|
addSubview(animatedImageView)
|
|
|
|
animatedImageView.autoPinEdgesToSuperviewEdges()
|
|
|
|
animatedImageView.autoPinEdgesToSuperviewEdges()
|
|
|
|
addUploadProgressIfNecessary(animatedImageView) { (_) in
|
|
|
|
addUploadProgressIfNecessary(animatedImageView)
|
|
|
|
}
|
|
|
|
|
|
|
|
loadBlock = { [weak self] in
|
|
|
|
loadBlock = { [weak self] in
|
|
|
|
guard let strongSelf = self else {
|
|
|
|
guard let strongSelf = self else {
|
|
|
|
return
|
|
|
|
return
|
|
|
@ -176,8 +178,7 @@ public class ConversationMediaView: UIView {
|
|
|
|
stillImageView.backgroundColor = Theme.offBackgroundColor
|
|
|
|
stillImageView.backgroundColor = Theme.offBackgroundColor
|
|
|
|
addSubview(stillImageView)
|
|
|
|
addSubview(stillImageView)
|
|
|
|
stillImageView.autoPinEdgesToSuperviewEdges()
|
|
|
|
stillImageView.autoPinEdgesToSuperviewEdges()
|
|
|
|
addUploadProgressIfNecessary(stillImageView) { (_) in
|
|
|
|
addUploadProgressIfNecessary(stillImageView)
|
|
|
|
}
|
|
|
|
|
|
|
|
loadBlock = { [weak self] in
|
|
|
|
loadBlock = { [weak self] in
|
|
|
|
guard let strongSelf = self else {
|
|
|
|
guard let strongSelf = self else {
|
|
|
|
return
|
|
|
|
return
|
|
|
|