mirror of
https://github.com/cranci1/Sora.git
synced 2026-04-21 08:32:00 +00:00
ok maybe too many UI elements
This commit is contained in:
parent
aca5cc6906
commit
2a4af77e6a
1 changed files with 64 additions and 75 deletions
|
|
@ -105,9 +105,65 @@ struct MediaInfoView: View {
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ZStack {
|
ZStack {
|
||||||
bodyContent
|
Group {
|
||||||
.navigationBarHidden(true)
|
if isLoading {
|
||||||
.ignoresSafeArea(.container, edges: .top)
|
ProgressView()
|
||||||
|
.padding()
|
||||||
|
} else {
|
||||||
|
mainScrollView
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.onAppear {
|
||||||
|
updateLatestProgress()
|
||||||
|
buttonRefreshTrigger.toggle()
|
||||||
|
|
||||||
|
let savedID = UserDefaults.standard.integer(forKey: "custom_anilist_id_\(href)")
|
||||||
|
if savedID != 0 { customAniListID = savedID }
|
||||||
|
|
||||||
|
if let savedPoster = UserDefaults.standard.string(forKey: "tmdbPosterURL_\(href)") {
|
||||||
|
self.imageUrl = savedPoster
|
||||||
|
}
|
||||||
|
|
||||||
|
if !hasFetched {
|
||||||
|
DropManager.shared.showDrop(title: "Fetching Data", subtitle: "Please wait while fetching.", duration: 0.5, icon: UIImage(systemName: "arrow.triangle.2.circlepath"))
|
||||||
|
fetchDetails()
|
||||||
|
|
||||||
|
if let savedID = UserDefaults.standard.object(forKey: "custom_anilist_id_\(href)") as? Int {
|
||||||
|
customAniListID = savedID
|
||||||
|
itemID = savedID
|
||||||
|
Logger.shared.log("Using custom AniList ID: \(savedID)", type: "Debug")
|
||||||
|
} else {
|
||||||
|
fetchMetadataIDIfNeeded()
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedRange = 0..<episodeChunkSize
|
||||||
|
|
||||||
|
hasFetched = true
|
||||||
|
AnalyticsManager.shared.sendEvent(event: "MediaInfoView", additionalData: ["title": title])
|
||||||
|
}
|
||||||
|
tabBarController.hideTabBar()
|
||||||
|
}
|
||||||
|
.onDisappear(){
|
||||||
|
tabBarController.showTabBar()
|
||||||
|
}
|
||||||
|
.alert("Loading Stream", isPresented: $showLoadingAlert) {
|
||||||
|
Button("Cancel", role: .cancel) {
|
||||||
|
activeFetchID = nil
|
||||||
|
isFetchingEpisode = false
|
||||||
|
showStreamLoadingView = false
|
||||||
|
}
|
||||||
|
} message: {
|
||||||
|
HStack {
|
||||||
|
Text("Loading Episode \(selectedEpisodeNumber)...")
|
||||||
|
ProgressView()
|
||||||
|
.padding(.top, 8)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.onDisappear {
|
||||||
|
activeFetchID = nil
|
||||||
|
isFetchingEpisode = false
|
||||||
|
showStreamLoadingView = false
|
||||||
|
}
|
||||||
|
|
||||||
VStack {
|
VStack {
|
||||||
HStack {
|
HStack {
|
||||||
|
|
@ -132,78 +188,6 @@ struct MediaInfoView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
|
||||||
private var bodyContent: some View {
|
|
||||||
Group {
|
|
||||||
if isLoading {
|
|
||||||
ProgressView()
|
|
||||||
.padding()
|
|
||||||
} else {
|
|
||||||
mainScrollView
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.onAppear {
|
|
||||||
updateLatestProgress()
|
|
||||||
buttonRefreshTrigger.toggle()
|
|
||||||
|
|
||||||
let savedID = UserDefaults.standard.integer(forKey: "custom_anilist_id_\(href)")
|
|
||||||
if savedID != 0 { customAniListID = savedID }
|
|
||||||
|
|
||||||
if let savedPoster = UserDefaults.standard.string(forKey: "tmdbPosterURL_\(href)") {
|
|
||||||
self.imageUrl = savedPoster
|
|
||||||
}
|
|
||||||
|
|
||||||
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
|
|
||||||
|
|
||||||
if !hasFetched {
|
|
||||||
DropManager.shared.showDrop(title: "Fetching Data", subtitle: "Please wait while fetching.", duration: 0.5, icon: UIImage(systemName: "arrow.triangle.2.circlepath"))
|
|
||||||
fetchDetails()
|
|
||||||
|
|
||||||
if let savedID = UserDefaults.standard.object(forKey: "custom_anilist_id_\(href)") as? Int {
|
|
||||||
customAniListID = savedID
|
|
||||||
itemID = savedID
|
|
||||||
Logger.shared.log("Using custom AniList ID: \(savedID)", type: "Debug")
|
|
||||||
} else {
|
|
||||||
fetchMetadataIDIfNeeded()
|
|
||||||
}
|
|
||||||
|
|
||||||
selectedRange = 0..<episodeChunkSize
|
|
||||||
|
|
||||||
hasFetched = true
|
|
||||||
AnalyticsManager.shared.sendEvent(event: "search", additionalData: ["title": title])
|
|
||||||
}
|
|
||||||
tabBarController.hideTabBar()
|
|
||||||
|
|
||||||
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
|
|
||||||
let window = windowScene.windows.first,
|
|
||||||
let navigationController = window.rootViewController?.children.first as? UINavigationController {
|
|
||||||
navigationController.interactivePopGestureRecognizer?.isEnabled = true
|
|
||||||
navigationController.interactivePopGestureRecognizer?.delegate = nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.onDisappear(){
|
|
||||||
tabBarController.showTabBar()
|
|
||||||
}
|
|
||||||
.alert("Loading Stream", isPresented: $showLoadingAlert) {
|
|
||||||
Button("Cancel", role: .cancel) {
|
|
||||||
activeFetchID = nil
|
|
||||||
isFetchingEpisode = false
|
|
||||||
showStreamLoadingView = false
|
|
||||||
}
|
|
||||||
} message: {
|
|
||||||
HStack {
|
|
||||||
Text("Loading Episode \(selectedEpisodeNumber)...")
|
|
||||||
ProgressView()
|
|
||||||
.padding(.top, 8)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.onDisappear {
|
|
||||||
activeFetchID = nil
|
|
||||||
isFetchingEpisode = false
|
|
||||||
showStreamLoadingView = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private var mainScrollView: some View {
|
private var mainScrollView: some View {
|
||||||
ScrollView {
|
ScrollView {
|
||||||
|
|
@ -584,6 +568,10 @@ struct MediaInfoView: View {
|
||||||
private var playAndBookmarkSection: some View {
|
private var playAndBookmarkSection: some View {
|
||||||
HStack(spacing: 12) {
|
HStack(spacing: 12) {
|
||||||
ZStack(alignment: .leading) {
|
ZStack(alignment: .leading) {
|
||||||
|
RoundedRectangle(cornerRadius: 25)
|
||||||
|
.fill(Color.accentColor)
|
||||||
|
.frame(height: 48)
|
||||||
|
|
||||||
Button(action: {
|
Button(action: {
|
||||||
playFirstUnwatchedEpisode()
|
playFirstUnwatchedEpisode()
|
||||||
}) {
|
}) {
|
||||||
|
|
@ -597,6 +585,7 @@ struct MediaInfoView: View {
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
.padding(.vertical, 12)
|
.padding(.vertical, 12)
|
||||||
.padding(.horizontal, 20)
|
.padding(.horizontal, 20)
|
||||||
|
.background(Color.clear)
|
||||||
.contentShape(RoundedRectangle(cornerRadius: 25))
|
.contentShape(RoundedRectangle(cornerRadius: 25))
|
||||||
}
|
}
|
||||||
.disabled(isFetchingEpisode)
|
.disabled(isFetchingEpisode)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue