Animate inline and profile pics too
Changelog-Fixed: Animated gif are now show inline and in profile pictures
This commit is contained in:
committed by
William Casarin
parent
5f93c580eb
commit
54700e944c
@@ -17,11 +17,14 @@ struct ImageViewer: View {
|
|||||||
VStack{
|
VStack{
|
||||||
Text(url.lastPathComponent)
|
Text(url.lastPathComponent)
|
||||||
|
|
||||||
KFImage(url)
|
KFAnimatedImage(url)
|
||||||
|
.configure { view in
|
||||||
|
view.framePreloadCount = 3
|
||||||
|
}
|
||||||
|
.cacheOriginalImage()
|
||||||
.loadDiskFileSynchronously()
|
.loadDiskFileSynchronously()
|
||||||
.scaleFactor(UIScreen.main.scale)
|
.scaleFactor(UIScreen.main.scale)
|
||||||
.fade(duration: 0.1)
|
.fade(duration: 0.1)
|
||||||
.resizable()
|
|
||||||
.aspectRatio(contentMode: .fit)
|
.aspectRatio(contentMode: .fit)
|
||||||
.tabItem {
|
.tabItem {
|
||||||
Text(url.absoluteString)
|
Text(url.absoluteString)
|
||||||
@@ -43,11 +46,14 @@ struct ImageCarousel: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
TabView {
|
TabView {
|
||||||
ForEach(urls, id: \.absoluteString) { url in
|
ForEach(urls, id: \.absoluteString) { url in
|
||||||
KFImage(url)
|
KFAnimatedImage(url)
|
||||||
|
.configure { view in
|
||||||
|
view.framePreloadCount = 3
|
||||||
|
}
|
||||||
|
.cacheOriginalImage()
|
||||||
.loadDiskFileSynchronously()
|
.loadDiskFileSynchronously()
|
||||||
.scaleFactor(UIScreen.main.scale)
|
.scaleFactor(UIScreen.main.scale)
|
||||||
.fade(duration: 0.1)
|
.fade(duration: 0.1)
|
||||||
.resizable()
|
|
||||||
.aspectRatio(contentMode: .fit)
|
.aspectRatio(contentMode: .fit)
|
||||||
.tabItem {
|
.tabItem {
|
||||||
Text(url.absoluteString)
|
Text(url.absoluteString)
|
||||||
|
|||||||
@@ -56,16 +56,19 @@ struct ProfilePicView: View {
|
|||||||
Group {
|
Group {
|
||||||
let pic = picture ?? profiles.lookup(id: pubkey)?.picture ?? robohash(pubkey)
|
let pic = picture ?? profiles.lookup(id: pubkey)?.picture ?? robohash(pubkey)
|
||||||
let url = URL(string: pic)
|
let url = URL(string: pic)
|
||||||
let processor = ResizingImageProcessor(referenceSize: CGSize(width: size, height: size))
|
|
||||||
|
|
||||||
KFImage.url(url)
|
KFAnimatedImage(url)
|
||||||
|
.configure { view in
|
||||||
|
view.framePreloadCount = 1
|
||||||
|
}
|
||||||
.placeholder { _ in
|
.placeholder { _ in
|
||||||
Placeholder
|
Placeholder
|
||||||
}
|
}
|
||||||
.setProcessor(processor)
|
.cacheOriginalImage()
|
||||||
.scaleFactor(UIScreen.main.scale)
|
.scaleFactor(UIScreen.main.scale)
|
||||||
.loadDiskFileSynchronously()
|
.loadDiskFileSynchronously()
|
||||||
.fade(duration: 0.1)
|
.fade(duration: 0.1)
|
||||||
|
.frame(width: size, height: size)
|
||||||
.clipShape(Circle())
|
.clipShape(Circle())
|
||||||
.overlay(Circle().stroke(highlight_color(highlight), lineWidth: pfp_line_width(highlight)))
|
.overlay(Circle().stroke(highlight_color(highlight), lineWidth: pfp_line_width(highlight)))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user