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:
Arkadiusz Fal
2026-10-08 23:57:56 +02:00
parent 45e19e6536
commit 4770bbe3b9
141 changed files with 14 additions and 4191 deletions

View File

@@ -47,14 +47,6 @@ enum LocalFolderURLResolver {
lock.lock(); defer { lock.unlock() }
return cache[sourceID]
}
static func clear(_ sourceID: UUID) {
lock.lock(); defer { lock.unlock() }
cache.removeValue(forKey: sourceID)
if let previous = persistentAccess.removeValue(forKey: sourceID) {
previous.stopAccessingSecurityScopedResource()
}
}
}
/// Actor-based client for local file system operations.
@@ -279,15 +271,6 @@ actor LocalFileClient {
return url
}
/// Resolves bookmark and starts accessing the security-scoped resource.
/// - Parameter bookmarkData: The stored bookmark data.
/// - Returns: Tuple of (URL, didStartAccessing) - caller must call stopAccessingSecurityScopedResource when done.
func resolveAndAccessBookmark(_ bookmarkData: Data) throws -> (URL, Bool) {
let url = try resolveBookmark(bookmarkData)
let didStart = url.startAccessingSecurityScopedResource()
return (url, didStart)
}
// MARK: - Private Methods
private func createMediaFile(

View File

@@ -22,14 +22,6 @@ struct DiscoveredShare: Identifiable, Hashable, Sendable {
case webdavs // _webdavs._tcp (HTTPS)
case smb // _smb._tcp
var displayName: String {
switch self {
case .webdav: String(localized: "discovery.shareType.webdav")
case .webdavs: String(localized: "discovery.shareType.webdavs")
case .smb: String(localized: "discovery.shareType.smb")
}
}
var systemImage: String {
switch self {
case .webdav: "globe"

View File

@@ -39,24 +39,6 @@ enum SMBBridgeError: Error, LocalizedError, Sendable {
return "Invalid parameters provided"
}
}
/// User-friendly error messages based on common SMB errors
var userFriendlyMessage: String {
switch self {
case .connectionFailed(let msg) where msg.contains("errno: 13"):
return "Permission denied. Check username and password."
case .connectionFailed(let msg) where msg.contains("errno: 2"):
return "Share or path not found."
case .connectionFailed(let msg) where msg.contains("errno: 110"):
return "Connection timed out. Check server address and network."
case .connectionFailed(let msg) where msg.contains("errno: 111"):
return "Cannot reach server. Check server address."
case .listingFailed(let msg) where msg.contains("errno: 13"):
return "Access denied to this folder."
default:
return errorDescription ?? "Unknown error"
}
}
}
/// SMB protocol version for connection preferences (Swift wrapper).

View File

@@ -343,29 +343,12 @@ actor SMBClient {
// MARK: - Helper Methods
/// Validates SMB URL format.
private func validateSMBURL(_ url: URL) throws {
guard url.scheme?.lowercased() == "smb" else {
throw MediaSourceError.unknown("URL must use smb:// scheme")
}
guard url.host != nil else {
throw MediaSourceError.unknown("SMB URL missing host")
}
}
/// Clears cached SMB context for a specific source.
/// Call this when source credentials change or connection fails.
func clearCache(for source: MediaSource) {
contextCache.removeValue(forKey: source.id)
LoggingService.shared.logMediaSourcesDebug("Cleared SMB context cache for source: \(source.id)")
}
/// Clears all cached SMB contexts.
func clearAllCaches() {
contextCache.removeAll()
LoggingService.shared.logMediaSourcesDebug("Cleared all SMB context caches")
}
}
// MARK: - File Download

View File

@@ -167,7 +167,6 @@ private final class WebDAVResponseParser: NSObject, XMLParserDelegate {
private var files: [MediaFile] = []
private var currentResponse: ResponseData?
private var currentElement: String = ""
private var currentText: String = ""
// Temporary storage for current response properties
@@ -209,7 +208,6 @@ private final class WebDAVResponseParser: NSObject, XMLParserDelegate {
qualifiedName: String?,
attributes: [String: String]
) {
currentElement = elementName
currentText = ""
if elementName == "response" {

View File

@@ -22,12 +22,4 @@ final class WebDAVClientFactory: Sendable {
let session = sessionFactory.session(allowInvalidCertificates: source.allowInvalidCertificates)
return WebDAVClient(session: session)
}
/// Creates a WebDAVClient with explicit SSL settings.
/// - Parameter allowInvalidCertificates: Whether to bypass SSL certificate validation.
/// - Returns: A WebDAVClient with the specified SSL settings.
func createClient(allowInvalidCertificates: Bool) -> WebDAVClient {
let session = sessionFactory.session(allowInvalidCertificates: allowInvalidCertificates)
return WebDAVClient(session: session)
}
}