mirror of
https://github.com/yattee/yattee.git
synced 2026-10-25 06:02:57 +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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user