mirror of
git://jb55.com/damus
synced 2024-10-06 19:53:22 +00:00
Fix frequent KFImage hang
Changelog-Fixed: Fix some hangs when scrolling by images Closes: #614
This commit is contained in:
parent
1e22984d52
commit
f0075904c2
@ -231,10 +231,10 @@ struct ImageCarousel: View {
|
|||||||
KFAnimatedImage(url)
|
KFAnimatedImage(url)
|
||||||
.callbackQueue(.dispatch(.global(qos: .background)))
|
.callbackQueue(.dispatch(.global(qos: .background)))
|
||||||
.processingQueue(.dispatch(.global(qos: .background)))
|
.processingQueue(.dispatch(.global(qos: .background)))
|
||||||
|
.cancelOnDisappear(true)
|
||||||
|
.backgroundDecode()
|
||||||
.cacheOriginalImage()
|
.cacheOriginalImage()
|
||||||
.loadDiskFileSynchronously()
|
|
||||||
.scaleFactor(UIScreen.main.scale)
|
.scaleFactor(UIScreen.main.scale)
|
||||||
.fade(duration: 0.1)
|
|
||||||
.configure { view in
|
.configure { view in
|
||||||
view.framePreloadCount = 3
|
view.framePreloadCount = 3
|
||||||
}
|
}
|
||||||
|
@ -33,15 +33,15 @@ struct InnerBannerImageView: View {
|
|||||||
.processingQueue(.dispatch(.global(qos: .background)))
|
.processingQueue(.dispatch(.global(qos: .background)))
|
||||||
.serialize(by: imageModel.serializer)
|
.serialize(by: imageModel.serializer)
|
||||||
.setProcessor(imageModel.processor)
|
.setProcessor(imageModel.processor)
|
||||||
|
.cacheOriginalImage()
|
||||||
.configure { view in
|
.configure { view in
|
||||||
view.framePreloadCount = 1
|
view.framePreloadCount = 3
|
||||||
}
|
}
|
||||||
.placeholder { _ in
|
.placeholder { _ in
|
||||||
Color(uiColor: .secondarySystemBackground)
|
Color(uiColor: .secondarySystemBackground)
|
||||||
}
|
}
|
||||||
.scaleFactor(UIScreen.main.scale)
|
.scaleFactor(UIScreen.main.scale)
|
||||||
.loadDiskFileSynchronously()
|
.loadDiskFileSynchronously()
|
||||||
.fade(duration: 0.1)
|
|
||||||
.onFailureImage(defaultImage)
|
.onFailureImage(defaultImage)
|
||||||
.id(imageModel.refreshID)
|
.id(imageModel.refreshID)
|
||||||
} else {
|
} else {
|
||||||
|
@ -70,19 +70,20 @@ struct InnerProfilePicView: View {
|
|||||||
KFAnimatedImage(imageModel.url)
|
KFAnimatedImage(imageModel.url)
|
||||||
.callbackQueue(.dispatch(.global(qos: .background)))
|
.callbackQueue(.dispatch(.global(qos: .background)))
|
||||||
.processingQueue(.dispatch(.global(qos: .background)))
|
.processingQueue(.dispatch(.global(qos: .background)))
|
||||||
|
.cancelOnDisappear(true)
|
||||||
|
.backgroundDecode()
|
||||||
.serialize(by: imageModel.serializer)
|
.serialize(by: imageModel.serializer)
|
||||||
.setProcessor(imageModel.processor)
|
.setProcessor(imageModel.processor)
|
||||||
.cacheOriginalImage()
|
.cacheOriginalImage()
|
||||||
|
.scaleFactor(UIScreen.main.scale)
|
||||||
.configure { view in
|
.configure { view in
|
||||||
view.framePreloadCount = 1
|
view.framePreloadCount = 3
|
||||||
}
|
}
|
||||||
.placeholder { _ in
|
.placeholder { _ in
|
||||||
Placeholder
|
Placeholder
|
||||||
}
|
}
|
||||||
.scaleFactor(UIScreen.main.scale)
|
.onFailure { error in
|
||||||
.loadDiskFileSynchronously()
|
if error.isTaskCancelled { return }
|
||||||
.fade(duration: 0.1)
|
|
||||||
.onFailure { _ in
|
|
||||||
imageModel.downloadFailed()
|
imageModel.downloadFailed()
|
||||||
}
|
}
|
||||||
.id(imageModel.refreshID)
|
.id(imageModel.refreshID)
|
||||||
|
Loading…
Reference in New Issue
Block a user