1.0.3: widget buttons reach the app, native song list

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-10-27 22:09:59 -05:00
commit c2c2c4b410
6 changed files with 45 additions and 10 deletions

View file

@ -21,6 +21,7 @@ struct MulberryApp: App {
case .favourite: if let s = p.current { PlayStats.shared.setFav(s, !PlayStats.shared.fav(s)) }
}
}
IntentRouter.listen()
Theme.shared.update()
Player.shared.publishWidget()
Log.i("app: version \(AppVersion.version) (\(AppVersion.build))")

View file

@ -116,17 +116,20 @@ struct LibraryView: View {
}
}
/// A native List (not a lazy stack in a ScrollView), which doesn't leave blank gaps after navigating.
private func songList(_ songs: [Song]) -> some View {
ScrollView {
LazyVStack(spacing: 0) {
ForEach(Array(songs.enumerated()), id: \.element.id) { i, s in
SongRow(song: s, current: player.current?.id == s.id) { ui.songMenu(s, in: songs) }
.onTapGesture { player.playList(songs, start: i) }
.onLongPressGesture { ui.songMenu(s, in: songs) }
}
List {
ForEach(Array(songs.enumerated()), id: \.element.id) { i, s in
SongRow(song: s, current: player.current?.id == s.id) { ui.songMenu(s, in: songs) }
.listRowInsets(EdgeInsets())
.listRowBackground(Color.clear)
.listRowSeparator(.hidden)
.onTapGesture { player.playList(songs, start: i) }
.onLongPressGesture { ui.songMenu(s, in: songs) }
}
.padding(.bottom, 8)
}
.listStyle(.plain)
.scrollContentBackground(.hidden)
.scrollDismissesKeyboard(.immediately)
}

View file

@ -74,7 +74,32 @@ enum IntentRouter {
@MainActor static var handler: ((MulberryCommand) -> Void)?
static func run(_ c: MulberryCommand) async {
await MainActor.run { IntentRouter.handler?(c) }
let handled = await MainActor.run { () -> Bool in
guard let h = IntentRouter.handler else { return false }
h(c)
return true
}
// Running inside the widget extension: tell the app (alive for background audio) via a Darwin notification.
if !handled { post(c) }
}
static func name(_ c: MulberryCommand) -> String { "com.mulberry.player.cmd." + c.rawValue }
static func post(_ c: MulberryCommand) {
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(),
CFNotificationName(name(c) as CFString), nil, nil, true)
}
/// App side: act on commands posted by the widget extension.
@MainActor static func listen() {
let center = CFNotificationCenterGetDarwinNotifyCenter()
for c in [MulberryCommand.toggle, .next, .previous, .shuffle, .repeatMode, .favourite] {
CFNotificationCenterAddObserver(center, nil, { _, _, name, _, _ in
guard let raw = name?.rawValue as String?,
let cmd = MulberryCommand(rawValue: String(raw.dropFirst("com.mulberry.player.cmd.".count))) else { return }
DispatchQueue.main.async { IntentRouter.handler?(cmd) }
}, name(c) as CFString, nil, .deliverImmediately)
}
}
}

View file

@ -1 +1 @@
1.0.2
1.0.3

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

@ -0,0 +1,5 @@
# Mulberry for iOS 1.0.3
## Fixes
- Widget buttons: presses now reach the player (the action was running inside the widget process).
- Library song list: no blank gap after switching screens.

View file

@ -24,6 +24,7 @@
/System/Library/Frameworks/AppIntents.framework/AppIntents _$s10AppIntents0A6IntentPAA24PersistentlyIdentifiableTb
/System/Library/Frameworks/AppIntents.framework/AppIntents _$s10AppIntents0A6IntentPAAE04openA7WhenRunSbvgZ
/System/Library/Frameworks/AppIntents.framework/AppIntents _$s10AppIntents0A6IntentPAAE11descriptionAA0C11DescriptionVSgvgZ
/System/Library/Frameworks/AppIntents.framework/AppIntents _$s10AppIntents0A6IntentPAAE14isDiscoverableSbvgZ
/System/Library/Frameworks/AppIntents.framework/AppIntents _$s10AppIntents0A6IntentPAAE16parameterSummaryQrvgZ
/System/Library/Frameworks/AppIntents.framework/AppIntents _$s10AppIntents0A6IntentPAAE16parameterSummaryQrvpZQOMQ
/System/Library/Frameworks/AppIntents.framework/AppIntents _$s10AppIntents0A6IntentPAAE20authenticationPolicyAA0c14AuthenticationE0OvgZ