1.0.1: widgets enter via NSExtensionMain, measured bottom chrome, version info and update note, deploy script

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-10-27 21:45:55 -05:00
commit bc6855b46e
9 changed files with 71 additions and 9 deletions

View file

@ -23,6 +23,10 @@ struct MulberryApp: App {
}
Theme.shared.update()
Player.shared.publishWidget()
Log.i("app: version \(AppVersion.version) (\(AppVersion.build))")
if let note = AppVersion.updateNote() {
DispatchQueue.main.asyncAfter(deadline: .now() + 1.2) { UIState.shared.show(note) }
}
}
var body: some Scene {

View file

@ -0,0 +1,17 @@
import Foundation
/// Version info from Info.plist (set by build.sh from the VERSION file and the git commit count).
enum AppVersion {
static var version: String { Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "?" }
static var build: String { Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "?" }
/// "Updated to x.y.z" once after an update (nil on first install or same version).
static func updateNote() -> String? {
let key = "last_version"
let now = "\(version) (\(build))"
let last = UserDefaults.standard.string(forKey: key)
UserDefaults.standard.set(now, forKey: key)
guard let last, last != now else { return nil }
return "Updated to Mulberry \(version) (build \(build))"
}
}

View file

@ -118,7 +118,8 @@ struct RootView: View {
@EnvironmentObject var prefs: Prefs
@EnvironmentObject var scrobbler: Scrobbler
@Environment(\.colorScheme) var scheme
@State private var chrome: CGFloat = 80
/// Measured height of the mini player + nav bar (the start value is a realistic guess, not a minimum).
@State private var chrome: CGFloat = 180
var body: some View {
let p = theme.palette
@ -144,8 +145,7 @@ struct RootView: View {
}
NavBar()
}
.background(GeometryReader { g in Color.clear.preference(key: ChromeHeight.self, value: g.size.height) })
.onPreferenceChange(ChromeHeight.self) { chrome = $0 }
.onGeometryChange(for: CGFloat.self) { $0.size.height } action: { chrome = $0 }
if prefs.bassShape && !prefs.lowPower && player.current != nil && !ui.nowPlaying {
BassShapeView(playing: player.isPlaying)

View file

@ -107,8 +107,8 @@ struct SettingsView: View {
SectionLabel(text: "About")
Card {
RowLabel(icon: "info.circle", title: "Mulberry for iOS \(Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "")",
sub: "Coded by Claude (Anthropic) · MIT licence")
RowLabel(icon: "info.circle", title: "Mulberry for iOS \(AppVersion.version)",
sub: "Build \(AppVersion.build) · engine: \(Player.shared.engineName.isEmpty ? "—" : Player.shared.engineName) · Coded by Claude (Anthropic) · MIT licence")
ButtonRow(icon: "desktopcomputer", title: "Mulberry for desktop", sub: "archlinux.tail7c4f5e.ts.net/git/astar76/Mulberry") {
if let u = URL(string: "https://archlinux.tail7c4f5e.ts.net/git/astar76/Mulberry") { UIApplication.shared.open(u) }
}

View file

@ -20,6 +20,7 @@ final class CookieModel {
var target = [Float](repeating: 0, count: 48)
var coverID: ObjectIdentifier?
let clock = FrameClock()
private var lastLog = Date.distantPast
func frame(_ now: Date, playing: Bool, bars: Bool, spectrum: Spectrum?) {
let f = clock.step(now)
@ -36,6 +37,10 @@ final class CookieModel {
}
bass = b / 4
pulse += ((have ? 1.8 * max(0, bass - 0.45) : 0) - pulse) * min(1, 14 * f)
if now.timeIntervalSince(lastLog) > 2, playing {
lastLog = now
Log.i("visualizer: bars=\(bars) levels=\(have) max=\(String(format: "%.2f", lv.max() ?? 0)) bass=\(String(format: "%.2f", bass))")
}
}
var busy: Bool { spin > 0.01 || appear < 1 || pulse > 0.01 }

1
VERSION Normal file
View file

@ -0,0 +1 @@
1.0.1

View file

@ -5,8 +5,8 @@
set -euo pipefail
cd "$(dirname "$0")"
VERSION=${VERSION:-1.0.0}
BUILD=${BUILD:-$(date +%Y%m%d%H%M)}
VERSION=${VERSION:-$(cat VERSION)}
BUILD=${BUILD:-$(git rev-list --count HEAD 2>/dev/null || date +%Y%m%d%H%M)}
SWIFT=${SWIFT:-$HOME/.local/opt/swift/usr/bin}
SDK=${SDK:-$HOME/.local/opt/dl/sdk18/iPhoneOS18.6.sdk}
TARGET=arm64-apple-ios17.0
@ -60,7 +60,10 @@ $LD -dead_strip -o "$APP/Mulberry" "$OUT/obj/Mulberry.o" "$OUT/obj/compat.o" "${
echo "== widget extension"
"$SWIFT/swiftc" "${common[@]}" -module-name MulberryWidgets -application-extension -c -wmo -num-threads 0 \
$(find Widget Shared -name '*.swift' -not -path 'Widget/Test/*' | sort) -o "$OUT/obj/MulberryWidgets.o"
$LD -dead_strip -application-extension -o "$APPEX/MulberryWidgets" "$OUT/obj/MulberryWidgets.o" "$OUT/obj/compat.o"
# Extensions must enter through Foundation's NSExtensionMain (Xcode links them with -e _NSExtensionMain);
# starting in our own main skips the XPC set-up and iOS sees the extension exit immediately.
$LD -dead_strip -application-extension -Xlinker -e -Xlinker _NSExtensionMain -framework Foundation \
-o "$APPEX/MulberryWidgets" "$OUT/obj/MulberryWidgets.o" "$OUT/obj/compat.o"
if [ "${TEST_WIDGET:-0}" = 1 ]; then
echo "== test widget"
@ -68,7 +71,8 @@ if [ "${TEST_WIDGET:-0}" = 1 ]; then
mkdir -p "$TAPPEX"
"$SWIFT/swiftc" "${common[@]}" -module-name MulberryTestWidget -application-extension -parse-as-library -c -wmo -num-threads 0 \
Widget/Test/TestWidget.swift -o "$OUT/obj/MulberryTestWidget.o"
$LD -dead_strip -application-extension -o "$TAPPEX/MulberryTestWidget" "$OUT/obj/MulberryTestWidget.o" "$OUT/obj/compat.o"
$LD -dead_strip -application-extension -Xlinker -e -Xlinker _NSExtensionMain -framework Foundation \
-o "$TAPPEX/MulberryTestWidget" "$OUT/obj/MulberryTestWidget.o" "$OUT/obj/compat.o"
sed -e "s/@VERSION@/$VERSION/" -e "s/@BUILD@/$BUILD/" Resources/TestWidget-Info.plist > "$TAPPEX/Info.plist"
fi

12
docs/releases/1.0.1.md Normal file
View file

@ -0,0 +1,12 @@
# Mulberry for iOS 1.0.1
## Fixes
- Widgets: the widget extension now starts the way iOS expects (it quit right after launch, so no widgets were offered).
- Lists no longer end underneath the mini player and the navigation bar.
- The floating bass shape sits above the mini player instead of on top of it.
- Swipes on the cover in Now Playing: left/right = next/previous, down = close, up = lyrics.
- Universal engine: no more "player started when in a disconnected state" skipping.
## New
- Playback engine setting: Standard (Apple's player), Universal (every format), Sound FX (Universal + EQ).
- Version and build number in Settings › About; a note appears after updating.

19
tools/deploy Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash
# Copies the current build to the iPhone, removing older Mulberry packages there.
# Installs it too when passwordless sudo is allowed for TrollStore's helper; otherwise prints the command.
set -euo pipefail
cd "$(dirname "$0")/.."
IPHONE=${IPHONE:[email protected]}
KEY=${IPHONE_KEY:-$HOME/.ssh/iphone_key}
V=$(cat VERSION)
IPA=build/Mulberry-$V-iOS.ipa
ssh_=(ssh -i "$KEY" -o BatchMode=yes -o ConnectTimeout=10 "$IPHONE")
"${ssh_[@]}" 'rm -f /var/mobile/mulberry-build/Mulberry-*.ipa /var/mobile/mulberry-build/Mulberry-*.deb'
scp -q -i "$KEY" "$IPA" "build/Mulberry-$V-iOS-rootless.deb" "$IPHONE:/var/mobile/mulberry-build/"
HELPER=/var/jb/Applications/TrollStoreLite.app/trollstorehelper
if "${ssh_[@]}" "sudo -n $HELPER install /var/mobile/mulberry-build/$(basename "$IPA")" 2>/dev/null; then
echo "installed Mulberry $V"
else
echo "copied Mulberry $V; install with:"
echo " sudo $HELPER install /var/mobile/mulberry-build/$(basename "$IPA")"
fi