1.0.4: fix chip row height, widget buttons via system media commands

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-10-27 22:22:17 -05:00
commit 15c65a6073
5 changed files with 30 additions and 8 deletions

View file

@ -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)

View file

@ -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 }

View file

@ -1 +1 @@
1.0.3
1.0.4

View file

@ -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)
}
}
}

5
docs/releases/1.0.4.md Normal file
View file

@ -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.