leaky mem in MovieView

This commit is contained in:
Aiden Vigue 2021-05-22 21:59:47 -04:00
parent c541123d61
commit b1d5c141a7
4 changed files with 17 additions and 12 deletions

View File

@ -230,7 +230,7 @@ struct ContentView: View {
} }
let cache = SDImageCache(namespace: "tiny") let cache = SDImageCache(namespace: "tiny")
cache.config.maxMemoryCost = 50 * 1024 * 1024 // 100MB memory cache.config.maxMemoryCost = 50 * 1024 * 1024 // 50MB memory
cache.config.maxDiskSize = 1000 * 1024 * 1024 // 1000MB disk cache.config.maxDiskSize = 1000 * 1024 * 1024 // 1000MB disk
SDImageCachesManager.shared.addCache(cache) SDImageCachesManager.shared.addCache(cache)
SDWebImageManager.defaultImageCache = SDImageCachesManager.shared SDWebImageManager.defaultImageCache = SDImageCachesManager.shared

View File

@ -117,12 +117,13 @@ struct ContinueWatchingView: View {
VStack(alignment: .leading) { VStack(alignment: .leading) {
Spacer().frame(height: 10) Spacer().frame(height: 10)
if(item.Type == "Episode") { if(item.Type == "Episode") {
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.Id)/Images/\(item.ImageType)?maxWidth=500&quality=96&tag=\(item.Image)")!) WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.Id)/Images/\(item.ImageType)?maxWidth=550&quality=95&tag=\(item.Image)")!)
.resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size .resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
.placeholder { .placeholder {
Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 32, height: 32))!) Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 32, height: 32))!)
.resizable() .resizable()
.scaledToFit() .scaledToFit()
.frame(width: 320, height: 180)
.cornerRadius(10) .cornerRadius(10)
} }
.frame(width: 320, height: 180) .frame(width: 320, height: 180)
@ -147,12 +148,13 @@ struct ContinueWatchingView: View {
) )
.shadow(radius: 5) .shadow(radius: 5)
} else { } else {
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.Id)/Images/\(item.ImageType)?maxWidth=500&quality=96&tag=\(item.Image)")!) WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.Id)/Images/\(item.ImageType)?maxWidth=550&quality=85&tag=\(item.Image)")!)
.resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size .resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
.placeholder { .placeholder {
Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 32, height: 32))!) Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 32, height: 32))!)
.resizable() .resizable()
.scaledToFit() .scaledToFit()
.frame(width: 320, height: 180)
.cornerRadius(10) .cornerRadius(10)
} }
.frame(width: 320, height: 180) .frame(width: 320, height: 180)
@ -178,9 +180,9 @@ struct ContinueWatchingView: View {
} }
Spacer().frame(width:14) Spacer().frame(width:14)
} }
}.frame(height: 200) }.frame(height: 215)
} }
.frame(height: 200) .frame(height: 215)
.padding(.bottom, 10) .padding(.bottom, 10)
} }
} else { } else {

View File

@ -91,12 +91,13 @@ struct LatestMediaView: View {
VStack(alignment: .leading) { VStack(alignment: .leading) {
if(item.Type == "Series") { if(item.Type == "Series") {
Spacer().frame(height:10) Spacer().frame(height:10)
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.Id)/Images/\(item.ImageType)?maxWidth=250&quality=90&tag=\(item.Image)")!) WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.Id)/Images/\(item.ImageType)?maxWidth=250&quality=85&tag=\(item.Image)")!)
.resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size .resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
.placeholder { .placeholder {
Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 32, height: 32))!) Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 16, height: 16))!)
.resizable() .resizable()
.scaledToFit() .scaledToFit()
.frame(width: 100, height: 150)
.cornerRadius(10) .cornerRadius(10)
} }
.frame(width: 100, height: 150) .frame(width: 100, height: 150)
@ -121,12 +122,13 @@ struct LatestMediaView: View {
).shadow(radius: 6) ).shadow(radius: 6)
} else { } else {
Spacer().frame(height:10) Spacer().frame(height:10)
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.Id)/Images/\(item.ImageType)?maxWidth=250&quality=90&tag=\(item.Image)")!) WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.Id)/Images/\(item.ImageType)?maxWidth=250&quality=85&tag=\(item.Image)")!)
.resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size .resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
.placeholder { .placeholder {
Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 32, height: 32))!) Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 16, height: 16))!)
.resizable() .resizable()
.scaledToFit() .scaledToFit()
.frame(width: 100, height: 150)
.cornerRadius(10) .cornerRadius(10)
} }
.frame(width: 100, height: 150) .frame(width: 100, height: 150)

View File

@ -79,12 +79,13 @@ struct NextUpView: View {
NavigationLink(destination: ItemView(item: item)) { NavigationLink(destination: ItemView(item: item)) {
VStack(alignment: .leading) { VStack(alignment: .leading) {
Spacer().frame(height:10) Spacer().frame(height:10)
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.SeriesId ?? "")/Images/\(item.ImageType)?maxWidth=250&quality=90&tag=\(item.Image)")!) WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.SeriesId ?? "")/Images/\(item.ImageType)?maxWidth=250&quality=85&tag=\(item.Image)")!)
.resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size .resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
.placeholder { .placeholder {
Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 32, height: 32))!) Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 16, height: 16))!)
.resizable() .resizable()
.scaledToFit() .scaledToFit()
.frame(width: 100, height: 150)
.cornerRadius(10) .cornerRadius(10)
} }
.frame(width: 100, height: 150) .frame(width: 100, height: 150)