POP THE CHAMPAGNE 🍾 (#161)
Some checks are pending
Build and Release / Build IPA (push) Waiting to run
Build and Release / Build Mac Catalyst (push) Waiting to run

This commit is contained in:
Seiike 2025-06-09 07:55:44 +02:00 committed by GitHub
parent 291b2d8c66
commit 785297cd2a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 44 additions and 10 deletions

View file

@ -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(

View file

@ -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

View file

@ -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
}) {