From 3c04b8540f8a1248c4bd4740bfe730cf778bd1c0 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Fri, 27 Mar 2026 17:52:08 +0100 Subject: [PATCH] Fix 5 TestFlight crash types from builds 250-254 - Fix BGTaskScheduler assertion crash on Mac Catalyst by guarding all iOS background task APIs with isMacCatalystApp check - Fix iPad popover crash in UIPopoverPresentationController by adding .presentationCompactAdaptation(.sheet) to all 27 confirmationDialogs - Fix SwiftData assertion crash when accessing deleted Bookmark model properties during SwiftUI hit testing in BookmarkRowView - Fix UICollectionView invalid item count crash on queue swipe-to-delete by using ID-based removal with withAnimation instead of stale index - Fix Range crash in storyboard download when storyboardCount is zero --- .../BackgroundRefreshManager.swift | 4 ++++ .../Downloads/DownloadManager+Assets.swift | 2 +- Yattee/Services/Player/PlayerState.swift | 5 +++++ Yattee/Services/Player/QueueManager.swift | 5 +++++ Yattee/Views/Channel/ChannelView.swift | 2 ++ Yattee/Views/Components/BookmarkRowView.swift | 15 ++++++++++++++- Yattee/Views/Downloads/DownloadsStorageView.swift | 2 ++ Yattee/Views/Home/HistoryListView.swift | 1 + Yattee/Views/MediaBrowser/MediaSourcesView.swift | 1 + Yattee/Views/Player/QueueManagementSheet.swift | 4 +++- .../Playlist/UnifiedPlaylistDetailView.swift | 1 + Yattee/Views/Search/SearchView.swift | 1 + .../Settings/AddSource/AddRemoteServerView.swift | 2 ++ Yattee/Views/Settings/AdvancedSettingsView.swift | 2 ++ Yattee/Views/Settings/DeveloperSettingsView.swift | 2 ++ Yattee/Views/Settings/EditSourceView.swift | 3 +++ Yattee/Views/Settings/ImportPlaylistsView.swift | 2 ++ .../Views/Settings/ImportSubscriptionsView.swift | 1 + .../Views/Settings/MPVOptionsSettingsView.swift | 1 + Yattee/Views/Settings/SourcesListView.swift | 1 + .../Settings/SubscriptionsSettingsView.swift | 1 + Yattee/Views/Settings/iCloudSettingsView.swift | 4 ++++ 22 files changed, 59 insertions(+), 3 deletions(-) diff --git a/Yattee/Services/BackgroundRefresh/BackgroundRefreshManager.swift b/Yattee/Services/BackgroundRefresh/BackgroundRefreshManager.swift index d455fac4..c071df40 100644 --- a/Yattee/Services/BackgroundRefresh/BackgroundRefreshManager.swift +++ b/Yattee/Services/BackgroundRefresh/BackgroundRefreshManager.swift @@ -43,6 +43,7 @@ final class BackgroundRefreshManager { func registerBackgroundTasks() { #if os(iOS) + guard !ProcessInfo.processInfo.isMacCatalystApp else { return } registerIOSBackgroundTask() #elseif os(macOS) registerMacOSBackgroundActivity() @@ -64,6 +65,7 @@ final class BackgroundRefreshManager { } func scheduleIOSBackgroundRefresh() { + guard !ProcessInfo.processInfo.isMacCatalystApp else { return } let request = BGAppRefreshTaskRequest(identifier: Self.backgroundTaskIdentifier) // Request to run in ~15 minutes (system decides actual timing) request.earliestBeginDate = Date(timeIntervalSinceNow: 15 * 60) @@ -77,6 +79,7 @@ final class BackgroundRefreshManager { } func cancelIOSBackgroundRefresh() { + guard !ProcessInfo.processInfo.isMacCatalystApp else { return } BGTaskScheduler.shared.cancel(taskRequestWithIdentifier: Self.backgroundTaskIdentifier) LoggingService.shared.debug("Cancelled iOS background refresh", category: .notifications) } @@ -156,6 +159,7 @@ final class BackgroundRefreshManager { func handleNotificationsEnabledChanged(_ enabled: Bool) { #if os(iOS) + guard !ProcessInfo.processInfo.isMacCatalystApp else { return } if enabled { scheduleIOSBackgroundRefresh() } else { diff --git a/Yattee/Services/Downloads/DownloadManager+Assets.swift b/Yattee/Services/Downloads/DownloadManager+Assets.swift index 767b4ed1..445695dc 100644 --- a/Yattee/Services/Downloads/DownloadManager+Assets.swift +++ b/Yattee/Services/Downloads/DownloadManager+Assets.swift @@ -74,7 +74,7 @@ extension DownloadManager { } // If VTT parsing failed, fall back to direct URLs (may not work if blocked) - if imageURLs.isEmpty { + if imageURLs.isEmpty, storyboard.storyboardCount > 0 { for sheetIndex in 0..