mirror of
https://github.com/cranci1/Sora.git
synced 2026-01-11 20:10:24 +00:00
revert poster
This commit is contained in:
parent
f3ade3e7b2
commit
c6e704c04d
2 changed files with 24 additions and 10 deletions
|
|
@ -494,10 +494,21 @@ struct MediaInfoView: View {
|
|||
}
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
fetchTMDBPosterImageAndSet()
|
||||
}) {
|
||||
Label("Use TMDB Poster Image", systemImage: "photo")
|
||||
if UserDefaults.standard.string(forKey: "originalPoster_\(href)") != nil {
|
||||
Button(action: {
|
||||
if let originalPoster = UserDefaults.standard.string(forKey: "originalPoster_\(href)") {
|
||||
imageUrl = originalPoster
|
||||
UserDefaults.standard.removeObject(forKey: "tmdbPosterURL_\(href)")
|
||||
}
|
||||
}) {
|
||||
Label("Revert Module Poster", systemImage: "photo.badge.arrow.down")
|
||||
}
|
||||
} else {
|
||||
Button(action: {
|
||||
fetchTMDBPosterImageAndSet()
|
||||
}) {
|
||||
Label("Use TMDB Poster Image", systemImage: "photo")
|
||||
}
|
||||
}
|
||||
|
||||
Divider()
|
||||
|
|
@ -841,6 +852,9 @@ struct MediaInfoView: View {
|
|||
imageUrl = "https://image.tmdb.org/t/p/w\(tmdbImageWidth)\(posterPath)"
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
let currentPosterKey = "originalPoster_\(self.href)"
|
||||
let currentPoster = self.imageUrl
|
||||
UserDefaults.standard.set(currentPoster, forKey: currentPosterKey)
|
||||
self.imageUrl = imageUrl
|
||||
UserDefaults.standard.set(imageUrl, forKey: "tmdbPosterURL_\(self.href)")
|
||||
}
|
||||
|
|
@ -1216,7 +1230,7 @@ struct MediaInfoView: View {
|
|||
guard self.activeFetchID == fetchID else {
|
||||
return
|
||||
}
|
||||
self.playStream(url: streamUrl, fullURL: fullURL, subtitles: subtitles, headers: headers, fetchID: fetchID)
|
||||
self.playStream(url: streamUrl, fullURL: href, subtitles: subtitles, headers: headers, fetchID: fetchID)
|
||||
})
|
||||
|
||||
streamIndex += 1
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ fileprivate struct SettingsButtonRow: View {
|
|||
|
||||
struct SettingsViewData: View {
|
||||
@State private var showAlert = false
|
||||
@State private var cacheSizeText: String = "Calculating..."
|
||||
@State private var cacheSizeText: String = "..."
|
||||
@State private var isCalculatingSize: Bool = false
|
||||
@State private var cacheSize: Int64 = 0
|
||||
@State private var documentsSize: Int64 = 0
|
||||
|
|
@ -167,7 +167,7 @@ struct SettingsViewData: View {
|
|||
.frame(width: 24, height: 24)
|
||||
.foregroundStyle(.red)
|
||||
|
||||
Text("Clear All Caches")
|
||||
Text("Remove All Caches")
|
||||
.foregroundStyle(.red)
|
||||
|
||||
Spacer()
|
||||
|
|
@ -199,7 +199,7 @@ struct SettingsViewData: View {
|
|||
|
||||
SettingsButtonRow(
|
||||
icon: "doc.text",
|
||||
title: "Remove All Files in Documents",
|
||||
title: "Remove All Documents",
|
||||
subtitle: formatSize(documentsSize),
|
||||
action: {
|
||||
activeAlert = .removeDocs
|
||||
|
|
@ -271,7 +271,7 @@ struct SettingsViewData: View {
|
|||
|
||||
func calculateCacheSize() {
|
||||
isCalculatingSize = true
|
||||
cacheSizeText = "Calculating..."
|
||||
cacheSizeText = "..."
|
||||
|
||||
DispatchQueue.global(qos: .background).async {
|
||||
if let cacheURL = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first {
|
||||
|
|
@ -283,7 +283,7 @@ struct SettingsViewData: View {
|
|||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
self.cacheSizeText = "Unknown"
|
||||
self.cacheSizeText = "N/A"
|
||||
self.isCalculatingSize = false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue