feat(rigs): confirm before overwriting a built-in factory rig
Saving over a currently-loaded factory rig now shows a confirmation dialog instead of silently replacing the shipped original: Overwrite (destructive), Save as New Rig… (new id, keeps the original), or Cancel. The pending follow-up (e.g. the Save & Clear clear step) is threaded through all three paths. Adds FactoryRigLibrary.factoryIDs / isFactory(_:) so the UI can tell a shipped rig from a user rig by id, with a test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -48,6 +48,21 @@ extension PedalBoard {
|
||||
@MainActor
|
||||
public enum FactoryRigLibrary {
|
||||
|
||||
/// Stable ids of every built-in rig, for detecting whether a library entry is a factory rig.
|
||||
///
|
||||
/// Because factory rigs are seeded with their fixed ``FactoryRig/id``, an entry recalled from the
|
||||
/// library can be identified as shipped-vs-user by id membership here. Callers use this to guard
|
||||
/// destructive actions (e.g. warn before overwriting a starter rig).
|
||||
public static let factoryIDs: Set<UUID> = Set(all.map { $0.id })
|
||||
|
||||
/// Whether `id` belongs to a shipped factory rig.
|
||||
///
|
||||
/// - Parameter id: A ``RigEntry/id`` from the rig library.
|
||||
/// - Returns: `true` if the entry is one of the built-in starter rigs.
|
||||
public static func isFactory(_ id: UUID) -> Bool {
|
||||
factoryIDs.contains(id)
|
||||
}
|
||||
|
||||
/// Every built-in rig, in the order a picker should present them.
|
||||
public static let all: [FactoryRig] = [
|
||||
glideWall,
|
||||
|
||||
Reference in New Issue
Block a user