Respond to CR.

pull/1/head
Matthew Chen 7 years ago
parent 358d97bf5b
commit b9404938c4

@ -212,6 +212,8 @@ public class ConversationMediaView: UIView {
_ = addUploadProgressIfNecessary(animatedImageView) _ = addUploadProgressIfNecessary(animatedImageView)
loadBlock = { [weak self] in loadBlock = { [weak self] in
AssertIsOnMainThread()
if animatedImageView.image != nil { if animatedImageView.image != nil {
owsFailDebug("Unexpectedly already loaded.") owsFailDebug("Unexpectedly already loaded.")
return return
@ -240,6 +242,8 @@ public class ConversationMediaView: UIView {
cacheKey: cacheKey) cacheKey: cacheKey)
} }
unloadBlock = { unloadBlock = {
AssertIsOnMainThread()
animatedImageView.image = nil animatedImageView.image = nil
} }
} }
@ -262,6 +266,8 @@ public class ConversationMediaView: UIView {
stillImageView.autoPinEdgesToSuperviewEdges() stillImageView.autoPinEdgesToSuperviewEdges()
_ = addUploadProgressIfNecessary(stillImageView) _ = addUploadProgressIfNecessary(stillImageView)
loadBlock = { [weak self] in loadBlock = { [weak self] in
AssertIsOnMainThread()
if stillImageView.image != nil { if stillImageView.image != nil {
owsFailDebug("Unexpectedly already loaded.") owsFailDebug("Unexpectedly already loaded.")
return return
@ -291,6 +297,8 @@ public class ConversationMediaView: UIView {
cacheKey: cacheKey) cacheKey: cacheKey)
} }
unloadBlock = { unloadBlock = {
AssertIsOnMainThread()
stillImageView.image = nil stillImageView.image = nil
} }
} }
@ -321,6 +329,8 @@ public class ConversationMediaView: UIView {
} }
loadBlock = { [weak self] in loadBlock = { [weak self] in
AssertIsOnMainThread()
if stillImageView.image != nil { if stillImageView.image != nil {
owsFailDebug("Unexpectedly already loaded.") owsFailDebug("Unexpectedly already loaded.")
return return
@ -350,6 +360,8 @@ public class ConversationMediaView: UIView {
cacheKey: cacheKey) cacheKey: cacheKey)
} }
unloadBlock = { unloadBlock = {
AssertIsOnMainThread()
stillImageView.image = nil stillImageView.image = nil
} }
} }
@ -464,7 +476,7 @@ public class ConversationMediaView: UIView {
// views that are no longer visible, redundant loads // views that are no longer visible, redundant loads
// of media already being loaded, don't retry media // of media already being loaded, don't retry media
// that can't be loaded, etc.). // that can't be loaded, etc.).
private static let loadQueue = DispatchQueue(label: "org.signal.asyncMediaLoadQueue") private static let loadQueue: DispatchQueue(label: "org.signal.asyncMediaLoadQueue", qos:.userInteractive)
@objc @objc
public func loadMedia() { public func loadMedia() {

Loading…
Cancel
Save