iOS 0.4.1: clearing tiles, deleting presets and slot-editor imports work on iOS 15

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Reactorcoremeltdown
2026-11-16 09:40:32 +01:00
co-authored by Claude Opus 5.5
parent 962cfd1e2b
commit 42f66534bf
4 changed files with 32 additions and 25 deletions
+8
View File
@@ -3,6 +3,14 @@
Sizzle for iOS/iPadOS (`cc.tiredsysadmin.ios.sizzle`). One entry per version in Sizzle for iOS/iPadOS (`cc.tiredsysadmin.ios.sizzle`). One entry per version in
`../versions.properties` (`ios.versionName` / `ios.versionCode`). `../versions.properties` (`ios.versionName` / `ios.versionCode`).
## 0.4.1 (build 9)
- Fix: clearing a Toolbox tile, deleting a preset, and importing a WAV, SF2/XI
or preset in the slot editor did nothing. On iOS 15, SwiftUI resets an
alert's (or file picker's) presentation state before running the button's
action, and the action read that state. The tile / preset / kind of import is
now handed over in a way that survives that.
## 0.4.0 (build 8) ## 0.4.0 (build 8)
- Sizzle itself on iOS: the Tracker, Mix, Toolbox and Setup tabs, ported from - Sizzle itself on iOS: the Tracker, Mix, Toolbox and Setup tabs, ported from
+14 -13
View File
@@ -21,7 +21,10 @@ struct SlotEditor: View {
@StateObject private var model: DeviceModel @StateObject private var model: DeviceModel
@ObservedObject private var watch = MixSongWatch.shared @ObservedObject private var watch = MixSongWatch.shared
@State private var pad = 0 @State private var pad = 0
/// What the file picker is for; kept after it closes, because SwiftUI resets
/// the presentation binding before calling the completion handler.
@State private var importing: ImportKind? @State private var importing: ImportKind?
@State private var pickerShown = false
@State private var importError: String? @State private var importError: String?
enum ImportKind: Identifiable { enum ImportKind: Identifiable {
@@ -61,11 +64,8 @@ struct SlotEditor: View {
} }
} }
.background(Theme.background.opacity(0.96)) .background(Theme.background.opacity(0.96))
.fileImporter(isPresented: Binding(get: { importing != nil }, set: { if !$0 { importing = nil } }), .fileImporter(isPresented: $pickerShown, allowedContentTypes: importTypes, allowsMultipleSelection: false) { result in
allowedContentTypes: importTypes, allowsMultipleSelection: false) { result in if case .success(let urls) = result, let url = urls.first, let kind = importing { load(url, kind) }
let kind = importing
importing = nil
if case .success(let urls) = result, let url = urls.first, let kind = kind { load(url, kind) }
} }
.alert("Import failed", isPresented: Binding(get: { importError != nil }, set: { if !$0 { importError = nil } }), .alert("Import failed", isPresented: Binding(get: { importError != nil }, set: { if !$0 { importError = nil } }),
actions: { Button("OK") { importError = nil } }, message: { Text(importError ?? "") }) actions: { Button("OK") { importError = nil } }, message: { Text(importError ?? "") })
@@ -88,10 +88,10 @@ struct SlotEditor: View {
Text("CLOSE ✕").font(Theme.mono(13)).foregroundColor(Theme.dim) Text("CLOSE ✕").font(Theme.mono(13)).foregroundColor(Theme.dim)
.contentShape(Rectangle()).onTapGesture(perform: onClose) .contentShape(Rectangle()).onTapGesture(perform: onClose)
} }
PresetBar(slot: slot, type: type, model: model, onImport: { importing = .preset }) PresetBar(slot: slot, type: type, model: model, onImport: { importing = .preset; pickerShown = true })
switch type { switch type {
case "SAMPLER": SamplerDetail(slot: slot, pad: pad, onSelectPad: { pad = $0 }, onImport: { importing = .padSample }) case "SAMPLER": SamplerDetail(slot: slot, pad: pad, onSelectPad: { pad = $0 }, onImport: { importing = .padSample; pickerShown = true })
case "SOUNDFONT": SoundFontDetail(slot: slot, onImport: { importing = .soundFont }) case "SOUNDFONT": SoundFontDetail(slot: slot, onImport: { importing = .soundFont; pickerShown = true })
default: EmptyView() default: EmptyView()
} }
// The card editor brings its own padding and header row; with no name and // The card editor brings its own padding and header row; with no name and
@@ -232,15 +232,16 @@ private struct PresetBar: View {
} }
} }
.sheet(isPresented: $saving) { saveSheet } .sheet(isPresented: $saving) { saveSheet }
.alert("Delete preset", isPresented: Binding(get: { confirmDelete != nil }, set: { if !$0 { confirmDelete = nil } }), actions: { // `presenting:`: the binding (and confirmDelete) is reset before the action runs.
.alert("Delete preset", isPresented: Binding(get: { confirmDelete != nil }, set: { if !$0 { confirmDelete = nil } }),
presenting: confirmDelete, actions: { n in
Button("Delete", role: .destructive) { Button("Delete", role: .destructive) {
if let n = confirmDelete { _ = session.deletePreset(n, type: type) } _ = session.deletePreset(n, type: type)
selected = nil selected = nil
confirmDelete = nil
names = session.libraryPresets(forType: type) names = session.libraryPresets(forType: type)
} }
Button("Cancel", role: .cancel) { confirmDelete = nil } Button("Cancel", role: .cancel) {}
}, message: { Text("Delete \"\(confirmDelete ?? "")\"? This cannot be undone.") }) }, message: { n in Text("Delete \"\(n)\"? This cannot be undone.") })
} }
private var saveSheet: some View { private var saveSheet: some View {
@@ -70,16 +70,14 @@ private struct ToolboxBody: View {
} }
} }
.background(Theme.background) .background(Theme.background)
.alert("Clear tile", isPresented: Binding(get: { clearing != nil }, set: { if !$0 { clearing = nil } }), actions: { // `presenting:` hands the tile to the buttons: SwiftUI resets the binding
Button("Clear", role: .destructive) { // (and so `clearing`) before a button's action runs.
if let i = clearing { session.clearSlot(i) } .alert("Clear tile", isPresented: Binding(get: { clearing != nil }, set: { if !$0 { clearing = nil } }),
clearing = nil presenting: clearing, actions: { i in
} Button("Clear", role: .destructive) { session.clearSlot(i) }
Button("Cancel", role: .cancel) { clearing = nil } Button("Cancel", role: .cancel) {}
}, message: { }, message: { i in
if let i = clearing {
Text("Remove \"\(tileLabel(i))\" from tile \(i + 1)? This clears the device and its settings and can't be undone.") Text("Remove \"\(tileLabel(i))\" from tile \(i + 1)? This clears the device and its settings and can't be undone.")
}
}) })
} }
+2 -2
View File
@@ -17,8 +17,8 @@ android.versionCode = 70
# iOS/iPadOS (cc.tiredsysadmin.ios.sizzle): the AUv3 plugin app in ios/app; the # iOS/iPadOS (cc.tiredsysadmin.ios.sizzle): the AUv3 plugin app in ios/app; the
# Makefile there passes these to Xcode and names the .ipa by versionCode. (The # Makefile there passes these to Xcode and names the .ipa by versionCode. (The
# TrollStore spike in ios/spike keeps its own version in its project.yml.) # TrollStore spike in ios/spike keeps its own version in its project.yml.)
ios.versionName = 0.4.0 ios.versionName = 0.4.1
ios.versionCode = 8 ios.versionCode = 9
macos.versionName = - macos.versionName = -
linux.versionName = - linux.versionName = -
bsd.versionName = - bsd.versionName = -