Naming it as `isSuccess` to match what it check
This commit is contained in:
parent
57ed6ef5d1
commit
e7c6931707
|
@ -16,7 +16,7 @@ class ImageManager : ObservableObject {
|
|||
|
||||
var manager = SDWebImageManager.shared
|
||||
weak var currentOperation: SDWebImageOperation? = nil
|
||||
var isFinished: Bool = false // true means request end, load() do nothing
|
||||
var isSuccess: Bool = false // true means request for this URL is ended forever, load() do nothing
|
||||
var isIncremental: Bool = false // true means during incremental loading
|
||||
|
||||
var url: URL?
|
||||
|
@ -70,7 +70,7 @@ class ImageManager : ObservableObject {
|
|||
self.isLoading = false
|
||||
self.progress = 1
|
||||
if let image = image {
|
||||
self.isFinished = true
|
||||
self.isSuccess = true
|
||||
self.successBlock?(image, cacheType)
|
||||
} else {
|
||||
self.failureBlock?(error ?? NSError())
|
||||
|
|
|
@ -55,14 +55,14 @@ public struct WebImage : View {
|
|||
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
|
||||
.onAppear {
|
||||
guard self.retryOnAppear else { return }
|
||||
if !self.imageManager.isFinished {
|
||||
if !self.imageManager.isSuccess {
|
||||
self.imageManager.load()
|
||||
}
|
||||
}
|
||||
.onDisappear {
|
||||
guard self.cancelOnDisappear else { return }
|
||||
// When using prorgessive loading, the previous partial image will cause onDisappear. Filter this case
|
||||
if !self.imageManager.isFinished && !self.imageManager.isIncremental {
|
||||
if !self.imageManager.isSuccess && !self.imageManager.isIncremental {
|
||||
self.imageManager.cancel()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue