mirror of
https://github.com/yattee/yattee.git
synced 2026-10-29 07:57: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:
@@ -94,6 +94,4 @@ struct CommentsPage: Sendable {
|
||||
/// Continuation token for loading more comments. Nil if no more pages.
|
||||
let continuation: String?
|
||||
|
||||
/// Whether there are more comments to load.
|
||||
var hasMore: Bool { continuation != nil }
|
||||
}
|
||||
|
||||
@@ -36,9 +36,6 @@ struct MediaFile: Identifiable, Hashable, Sendable {
|
||||
/// Creation date.
|
||||
let createdDate: Date?
|
||||
|
||||
/// MIME type if known.
|
||||
let mimeType: String?
|
||||
|
||||
// MARK: - Initialization
|
||||
|
||||
init(
|
||||
@@ -60,7 +57,6 @@ struct MediaFile: Identifiable, Hashable, Sendable {
|
||||
self.size = size
|
||||
self.modifiedDate = modifiedDate
|
||||
self.createdDate = createdDate
|
||||
self.mimeType = mimeType
|
||||
}
|
||||
|
||||
// MARK: - Computed Properties
|
||||
|
||||
@@ -215,22 +215,6 @@ enum SidebarItem: Hashable, Identifiable {
|
||||
|
||||
// MARK: - Item Categories
|
||||
|
||||
/// Whether this is a fixed navigation item (always visible).
|
||||
var isFixedNavigation: Bool {
|
||||
switch self {
|
||||
case .home, .search, .sources, .settings, .nowPlaying, .openURL, .remoteControl:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether this is a dynamic channel item.
|
||||
var isChannel: Bool {
|
||||
if case .channel = self { return true }
|
||||
return false
|
||||
}
|
||||
|
||||
/// Whether this is a dynamic playlist item.
|
||||
var isPlaylist: Bool {
|
||||
switch self {
|
||||
|
||||
@@ -57,12 +57,6 @@ struct VideoQueueContext {
|
||||
videoList != nil && videoIndex != nil
|
||||
}
|
||||
|
||||
/// Number of videos that will be queued after the current one
|
||||
var remainingVideosCount: Int {
|
||||
guard let list = videoList, let index = videoIndex else { return 0 }
|
||||
return max(0, list.count - index - 1)
|
||||
}
|
||||
|
||||
/// Whether more videos can be loaded via continuation
|
||||
var canLoadMore: Bool {
|
||||
let hasCallback = loadMoreVideos != nil
|
||||
|
||||
@@ -59,16 +59,6 @@ struct ControlButtonConfiguration: Identifiable, Codable, Hashable, Sendable {
|
||||
)
|
||||
}
|
||||
|
||||
/// Creates a configuration for a fixed-width spacer.
|
||||
/// - Parameter width: The fixed width in points.
|
||||
/// - Returns: A spacer configuration with fixed width.
|
||||
static func fixedSpacer(width: Int) -> ControlButtonConfiguration {
|
||||
ControlButtonConfiguration(
|
||||
buttonType: .spacer,
|
||||
settings: .spacer(SpacerSettings(isFlexible: false, fixedWidth: width))
|
||||
)
|
||||
}
|
||||
|
||||
// MARK: - Convenience Accessors
|
||||
|
||||
/// Returns the spacer settings if this is a spacer button.
|
||||
|
||||
@@ -294,11 +294,6 @@ enum ControlButtonType: String, Codable, Hashable, Sendable, CaseIterable {
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Button types for center section (play/pause, seek).
|
||||
static var availableForCenterSection: [ControlButtonType] {
|
||||
[.playPause, .seekBackward, .seekForward]
|
||||
}
|
||||
|
||||
/// Button types available for the player pill (curated subset).
|
||||
static var availableForPill: [ControlButtonType] {
|
||||
[
|
||||
|
||||
@@ -294,18 +294,6 @@ extension SponsorBlockSegmentSettings {
|
||||
func settings(for category: SponsorBlockCategory) -> SponsorBlockCategorySettings {
|
||||
settings(forKey: category.rawValue)
|
||||
}
|
||||
|
||||
/// Returns a copy with updated settings for a specific category.
|
||||
/// - Parameters:
|
||||
/// - category: The category to update.
|
||||
/// - settings: The new settings.
|
||||
/// - Returns: Updated SponsorBlockSegmentSettings.
|
||||
func withUpdatedSettings(
|
||||
for category: SponsorBlockCategory,
|
||||
_ settings: SponsorBlockCategorySettings
|
||||
) -> SponsorBlockSegmentSettings {
|
||||
withUpdatedSettings(forKey: category.rawValue, settings)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Font Style
|
||||
|
||||
@@ -34,37 +34,12 @@ struct LayoutSection: Codable, Hashable, Sendable {
|
||||
buttons.append(button)
|
||||
}
|
||||
|
||||
/// Adds a button with the given type to the end of the section.
|
||||
/// - Parameter type: The button type to add with default configuration.
|
||||
mutating func add(buttonType type: ControlButtonType) {
|
||||
buttons.append(.defaultConfiguration(for: type))
|
||||
}
|
||||
|
||||
/// Removes a button at the specified index.
|
||||
/// - Parameter index: The index of the button to remove.
|
||||
mutating func remove(at index: Int) {
|
||||
guard buttons.indices.contains(index) else { return }
|
||||
buttons.remove(at: index)
|
||||
}
|
||||
|
||||
/// Removes a button with the specified ID.
|
||||
/// - Parameter id: The ID of the button to remove.
|
||||
mutating func remove(id: UUID) {
|
||||
buttons.removeAll { $0.id == id }
|
||||
}
|
||||
|
||||
/// Moves a button from one position to another.
|
||||
/// - Parameters:
|
||||
/// - source: The current index of the button.
|
||||
/// - destination: The target index for the button.
|
||||
mutating func move(from source: Int, to destination: Int) {
|
||||
guard buttons.indices.contains(source) else { return }
|
||||
let button = buttons.remove(at: source)
|
||||
let targetIndex = destination > source ? destination - 1 : destination
|
||||
let clampedIndex = max(0, min(buttons.count, targetIndex))
|
||||
buttons.insert(button, at: clampedIndex)
|
||||
}
|
||||
|
||||
/// Moves buttons from source indices to a destination index.
|
||||
/// Compatible with SwiftUI's `onMove` modifier.
|
||||
/// - Parameters:
|
||||
@@ -97,13 +72,6 @@ struct LayoutSection: Codable, Hashable, Sendable {
|
||||
buttons.map(\.buttonType)
|
||||
}
|
||||
|
||||
/// Checks if a button type is already in this section.
|
||||
/// - Parameter type: The button type to check.
|
||||
/// - Returns: True if the type is already present.
|
||||
func contains(buttonType type: ControlButtonType) -> Bool {
|
||||
buttons.contains { $0.buttonType == type }
|
||||
}
|
||||
|
||||
/// Returns buttons filtered by visibility for the given layout state.
|
||||
/// - Parameter isWideLayout: Whether the current layout is wide/landscape.
|
||||
/// - Returns: Buttons that should be visible.
|
||||
|
||||
@@ -170,15 +170,6 @@ extension Storyboard {
|
||||
// MARK: - Storyboard Selection
|
||||
|
||||
extension Array where Element == Storyboard {
|
||||
/// Selects the preferred storyboard based on desired width.
|
||||
/// Prefers the largest storyboard that doesn't exceed maxWidth.
|
||||
/// - Parameter maxWidth: Maximum preferred width (default 160)
|
||||
/// - Returns: Best matching storyboard, or nil if array is empty
|
||||
func preferred(maxWidth: Int = 160) -> Storyboard? {
|
||||
let suitable = filter { $0.width <= maxWidth }
|
||||
return suitable.max(by: { $0.width < $1.width }) ?? first
|
||||
}
|
||||
|
||||
/// Returns the highest quality storyboard (largest width).
|
||||
func highest() -> Storyboard? {
|
||||
self.max(by: { $0.width < $1.width })
|
||||
|
||||
@@ -113,7 +113,6 @@ func makeGridColumns(count: Int) -> [GridItem] {
|
||||
/// // Then use:
|
||||
/// // gridConfig.effectiveColumns - actual column count
|
||||
/// // gridConfig.isCompactCards - whether to use compact card styling
|
||||
/// // gridConfig.columns - GridItem array for LazyVGrid
|
||||
/// // gridConfig.maxColumns - for ViewOptionsSheet
|
||||
/// ```
|
||||
struct GridLayoutConfiguration {
|
||||
@@ -134,9 +133,4 @@ struct GridLayoutConfiguration {
|
||||
var isCompactCards: Bool {
|
||||
effectiveColumns >= GridConstants.compactThreshold
|
||||
}
|
||||
|
||||
/// GridItem array for LazyVGrid columns parameter.
|
||||
var columns: [GridItem] {
|
||||
makeGridColumns(count: effectiveColumns)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user