1.0.6: widget cover size, link-based widget buttons, remove widget animation setting

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-10-27 23:12:45 -05:00
commit 0e041351be
6 changed files with 37 additions and 21 deletions

View file

@ -40,6 +40,13 @@ struct MulberryApp: App {
// mulberry://nowplaying from the widget, files opened "in place" from other apps.
if url.scheme == "mulberry" {
if url.host == "nowplaying" { UIState.shared.nowPlaying = Player.shared.current != nil }
if url.host == "cmd", let c = MulberryCommand(rawValue: url.lastPathComponent) {
IntentRouter.handler?(c)
// Widget button: do it and return to the Home Screen (private UIApplication.suspend).
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
UIApplication.shared.perform(NSSelectorFromString("suspend"))
}
}
} else if url.isFileURL {
openFile(url)
}

View file

@ -41,7 +41,7 @@ enum WidgetBridge {
if art !== lastArt {
lastArt = art
artVersion += 1
if let art, let d = squareThumb(art, 400)?.jpegData(compressionQuality: 0.85) {
if let art, let d = squareThumb(art, 300, scale: 1)?.jpegData(compressionQuality: 0.85) {
try? d.write(to: NowSnapshot.artFile, options: .atomic)
} else {
try? FileManager.default.removeItem(at: NowSnapshot.artFile)
@ -71,10 +71,12 @@ enum WidgetBridge {
}
}
static func squareThumb(_ img: UIImage, _ px: CGFloat) -> UIImage? {
static func squareThumb(_ img: UIImage, _ px: CGFloat, scale: CGFloat = 0) -> UIImage? {
let side = min(img.size.width, img.size.height)
guard side > 0 else { return nil }
let r = UIGraphicsImageRenderer(size: CGSize(width: px, height: px))
let fmt = UIGraphicsImageRendererFormat.default()
if scale > 0 { fmt.scale = scale }
let r = UIGraphicsImageRenderer(size: CGSize(width: px, height: px), format: fmt)
return r.image { _ in
let scale = px / side
let w = img.size.width * scale, h = img.size.height * scale

View file

@ -34,9 +34,6 @@ struct SettingsView: View {
options: [("Follow system", "system"), ("Dark", "dark"), ("Light", "light")], selection: $prefs.themeMode)
ToggleRow(icon: "waveform", title: "Visualizer", sub: "Spectrum bars around the cover (from the audio itself, no microphone needed)", on: $prefs.visualizer)
ToggleRow(icon: "sparkle", title: "Floating bass shape", sub: "A shape at the bottom-left that morphs, spins and pulses with the beat", on: $prefs.bassShape)
MenuRow(icon: "rectangle.3.group", title: "Widget animation", value: widgetLabel,
options: [("Off", "0"), ("Battery saver — 5 fps", "5"), ("Balanced — 15 fps", "15"), ("Smooth — 30 fps", "30")],
selection: Binding(get: { String(prefs.widgetAnim) }, set: { prefs.widgetAnim = Int($0) ?? 15; Player.shared.publishWidget() }))
ToggleRow(icon: "leaf", title: "Low-power mode", sub: "Fewer animations, no visualizer, 30 fps", on: $prefs.lowPower)
}

View file

@ -1 +1 @@
1.0.5
1.0.6

View file

@ -95,21 +95,21 @@ struct CoverCookie: View {
}
}
/// Plain glyph button like FlacBox's widget (no capsule).
struct GlyphButton<I: AppIntent>: View {
let intent: I
/// Plain glyph button like FlacBox's widget. It's a link: iOS's AppIntents indexer (linkd) won't index
/// non-App Store apps, so Button(intent:) does nothing. The app runs the command and returns to the Home Screen.
struct GlyphButton: View {
let cmd: MulberryCommand
let icon: String
let size: CGFloat
let color: Color
var body: some View {
Button(intent: intent) {
Link(destination: URL(string: "mulberry://cmd/" + cmd.rawValue)!) {
Image(systemName: icon)
.font(.system(size: size, weight: .semibold))
.foregroundColor(color)
.frame(maxWidth: .infinity, minHeight: size * 1.6)
.contentShape(Rectangle())
}
.buttonStyle(.plain)
}
}
@ -121,11 +121,11 @@ struct Controls: View {
var skips = true
var body: some View {
HStack(spacing: 0) {
GlyphButton(intent: PreviousTrackIntent(), icon: "backward.fill", size: size, color: col.onSurface)
if skips { GlyphButton(intent: SkipBackIntent(), icon: "gobackward.10", size: size * 0.9, color: col.onSurface) }
GlyphButton(intent: PlayPauseIntent(), icon: s.playing ? "pause.fill" : "play.fill", size: size * 1.2, color: col.primary)
if skips { GlyphButton(intent: SkipForwardIntent(), icon: "goforward.10", size: size * 0.9, color: col.onSurface) }
GlyphButton(intent: NextTrackIntent(), icon: "forward.fill", size: size, color: col.onSurface)
GlyphButton(cmd: .previous, icon: "backward.fill", size: size, color: col.onSurface)
if skips { GlyphButton(cmd: .back10, icon: "gobackward.10", size: size * 0.9, color: col.onSurface) }
GlyphButton(cmd: .toggle, icon: s.playing ? "pause.fill" : "play.fill", size: size * 1.2, color: col.primary)
if skips { GlyphButton(cmd: .forward10, icon: "goforward.10", size: size * 0.9, color: col.onSurface) }
GlyphButton(cmd: .next, icon: "forward.fill", size: size, color: col.onSurface)
}
}
}
@ -174,7 +174,7 @@ struct PlayerWidgetView: View {
default: medium(s, col)
}
}
.widgetURL(URL(string: "mulberry://nowplaying"))
.widgetURL(URL(string: family == .systemSmall ? "mulberry://cmd/toggle" : "mulberry://nowplaying"))
.containerBackground(for: .widget) {
LinearGradient(colors: [Color(rgb: Palette.mix(s.palette.count == 10 ? s.palette[2] : 0x553355,
s.palette.count == 10 ? s.palette[7] : 0x222222, 0.45)),
@ -190,13 +190,12 @@ struct PlayerWidgetView: View {
}
private func heart(_ s: NowSnapshot, _ col: WColors) -> some View {
Button(intent: FavouriteIntent()) {
Link(destination: URL(string: "mulberry://cmd/favourite")!) {
Image(systemName: s.favourite ? "heart.fill" : "heart")
.font(.system(size: 22, weight: .regular))
.foregroundColor(s.favourite ? col.primary : col.onSurface)
.frame(width: 34, height: 34)
}
.buttonStyle(.plain)
}
private func small(_ s: NowSnapshot, _ col: WColors) -> some View {
@ -205,7 +204,8 @@ struct PlayerWidgetView: View {
Spacer(minLength: 2)
Text(title(s)).font(.system(size: 14, weight: .bold)).foregroundColor(col.onSurface).lineLimit(1)
Text(s.artist).font(.system(size: 12)).foregroundColor(col.onSurfaceVar).lineLimit(1)
Controls(s: s, col: col, size: 18, skips: false)
Image(systemName: s.playing ? "pause.fill" : "play.fill")
.font(.system(size: 20, weight: .semibold)).foregroundColor(col.primary)
}
}

10
docs/releases/1.0.6.md Normal file
View file

@ -0,0 +1,10 @@
# Mulberry for iOS 1.0.6
## Fixes
- Widgets: small and large no longer show grey placeholders (the cover image was 800x800 px, over the iOS widget limit).
- Widget buttons now work: they are links handled by the app, which returns to the Home Screen right away
(iOS will not index AppIntents for apps outside the App Store, so intent buttons did nothing).
The small widget toggles play/pause when tapped.
## Removed
- "Widget animation" setting (not applicable on iOS).