mirror of
https://github.com/cranci1/Sora.git
synced 2026-01-11 20:10:24 +00:00
POP THE CHAMPAGNE 🍾 (#161)
This commit is contained in:
parent
291b2d8c66
commit
785297cd2a
3 changed files with 44 additions and 10 deletions
|
|
@ -12,6 +12,7 @@ import SwiftUI
|
|||
struct LibraryView: View {
|
||||
@EnvironmentObject private var libraryManager: LibraryManager
|
||||
@EnvironmentObject private var moduleManager: ModuleManager
|
||||
@Environment(\.scenePhase) private var scenePhase
|
||||
|
||||
@AppStorage("mediaColumnsPortrait") private var mediaColumnsPortrait: Int = 2
|
||||
@AppStorage("mediaColumnsLandscape") private var mediaColumnsLandscape: Int = 4
|
||||
|
|
@ -165,6 +166,11 @@ struct LibraryView: View {
|
|||
.onAppear {
|
||||
fetchContinueWatching()
|
||||
}
|
||||
.onChange(of: scenePhase) { newPhase in
|
||||
if newPhase == .active {
|
||||
fetchContinueWatching()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
|
|
@ -237,8 +243,8 @@ struct ContinueWatchingCell: View {
|
|||
var markAsWatched: () -> Void
|
||||
var removeItem: () -> Void
|
||||
|
||||
@State private
|
||||
var currentProgress: Double = 0.0
|
||||
@State private var currentProgress: Double = 0.0
|
||||
@Environment(\.scenePhase) private var scenePhase
|
||||
|
||||
var body: some View {
|
||||
Button(action: {
|
||||
|
|
@ -292,7 +298,7 @@ struct ContinueWatchingCell: View {
|
|||
RoundedRectangle(cornerRadius: 10)
|
||||
.fill(Color.gray.opacity(0.3))
|
||||
.frame(width: 280, height: 157.03)
|
||||
.shimmering()
|
||||
.redacted(reason: .placeholder)
|
||||
}
|
||||
}
|
||||
.overlay(
|
||||
|
|
@ -388,11 +394,11 @@ struct ContinueWatchingCell: View {
|
|||
.onAppear {
|
||||
updateProgress()
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(
|
||||
for: UIApplication.didBecomeActiveNotification)) {
|
||||
_ in
|
||||
.onChange(of: scenePhase) { newPhase in
|
||||
if newPhase == .active {
|
||||
updateProgress()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func updateProgress() {
|
||||
|
|
@ -547,8 +553,8 @@ struct BookmarkItemView: View {
|
|||
} else {
|
||||
RoundedRectangle(cornerRadius: 12)
|
||||
.fill(Color.gray.opacity(0.3))
|
||||
.aspectRatio(2 / 3, contentMode: .fit)
|
||||
.shimmering()
|
||||
.aspectRatio(2/3, contentMode: .fit)
|
||||
.redacted(reason: .placeholder)
|
||||
}
|
||||
}
|
||||
.overlay(
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ struct MediaInfoView: View {
|
|||
@State private var isMatchingPresented = false
|
||||
@State private var matchedTitle: String? = nil
|
||||
|
||||
@StateObject private var jsController = JSController.shared
|
||||
@ObservedObject private var jsController = JSController.shared
|
||||
@EnvironmentObject var moduleManager: ModuleManager
|
||||
@EnvironmentObject private var libraryManager: LibraryManager
|
||||
@EnvironmentObject var tabBarController: TabBarController
|
||||
|
|
@ -166,6 +166,34 @@ struct MediaInfoView: View {
|
|||
.onDisappear(){
|
||||
tabBarController.showTabBar()
|
||||
}
|
||||
.task {
|
||||
guard !hasFetched else { return }
|
||||
|
||||
let savedCustomID = UserDefaults.standard.integer(forKey: "custom_anilist_id_\(href)")
|
||||
if savedCustomID != 0 { customAniListID = savedCustomID }
|
||||
if let savedPoster = UserDefaults.standard.string(forKey: "tmdbPosterURL_\(href)") {
|
||||
imageUrl = savedPoster
|
||||
}
|
||||
DropManager.shared.showDrop(
|
||||
title: "Fetching Data",
|
||||
subtitle: "Please wait while fetching.",
|
||||
duration: 0.5,
|
||||
icon: UIImage(systemName: "arrow.triangle.2.circlepath")
|
||||
)
|
||||
fetchDetails()
|
||||
|
||||
if savedCustomID != 0 {
|
||||
itemID = savedCustomID
|
||||
} else {
|
||||
fetchMetadataIDIfNeeded()
|
||||
}
|
||||
|
||||
hasFetched = true
|
||||
AnalyticsManager.shared.sendEvent(
|
||||
event: "MediaInfoView",
|
||||
additionalData: ["title": title]
|
||||
)
|
||||
}
|
||||
.alert("Loading Stream", isPresented: $showLoadingAlert) {
|
||||
Button("Cancel", role: .cancel) {
|
||||
activeFetchID = nil
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ struct SettingsViewModule: View {
|
|||
.navigationTitle("Modules")
|
||||
.navigationBarItems(trailing:
|
||||
HStack(spacing: 16) {
|
||||
if didReceiveDefaultPageLink && !moduleManager.modules.isEmpty {
|
||||
if didReceiveDefaultPageLink {
|
||||
Button(action: {
|
||||
showLibrary = true
|
||||
}) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue