diff --git a/DynamicIsland/Localizable.xcstrings b/DynamicIsland/Localizable.xcstrings index e8c68cb..19e32d8 100644 --- a/DynamicIsland/Localizable.xcstrings +++ b/DynamicIsland/Localizable.xcstrings @@ -3283,6 +3283,9 @@ } } } + }, + "Applies the notch-style parallax effect to the lock screen media widget album art." : { + }, "Are you sure you want to delete \"%@\"?" : { "comment" : "A confirmation prompt asking the user to confirm the deletion of a custom idle animation. The placeholder text inside the quotation marks should be replaced with the name of the animation.", @@ -10999,6 +11002,9 @@ "Lock Screen Liquid Glass" : { "comment" : "The title of the music panel on the lock screen.", "isCommentAutoGenerated" : true + }, + "Lock Screen Media" : { + }, "Lock screen panel preview" : { "comment" : "A description of the content displayed in the lock screen panel.", diff --git a/DynamicIsland/components/LockScreen/LockScreenMusicPanel.swift b/DynamicIsland/components/LockScreen/LockScreenMusicPanel.swift index f14e692..a45f30e 100644 --- a/DynamicIsland/components/LockScreen/LockScreenMusicPanel.swift +++ b/DynamicIsland/components/LockScreen/LockScreenMusicPanel.swift @@ -38,6 +38,7 @@ struct LockScreenMusicPanel: View { @Default(.musicControlSlots) private var slotConfig @Default(.musicSkipBehavior) private var musicSkipBehavior @Default(.enableLyrics) private var enableLyrics + @Default(.lockScreenMusicAlbumParallaxEnabled) private var lockScreenParallaxEnabled init(animator: LockScreenPanelAnimator) { _animator = ObservedObject(wrappedValue: animator) @@ -238,6 +239,7 @@ struct LockScreenMusicPanel: View { } } .albumArtFlip(angle: musicManager.flipAngle) + .modifier(ParallaxMotionModifier(magnitude: 12, enableOverride: lockScreenParallaxEnabled)) .frame(width: size, height: size) .background(albumArtBackground(cornerRadius: cornerRadius)) } diff --git a/DynamicIsland/components/Settings/SettingsView.swift b/DynamicIsland/components/Settings/SettingsView.swift index 5079938..fd56c1d 100644 --- a/DynamicIsland/components/Settings/SettingsView.swift +++ b/DynamicIsland/components/Settings/SettingsView.swift @@ -1849,6 +1849,7 @@ struct Media: View { @Default(.enableLockScreenMediaWidget) private var enableLockScreenMediaWidget @Default(.showSneakPeekOnTrackChange) private var showSneakPeekOnTrackChange @Default(.lockScreenGlassStyle) private var lockScreenGlassStyle + @Default(.lockScreenMusicAlbumParallaxEnabled) private var lockScreenMusicAlbumParallaxEnabled private func highlightID(_ title: String) -> String { SettingsTab.media.highlightID(for: title) @@ -1905,6 +1906,14 @@ struct Media: View { } header: { Text("Media controls") } + + Section(header: Text("Lock Screen Media")) { + Defaults.Toggle("Enable album art parallax", key: .lockScreenMusicAlbumParallaxEnabled) + .settingsHighlight(id: highlightID("Enable album art parallax")) + Text("Applies the notch-style parallax effect to the lock screen media widget album art.") + .font(.caption) + .foregroundStyle(.secondary) + } if musicControlWindowEnabled { Section { Picker("Skip buttons", selection: $musicSkipBehavior) { diff --git a/DynamicIsland/extensions/View+Parallax3D.swift b/DynamicIsland/extensions/View+Parallax3D.swift index efc1782..3afb3ba 100644 --- a/DynamicIsland/extensions/View+Parallax3D.swift +++ b/DynamicIsland/extensions/View+Parallax3D.swift @@ -11,13 +11,14 @@ import Defaults struct ParallaxMotionModifier: ViewModifier { var magnitude: Double + var enableOverride: Bool? @Default(.enableParallaxEffect) var enableParallaxEffect @State private var offset: CGSize = .zero @State private var isHovering = false func body(content: Content) -> some View { - if !enableParallaxEffect { + if !(enableOverride ?? enableParallaxEffect) { content } else { content @@ -65,6 +66,6 @@ struct ParallaxMotionModifier: ViewModifier { extension View { func parallax3D(magnitude: Double = 10) -> some View { - modifier(ParallaxMotionModifier(magnitude: magnitude)) + modifier(ParallaxMotionModifier(magnitude: magnitude, enableOverride: nil)) } } diff --git a/DynamicIsland/models/Constants.swift b/DynamicIsland/models/Constants.swift index 56db6a9..b5e74ee 100644 --- a/DynamicIsland/models/Constants.swift +++ b/DynamicIsland/models/Constants.swift @@ -474,6 +474,7 @@ extension Defaults.Keys { static let lockScreenWeatherProviderSource = Key("lockScreenWeatherProviderSource", default: .openMeteo) static let lockScreenWeatherVerticalOffset = Key("lockScreenWeatherVerticalOffset", default: 0) static let lockScreenMusicVerticalOffset = Key("lockScreenMusicVerticalOffset", default: 0) + static let lockScreenMusicAlbumParallaxEnabled = Key("lockScreenMusicAlbumParallaxEnabled", default: true) static let lockScreenTimerVerticalOffset = Key("lockScreenTimerVerticalOffset", default: 0) static let lockScreenGlassStyle = Key("lockScreenGlassStyle", default: .liquid) static let lockScreenShowAppIcon = Key("lockScreenShowAppIcon", default: false)