Enhance download notifications and settings; add support for live activities

- Updated notification body to use proper German quotation marks for download failure alerts.
- Refactored audio interruption handling in PlayerEngine to utilize MainActor.assumeIsolated for better performance.
- Introduced nonisolated properties for support and downloads directories in ProgressSyncManager.
- Improved FullHistoryView and MainView with additional toolbar items and alerts for download failures.
- Added new toggles in SettingsView for parallel downloads and mobile data usage.
- Created new color assets for the DownloadWidgetExtension and updated widget appearance.
- Implemented Info.plist for DownloadWidgetExtension to support widget functionality.
- Enabled live activities support in iOS Info.plist.
This commit is contained in:
Scarriffle
2026-06-08 19:32:54 +02:00
parent f053f1d320
commit 134482bb4a
23 changed files with 1104 additions and 224 deletions

View File

@@ -1,11 +1,19 @@
import SwiftUI
#if os(iOS)
import AVFAudio
import UIKit
#endif
@main
struct Audiobookshelf_swiftApp: App {
@State private var appState = AppState()
#if os(iOS)
/// Bridges the UIKit-only `handleEventsForBackgroundURLSession` callback
/// (used by iOS to wake the app when a background download completes)
/// into the SwiftUI lifecycle. Without this, in-flight downloads can't
/// notify the app of completion after a swipe-away.
@UIApplicationDelegateAdaptor(BackgroundDownloadAppDelegate.self) private var appDelegate
#endif
init() {
configureImageCache()
@@ -54,3 +62,20 @@ struct Audiobookshelf_swiftApp: App {
}
#endif
}
#if os(iOS)
/// Receives the system's background URLSession completion callback and routes
/// the handler to whichever `DownloadManager` is currently active. We can't
/// reach the SwiftUI-owned `AppState` from here directly, so the handler is
/// stashed on `DownloadManager.pendingBackgroundCompletion` and consumed when
/// `urlSessionDidFinishEvents(forBackgroundURLSession:)` fires.
final class BackgroundDownloadAppDelegate: NSObject, UIApplicationDelegate {
func application(
_ application: UIApplication,
handleEventsForBackgroundURLSession identifier: String,
completionHandler: @escaping () -> Void
) {
DownloadManager.pendingBackgroundCompletion = completionHandler
}
}
#endif