diff --git a/App/UI/LibraryView.swift b/App/UI/LibraryView.swift index 46ca1e3..57b3e26 100644 --- a/App/UI/LibraryView.swift +++ b/App/UI/LibraryView.swift @@ -29,6 +29,7 @@ struct LibraryView: View { .padding(.horizontal, 16) .padding(.vertical, 10) } + .fixedSize(horizontal: false, vertical: true) // a horizontal ScrollView otherwise grabs spare height content } .surface(p) diff --git a/Shared/WidgetShared.swift b/Shared/WidgetShared.swift index d34019d..7fc63fa 100644 --- a/Shared/WidgetShared.swift +++ b/Shared/WidgetShared.swift @@ -1,4 +1,5 @@ import Foundation +import Darwin import AppIntents /// What the widget shows; written by the app into the shared app-group container. @@ -79,8 +80,27 @@ enum IntentRouter { h(c) return true } - // Running inside the widget extension: tell the app (alive for background audio) via a Darwin notification. - if !handled { post(c) } + // Running inside the widget extension: send the system media command (what the Lock Screen controls do), + // and also tell the app directly via a Darwin notification. + if !handled { + mediaRemote(c) + post(c) + } + } + + /// MRMediaRemoteSendCommand from the private MediaRemote framework, looked up at runtime. + static func mediaRemote(_ c: MulberryCommand) { + let cmd: UInt32 + switch c { + case .toggle: cmd = 2 // kMRTogglePlayPause + case .next: cmd = 4 // kMRNextTrack + case .previous: cmd = 5 // kMRPreviousTrack + default: return + } + guard let h = dlopen("/System/Library/PrivateFrameworks/MediaRemote.framework/MediaRemote", RTLD_LAZY), + let f = dlsym(h, "MRMediaRemoteSendCommand") else { return } + typealias Send = @convention(c) (UInt32, CFDictionary?) -> Bool + _ = unsafeBitCast(f, to: Send.self)(cmd, nil) } static func name(_ c: MulberryCommand) -> String { "com.mulberry.player.cmd." + c.rawValue } diff --git a/VERSION b/VERSION index 21e8796..ee90284 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.3 +1.0.4 diff --git a/Widget/MulberryWidgets.swift b/Widget/MulberryWidgets.swift index a4d89da..cd15dc1 100644 --- a/Widget/MulberryWidgets.swift +++ b/Widget/MulberryWidgets.swift @@ -119,14 +119,10 @@ struct Controls: View { let col: WColors var size: CGFloat = 34 var body: some View { - HStack(spacing: 8) { - CtlButton(intent: ShuffleIntent(), icon: "shuffle", size: size, fg: s.shuffle ? col.onPrimaryC : col.onSurfaceVar, - bg: s.shuffle ? col.primaryC : col.surfaceHigh) + HStack(spacing: 10) { CtlButton(intent: PreviousTrackIntent(), icon: "backward.end.fill", size: size, fg: col.onSecondaryC, bg: col.secondaryC) CtlButton(intent: PlayPauseIntent(), icon: s.playing ? "pause.fill" : "play.fill", size: size, fg: col.onPrimary, bg: col.primary, wide: true) CtlButton(intent: NextTrackIntent(), icon: "forward.end.fill", size: size, fg: col.onSecondaryC, bg: col.secondaryC) - CtlButton(intent: RepeatIntent(), icon: s.repeatMode == 2 ? "repeat.1" : "repeat", size: size, - fg: s.repeatMode > 0 ? col.onPrimaryC : col.onSurfaceVar, bg: s.repeatMode > 0 ? col.primaryC : col.surfaceHigh) } } } diff --git a/docs/releases/1.0.4.md b/docs/releases/1.0.4.md new file mode 100644 index 0000000..3656110 --- /dev/null +++ b/docs/releases/1.0.4.md @@ -0,0 +1,5 @@ +# Mulberry for iOS 1.0.4 + +## Fixes +- Library: the Songs/Albums/Artists chip row no longer grows into a big blank area. +- Widget: Previous / Play-Pause / Next use the system media commands (like the Lock Screen controls); shuffle and repeat buttons removed.