From 42f66534bf85c79ba1984d258acd97b4885a638c Mon Sep 17 00:00:00 2001 From: Reactorcoremeltdown Date: Mon, 16 Nov 2026 09:40:32 +0100 Subject: [PATCH] iOS 0.4.1: clearing tiles, deleting presets and slot-editor imports work on iOS 15 Co-Authored-By: Claude Opus 5.5 --- ios/CHANGELOG.md | 8 ++++++ ios/app/Host/Screens/Toolbox/SlotEditor.swift | 27 ++++++++++--------- .../Host/Screens/Toolbox/ToolboxScreen.swift | 18 ++++++------- versions.properties | 4 +-- 4 files changed, 32 insertions(+), 25 deletions(-) diff --git a/ios/CHANGELOG.md b/ios/CHANGELOG.md index 9f2fef2..6135689 100644 --- a/ios/CHANGELOG.md +++ b/ios/CHANGELOG.md @@ -3,6 +3,14 @@ Sizzle for iOS/iPadOS (`cc.tiredsysadmin.ios.sizzle`). One entry per version in `../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) - Sizzle itself on iOS: the Tracker, Mix, Toolbox and Setup tabs, ported from diff --git a/ios/app/Host/Screens/Toolbox/SlotEditor.swift b/ios/app/Host/Screens/Toolbox/SlotEditor.swift index da7cec9..d404139 100644 --- a/ios/app/Host/Screens/Toolbox/SlotEditor.swift +++ b/ios/app/Host/Screens/Toolbox/SlotEditor.swift @@ -21,7 +21,10 @@ struct SlotEditor: View { @StateObject private var model: DeviceModel @ObservedObject private var watch = MixSongWatch.shared @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 pickerShown = false @State private var importError: String? enum ImportKind: Identifiable { @@ -61,11 +64,8 @@ struct SlotEditor: View { } } .background(Theme.background.opacity(0.96)) - .fileImporter(isPresented: Binding(get: { importing != nil }, set: { if !$0 { importing = nil } }), - allowedContentTypes: importTypes, allowsMultipleSelection: false) { result in - let kind = importing - importing = nil - if case .success(let urls) = result, let url = urls.first, let kind = kind { load(url, kind) } + .fileImporter(isPresented: $pickerShown, allowedContentTypes: importTypes, allowsMultipleSelection: false) { result in + if case .success(let urls) = result, let url = urls.first, let kind = importing { load(url, kind) } } .alert("Import failed", isPresented: Binding(get: { importError != nil }, set: { if !$0 { importError = nil } }), actions: { Button("OK") { importError = nil } }, message: { Text(importError ?? "") }) @@ -88,10 +88,10 @@ struct SlotEditor: View { Text("CLOSE ✕").font(Theme.mono(13)).foregroundColor(Theme.dim) .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 { - case "SAMPLER": SamplerDetail(slot: slot, pad: pad, onSelectPad: { pad = $0 }, onImport: { importing = .padSample }) - case "SOUNDFONT": SoundFontDetail(slot: slot, onImport: { importing = .soundFont }) + case "SAMPLER": SamplerDetail(slot: slot, pad: pad, onSelectPad: { pad = $0 }, onImport: { importing = .padSample; pickerShown = true }) + case "SOUNDFONT": SoundFontDetail(slot: slot, onImport: { importing = .soundFont; pickerShown = true }) default: EmptyView() } // 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 } - .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) { - if let n = confirmDelete { _ = session.deletePreset(n, type: type) } + _ = session.deletePreset(n, type: type) selected = nil - confirmDelete = nil names = session.libraryPresets(forType: type) } - Button("Cancel", role: .cancel) { confirmDelete = nil } - }, message: { Text("Delete \"\(confirmDelete ?? "")\"? This cannot be undone.") }) + Button("Cancel", role: .cancel) {} + }, message: { n in Text("Delete \"\(n)\"? This cannot be undone.") }) } private var saveSheet: some View { diff --git a/ios/app/Host/Screens/Toolbox/ToolboxScreen.swift b/ios/app/Host/Screens/Toolbox/ToolboxScreen.swift index 04475fa..8f1f727 100644 --- a/ios/app/Host/Screens/Toolbox/ToolboxScreen.swift +++ b/ios/app/Host/Screens/Toolbox/ToolboxScreen.swift @@ -70,16 +70,14 @@ private struct ToolboxBody: View { } } .background(Theme.background) - .alert("Clear tile", isPresented: Binding(get: { clearing != nil }, set: { if !$0 { clearing = nil } }), actions: { - Button("Clear", role: .destructive) { - if let i = clearing { session.clearSlot(i) } - clearing = nil - } - Button("Cancel", role: .cancel) { clearing = nil } - }, message: { - if let i = clearing { - Text("Remove \"\(tileLabel(i))\" from tile \(i + 1)? This clears the device and its settings and can't be undone.") - } + // `presenting:` hands the tile to the buttons: SwiftUI resets the binding + // (and so `clearing`) before a button's action runs. + .alert("Clear tile", isPresented: Binding(get: { clearing != nil }, set: { if !$0 { clearing = nil } }), + presenting: clearing, actions: { i in + Button("Clear", role: .destructive) { session.clearSlot(i) } + Button("Cancel", role: .cancel) {} + }, message: { i in + Text("Remove \"\(tileLabel(i))\" from tile \(i + 1)? This clears the device and its settings and can't be undone.") }) } diff --git a/versions.properties b/versions.properties index 28f7be8..e5a38b1 100644 --- a/versions.properties +++ b/versions.properties @@ -17,8 +17,8 @@ android.versionCode = 70 # 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 # TrollStore spike in ios/spike keeps its own version in its project.yml.) -ios.versionName = 0.4.0 -ios.versionCode = 8 +ios.versionName = 0.4.1 +ios.versionCode = 9 macos.versionName = - linux.versionName = - bsd.versionName = -