mirror of
https://github.com/cranci1/Sora.git
synced 2026-04-21 08:32:00 +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 {
|
struct LibraryView: View {
|
||||||
@EnvironmentObject private var libraryManager: LibraryManager
|
@EnvironmentObject private var libraryManager: LibraryManager
|
||||||
@EnvironmentObject private var moduleManager: ModuleManager
|
@EnvironmentObject private var moduleManager: ModuleManager
|
||||||
|
@Environment(\.scenePhase) private var scenePhase
|
||||||
|
|
||||||
@AppStorage("mediaColumnsPortrait") private var mediaColumnsPortrait: Int = 2
|
@AppStorage("mediaColumnsPortrait") private var mediaColumnsPortrait: Int = 2
|
||||||
@AppStorage("mediaColumnsLandscape") private var mediaColumnsLandscape: Int = 4
|
@AppStorage("mediaColumnsLandscape") private var mediaColumnsLandscape: Int = 4
|
||||||
|
|
@ -165,6 +166,11 @@ struct LibraryView: View {
|
||||||
.onAppear {
|
.onAppear {
|
||||||
fetchContinueWatching()
|
fetchContinueWatching()
|
||||||
}
|
}
|
||||||
|
.onChange(of: scenePhase) { newPhase in
|
||||||
|
if newPhase == .active {
|
||||||
|
fetchContinueWatching()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.navigationViewStyle(StackNavigationViewStyle())
|
.navigationViewStyle(StackNavigationViewStyle())
|
||||||
|
|
@ -237,8 +243,8 @@ struct ContinueWatchingCell: View {
|
||||||
var markAsWatched: () -> Void
|
var markAsWatched: () -> Void
|
||||||
var removeItem: () -> Void
|
var removeItem: () -> Void
|
||||||
|
|
||||||
@State private
|
@State private var currentProgress: Double = 0.0
|
||||||
var currentProgress: Double = 0.0
|
@Environment(\.scenePhase) private var scenePhase
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Button(action: {
|
Button(action: {
|
||||||
|
|
@ -292,7 +298,7 @@ struct ContinueWatchingCell: View {
|
||||||
RoundedRectangle(cornerRadius: 10)
|
RoundedRectangle(cornerRadius: 10)
|
||||||
.fill(Color.gray.opacity(0.3))
|
.fill(Color.gray.opacity(0.3))
|
||||||
.frame(width: 280, height: 157.03)
|
.frame(width: 280, height: 157.03)
|
||||||
.shimmering()
|
.redacted(reason: .placeholder)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.overlay(
|
.overlay(
|
||||||
|
|
@ -388,11 +394,11 @@ struct ContinueWatchingCell: View {
|
||||||
.onAppear {
|
.onAppear {
|
||||||
updateProgress()
|
updateProgress()
|
||||||
}
|
}
|
||||||
.onReceive(NotificationCenter.default.publisher(
|
.onChange(of: scenePhase) { newPhase in
|
||||||
for: UIApplication.didBecomeActiveNotification)) {
|
if newPhase == .active {
|
||||||
_ in
|
|
||||||
updateProgress()
|
updateProgress()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateProgress() {
|
private func updateProgress() {
|
||||||
|
|
@ -547,8 +553,8 @@ struct BookmarkItemView: View {
|
||||||
} else {
|
} else {
|
||||||
RoundedRectangle(cornerRadius: 12)
|
RoundedRectangle(cornerRadius: 12)
|
||||||
.fill(Color.gray.opacity(0.3))
|
.fill(Color.gray.opacity(0.3))
|
||||||
.aspectRatio(2 / 3, contentMode: .fit)
|
.aspectRatio(2/3, contentMode: .fit)
|
||||||
.shimmering()
|
.redacted(reason: .placeholder)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.overlay(
|
.overlay(
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ struct MediaInfoView: View {
|
||||||
@State private var isMatchingPresented = false
|
@State private var isMatchingPresented = false
|
||||||
@State private var matchedTitle: String? = nil
|
@State private var matchedTitle: String? = nil
|
||||||
|
|
||||||
@StateObject private var jsController = JSController.shared
|
@ObservedObject private var jsController = JSController.shared
|
||||||
@EnvironmentObject var moduleManager: ModuleManager
|
@EnvironmentObject var moduleManager: ModuleManager
|
||||||
@EnvironmentObject private var libraryManager: LibraryManager
|
@EnvironmentObject private var libraryManager: LibraryManager
|
||||||
@EnvironmentObject var tabBarController: TabBarController
|
@EnvironmentObject var tabBarController: TabBarController
|
||||||
|
|
@ -166,6 +166,34 @@ struct MediaInfoView: View {
|
||||||
.onDisappear(){
|
.onDisappear(){
|
||||||
tabBarController.showTabBar()
|
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) {
|
.alert("Loading Stream", isPresented: $showLoadingAlert) {
|
||||||
Button("Cancel", role: .cancel) {
|
Button("Cancel", role: .cancel) {
|
||||||
activeFetchID = nil
|
activeFetchID = nil
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,7 @@ struct SettingsViewModule: View {
|
||||||
.navigationTitle("Modules")
|
.navigationTitle("Modules")
|
||||||
.navigationBarItems(trailing:
|
.navigationBarItems(trailing:
|
||||||
HStack(spacing: 16) {
|
HStack(spacing: 16) {
|
||||||
if didReceiveDefaultPageLink && !moduleManager.modules.isEmpty {
|
if didReceiveDefaultPageLink {
|
||||||
Button(action: {
|
Button(action: {
|
||||||
showLibrary = true
|
showLibrary = true
|
||||||
}) {
|
}) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue