mirror of
https://github.com/cranci1/Sora.git
synced 2026-03-11 17:45:37 +00:00
added episodes refetching
Some checks are pending
Build and Release IPA / Build IPA (push) Waiting to run
Some checks are pending
Build and Release IPA / Build IPA (push) Waiting to run
This commit is contained in:
parent
19cb608934
commit
54a953a2ea
2 changed files with 46 additions and 12 deletions
|
|
@ -27,9 +27,11 @@ struct MediaInfoView: View {
|
|||
@State var airdate: String = ""
|
||||
@State var episodeLinks: [EpisodeLink] = []
|
||||
@State var itemID: Int?
|
||||
|
||||
@State var isLoading: Bool = true
|
||||
@State var showFullSynopsis: Bool = false
|
||||
@State var showedDrop: Bool = false
|
||||
@State var hasFetched: Bool = false
|
||||
@State var isRefetching: Bool = true
|
||||
|
||||
@AppStorage("externalPlayer") private var externalPlayer: String = "Default"
|
||||
|
||||
|
|
@ -179,6 +181,35 @@ struct MediaInfoView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
VStack(alignment: .leading, spacing: 10) {
|
||||
Text("Episodes")
|
||||
.font(.system(size: 18))
|
||||
.fontWeight(.bold)
|
||||
}
|
||||
VStack(spacing: 8) {
|
||||
if isRefetching {
|
||||
ProgressView()
|
||||
.padding()
|
||||
} else {
|
||||
Image(systemName: "exclamationmark.triangle")
|
||||
.font(.largeTitle)
|
||||
.foregroundColor(.secondary)
|
||||
HStack(spacing: 2) {
|
||||
Text("No episodes Found:")
|
||||
.foregroundColor(.secondary)
|
||||
Button(action: {
|
||||
isRefetching = true
|
||||
fetchDetails()
|
||||
}) {
|
||||
Text("Retry")
|
||||
.foregroundColor(.accentColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
|
|
@ -189,18 +220,18 @@ struct MediaInfoView: View {
|
|||
}
|
||||
}
|
||||
.onAppear {
|
||||
if !showedDrop {
|
||||
if !hasFetched {
|
||||
DropManager.shared.showDrop(title: "Fetching Data", subtitle: "Please wait while fetching", duration: 1.0, icon: UIImage(systemName: "arrow.triangle.2.circlepath"))
|
||||
showedDrop = true
|
||||
}
|
||||
fetchDetails()
|
||||
fetchItemID(byTitle: title) { result in
|
||||
switch result {
|
||||
case .success(let id):
|
||||
itemID = id
|
||||
case .failure(let error):
|
||||
Logger.shared.log("Failed to fetch Item ID: \(error)")
|
||||
fetchDetails()
|
||||
fetchItemID(byTitle: title) { result in
|
||||
switch result {
|
||||
case .success(let id):
|
||||
itemID = id
|
||||
case .failure(let error):
|
||||
Logger.shared.log("Failed to fetch Item ID: \(error)")
|
||||
}
|
||||
}
|
||||
hasFetched = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -220,6 +251,7 @@ struct MediaInfoView: View {
|
|||
}
|
||||
self.episodeLinks = episodes
|
||||
self.isLoading = false
|
||||
self.isRefetching = false
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -231,11 +263,13 @@ struct MediaInfoView: View {
|
|||
}
|
||||
self.episodeLinks = episodes
|
||||
self.isLoading = false
|
||||
self.isRefetching = false
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Logger.shared.log("Error loading module: \(error)", type: "Error")
|
||||
self.isLoading = false
|
||||
self.isRefetching = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ struct SearchView: View {
|
|||
.foregroundColor(.secondary)
|
||||
Text("No Results Found")
|
||||
.font(.headline)
|
||||
Text("Try different keywords/titles")
|
||||
Text("Try different keywords")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue