iOS 0.4.0: Sizzle's Tracker, Mix, Toolbox and Setup tabs on the C++ engine
Ported from the Android tabs by parallel agents (each screen with its own SizzleSession category); slot editors use the card editor with a preset library; songs load/save in the Android project format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
29650b88d7
commit
962cfd1e2b
@@ -0,0 +1,93 @@
|
||||
// SPDX-FileCopyrightText: 2026 Reactorcoremeltdown
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import SwiftUI
|
||||
|
||||
// The Setup tab's UIKit-backed pieces: the share sheet, the device lab and the
|
||||
// plugin check. The Mac snapshot tool has no UIKit (and doesn't compile
|
||||
// DeviceLabView / PluginCheck), so there they are no-ops.
|
||||
|
||||
#if canImport(UIKit)
|
||||
import UIKit
|
||||
|
||||
enum ShareSheet {
|
||||
/// Presents the system share sheet for [url] over the frontmost view controller
|
||||
/// (a centred popover on iPad); [done] runs when it closes.
|
||||
@MainActor static func present(_ url: URL, done: @escaping () -> Void = {}) {
|
||||
let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }
|
||||
let scene = scenes.first { $0.activationState == .foregroundActive } ?? scenes.first
|
||||
guard var top = (scene?.windows.first { $0.isKeyWindow } ?? scene?.windows.first)?.rootViewController else { return }
|
||||
while let next = top.presentedViewController { top = next }
|
||||
let vc = UIActivityViewController(activityItems: [url], applicationActivities: nil)
|
||||
vc.completionWithItemsHandler = { _, _, _, _ in done() }
|
||||
if let pop = vc.popoverPresentationController {
|
||||
pop.sourceView = top.view
|
||||
pop.sourceRect = CGRect(x: top.view.bounds.midX, y: top.view.bounds.midY, width: 0, height: 0)
|
||||
pop.permittedArrowDirections = []
|
||||
}
|
||||
top.present(vc, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
extension View {
|
||||
/// The old device test screen (instruments, effects, benchmark), full screen.
|
||||
func deviceLab(isPresented: Binding<Bool>) -> some View {
|
||||
fullScreenCover(isPresented: isPresented) {
|
||||
VStack(spacing: 0) {
|
||||
HStack {
|
||||
Text("Device lab").font(.headline)
|
||||
Spacer()
|
||||
Button("Done") { isPresented.wrappedValue = false }.font(.body.weight(.semibold))
|
||||
}
|
||||
.padding(.horizontal).padding(.top, 12)
|
||||
DeviceLabView()
|
||||
}
|
||||
.background(Theme.background.ignoresSafeArea())
|
||||
.preferredColorScheme(.dark)
|
||||
}
|
||||
}
|
||||
|
||||
/// Loads every registered Sizzle plugin out of process and renders through it.
|
||||
func pluginCheck(isPresented: Binding<Bool>) -> some View {
|
||||
sheet(isPresented: isPresented) { PluginCheckSheet { isPresented.wrappedValue = false } }
|
||||
}
|
||||
}
|
||||
|
||||
private struct PluginCheckSheet: View {
|
||||
let close: () -> Void
|
||||
@StateObject private var check = PluginCheck()
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 10) {
|
||||
HStack {
|
||||
Text("Plugin check").font(.headline)
|
||||
if check.running { ProgressView().padding(.leading, 6) }
|
||||
Spacer()
|
||||
Button("Run again") { Task { await check.run() } }.disabled(check.running)
|
||||
Button("Done", action: close).font(.body.weight(.semibold)).padding(.leading, 12)
|
||||
}
|
||||
ScrollView {
|
||||
Text(check.lines.joined(separator: "\n"))
|
||||
.font(.system(.footnote, design: .monospaced))
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.textSelection(.enabled)
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.preferredColorScheme(.dark)
|
||||
.task { await check.run() }
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
enum ShareSheet {
|
||||
@MainActor static func present(_ url: URL, done: @escaping () -> Void = {}) { done() }
|
||||
}
|
||||
|
||||
extension View {
|
||||
func deviceLab(isPresented: Binding<Bool>) -> some View { self }
|
||||
func pluginCheck(isPresented: Binding<Bool>) -> some View { self }
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user