mirror of
https://github.com/yattee/yattee.git
synced 2026-10-28 23:47:17 +00:00
Remove dead code found by Periphery on all platforms
Delete declarations that Periphery reports unused on every platform that compiles them (iOS, macOS, tvOS), including nine views used only by their own previews. Platform-gated code still used on another platform, device- only MPV render paths, migration models, CloudKit record names, App Intents metadata and unused parameters are kept.
This commit is contained in:
@@ -8,25 +8,7 @@
|
||||
import Foundation
|
||||
|
||||
/// Protocol defining the common content fetching interface.
|
||||
protocol ContentServiceProtocol: Sendable {
|
||||
func trending(for instance: Instance) async throws -> [Video]
|
||||
func popular(for instance: Instance) async throws -> [Video]
|
||||
func feed(for instance: Instance, credential: String) async throws -> [Video]
|
||||
func subscriptions(for instance: Instance, credential: String) async throws -> [Channel]
|
||||
func search(query: String, instance: Instance, page: Int, filters: SearchFilters) async throws -> SearchResult
|
||||
func searchSuggestions(query: String, instance: Instance) async throws -> [String]
|
||||
func video(id: String, instance: Instance) async throws -> Video
|
||||
func channel(id: String, instance: Instance) async throws -> Channel
|
||||
func channelVideos(id: String, instance: Instance, continuation: String?) async throws -> ChannelVideosPage
|
||||
func channelPlaylists(id: String, instance: Instance, continuation: String?) async throws -> ChannelPlaylistsPage
|
||||
func channelShorts(id: String, instance: Instance, continuation: String?) async throws -> ChannelVideosPage
|
||||
func channelStreams(id: String, instance: Instance, continuation: String?) async throws -> ChannelVideosPage
|
||||
func playlist(id: String, instance: Instance) async throws -> Playlist
|
||||
func comments(videoID: String, instance: Instance, continuation: String?) async throws -> CommentsPage
|
||||
func streams(videoID: String, instance: Instance) async throws -> [Stream]
|
||||
func captions(videoID: String, instance: Instance) async throws -> [Caption]
|
||||
func channelSearch(id: String, query: String, instance: Instance, page: Int) async throws -> ChannelSearchPage
|
||||
}
|
||||
protocol ContentServiceProtocol: Sendable {}
|
||||
|
||||
/// Unified content service that routes requests to the appropriate API based on instance type.
|
||||
actor ContentService: ContentServiceProtocol {
|
||||
@@ -55,17 +37,6 @@ actor ContentService: ContentServiceProtocol {
|
||||
self.basicAuthCredentialsManager = basicAuthCredentialsManager
|
||||
}
|
||||
|
||||
init(httpClientFactory: HTTPClientFactory, basicAuthCredentialsManager: BasicAuthCredentialsManager? = nil) {
|
||||
self.httpClientFactory = httpClientFactory
|
||||
// Create default client for instances that don't need insecure SSL
|
||||
self.defaultHTTPClient = httpClientFactory.createClient(allowInvalidCertificates: false)
|
||||
self.defaultInvidiousAPI = InvidiousAPI(httpClient: defaultHTTPClient)
|
||||
self.defaultPipedAPI = PipedAPI(httpClient: defaultHTTPClient)
|
||||
self.defaultPeerTubeAPI = PeerTubeAPI(httpClient: defaultHTTPClient)
|
||||
self.defaultYatteeServerAPI = YatteeServerAPI(httpClient: defaultHTTPClient)
|
||||
self.basicAuthCredentialsManager = basicAuthCredentialsManager
|
||||
}
|
||||
|
||||
// MARK: - Routing
|
||||
|
||||
/// Builds a per-instance HTTPClient with the basic-auth `Authorization` header baked in,
|
||||
@@ -256,10 +227,6 @@ actor ContentService: ContentServiceProtocol {
|
||||
try await api(for: instance).comments(videoID: videoID, instance: instance, continuation: continuation)
|
||||
}
|
||||
|
||||
func streams(videoID: String, instance: Instance) async throws -> [Stream] {
|
||||
try await api(for: instance).streams(videoID: videoID, instance: instance)
|
||||
}
|
||||
|
||||
func captions(videoID: String, instance: Instance) async throws -> [Caption] {
|
||||
try await api(for: instance).captions(videoID: videoID, instance: instance)
|
||||
}
|
||||
@@ -590,17 +557,6 @@ actor ContentService: ContentServiceProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
/// Fetches streams with proxy URLs for downloads (Yattee Server: hits /proxy/fast/
|
||||
/// so the server caches the file on disk; other backends apply Invidious URL rewriting).
|
||||
func proxyStreams(videoID: String, instance: Instance) async throws -> [Stream] {
|
||||
if instance.type == .yatteeServer {
|
||||
return try await yatteeServerAPI(for: instance)
|
||||
.proxyStreams(videoID: videoID, instance: instance, mode: .download)
|
||||
}
|
||||
let fetchedStreams = try await streams(videoID: videoID, instance: instance)
|
||||
return await InvidiousAPI.proxyStreamsIfNeeded(fetchedStreams, instance: instance)
|
||||
}
|
||||
|
||||
/// Fetches video details + streams for downloads. For Yattee Server this routes
|
||||
/// through `/proxy/fast/`, which caches the file on disk on the server.
|
||||
func videoWithProxyStreamsAndCaptionsAndStoryboards(id: String, instance: Instance) async throws -> (video: Video, streams: [Stream], captions: [Caption], storyboards: [Storyboard]) {
|
||||
|
||||
Reference in New Issue
Block a user