From c2c2c4b4108f2e7478312790673f0fa8c7cf2308 Mon Sep 17 00:00:00 2001 From: astar76 Date: Tue, 27 Oct 2026 22:09:59 -0500 Subject: [PATCH] 1.0.3: widget buttons reach the app, native song list Co-Authored-By: Claude Opus 5.5 --- App/MulberryApp.swift | 1 + App/UI/LibraryView.swift | 19 +++++++++++-------- Shared/WidgetShared.swift | 27 ++++++++++++++++++++++++++- VERSION | 2 +- docs/releases/1.0.3.md | 5 +++++ tools/sdk-extra-symbols.txt | 1 + 6 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 docs/releases/1.0.3.md diff --git a/App/MulberryApp.swift b/App/MulberryApp.swift index afe01f9..25d4a64 100644 --- a/App/MulberryApp.swift +++ b/App/MulberryApp.swift @@ -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))") diff --git a/App/UI/LibraryView.swift b/App/UI/LibraryView.swift index e55717f..46ca1e3 100644 --- a/App/UI/LibraryView.swift +++ b/App/UI/LibraryView.swift @@ -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) } diff --git a/Shared/WidgetShared.swift b/Shared/WidgetShared.swift index 9067dc6..d34019d 100644 --- a/Shared/WidgetShared.swift +++ b/Shared/WidgetShared.swift @@ -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) + } } } diff --git a/VERSION b/VERSION index 6d7de6e..21e8796 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.2 +1.0.3 diff --git a/docs/releases/1.0.3.md b/docs/releases/1.0.3.md new file mode 100644 index 0000000..5a6ef5c --- /dev/null +++ b/docs/releases/1.0.3.md @@ -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. diff --git a/tools/sdk-extra-symbols.txt b/tools/sdk-extra-symbols.txt index f340457..a5214f6 100644 --- a/tools/sdk-extra-symbols.txt +++ b/tools/sdk-extra-symbols.txt @@ -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