SPB Git

Repository Public

MandateViews.swift 25.8 KB 376 lines swift

1// SP Wallet iOS2// File: Features/Security/MandateViews.swift3// Description: Trading mandates: the list (kind, mode, state as served, account, limits, expiry, usage), the detail with the table4//              of WHO enforces each limit (isolated signer or API only), revocation (one confirmation, no passkey), and the5//              approval review: the mandate in full, the enforcement table, the acknowledgement verbatim with an explicit6//              checkbox, then — for a live mandate — two passkey prompts (1/2 signer, 2/2 API). Quoting mandates: list and revoke.7//8// Author: Simon-Pierre Boucher9// Contact: contact@spboucher.ai10import SwiftUI11import SPWalletCore1213struct MandateListAnswer: Decodable, Sendable { let mandates: [TradingMandateRecord] }1415/** Forwards to the real authenticator and reports which of the two prompts is on screen. It never alters a challenge. */16final class MandateStepAuthenticator: PasskeyAuthenticator, @unchecked Sendable {17    private let inner: any PasskeyAuthenticator18    private let onStep: @Sendable (Int) async -> Void19    private let lock = NSLock()20    private var count = 021    init(_ inner: any PasskeyAuthenticator, onStep: @escaping @Sendable (Int) async -> Void) { self.inner = inner; self.onStep = onStep }22    func assert(_ options: PasskeyRequestOptions, rpId: String) async throws -> PasskeyAssertion {23        let n = lock.withLock { count += 1; return count }24        await onStep(n)25        return try await inner.assert(options, rpId: rpId)26    }27    func register(_ options: PasskeyCreationOptions, rpId: String) async throws -> PasskeyRegistration { try await inner.register(options, rpId: rpId) }28}2930struct MandateListView: View {31    @Environment(AppModel.self) private var model32    @State private var list = Loaded<MandateListAnswer>()33    @State private var creating = false3435    var body: some View {36        ScrollView {37            VStack(alignment: .leading, spacing: Theme.Space.section) {38                FreshnessBanner()39                Text(String(localized: "Un mandat dit ce qu’une clé d’API ou un agent peut faire : comptes, marchés, budget, plafonds, levier, pertes, durée. Sans mandat approuvé, une permission d’exécution est inerte."))40                    .font(.spFootnote).foregroundStyle(Theme.mute)41                if let l = list.value {42                    if !list.live { RiskSnapshotNotice(savedAt: list.savedAt, error: list.error) }43                    if l.mandates.isEmpty { EmptyState(icon: "doc.badge.gearshape", title: String(localized: "Aucun mandat"), message: String(localized: "Aucune clé d’API ni aucun agent n’a d’autorité de trading.")).accessibilityIdentifier("mandates.empty") }44                    ForEach(l.mandates) { m in45                        NavigationLink { MandateDetailView(record: m) { Task { await load() } }.wallet(model) } label: { MandateRow(record: m) }46                            .buttonStyle(.plain).accessibilityIdentifier("mandate.row.\(m.id)")47                    }48                } else if let e = list.error { ErrorNotice(error: e) { Task { await load() } } }49                else if model.offlineBrowsing { EmptyState(icon: "doc.badge.gearshape", title: String(localized: "Mandats indisponibles hors ligne")) }50                else { ProgressView().frame(maxWidth: .infinity).padding(.top, 40) }51                Button { creating = true } label: { Label(String(localized: "Nouveau mandat"), systemImage: "plus") }52                    .buttonStyle(.spPrimary).disabled(!model.canOperate).accessibilityIdentifier("mandates.new")53            }54            .padding(.horizontal, Theme.Space.gutter).padding(.bottom, 28)55            .frame(maxWidth: 900).frame(maxWidth: .infinity)56        }57        .spPage()58        .navigationTitle(String(localized: "Mandats de trading")).navigationBarTitleDisplayMode(.inline)59        .refreshable { await load() }60        .task { await load() }61        .sheet(isPresented: $creating, onDismiss: { Task { await load() } }) { MandateCreateFlow().wallet(model) }62    }63    private func load() async { list = await SnapshotRead.read(MandateListAnswer.self, path: "/mandates", key: "risk-mandates", app: model, current: list) }64}6566struct MandateRow: View {67    let record: TradingMandateRecord68    var body: some View {69        VStack(alignment: .leading, spacing: 6) {70            HStack(alignment: .top) {71                Text(record.label ?? record.mandate?.label ?? record.id).font(.system(size: 15.5, weight: .semibold)).foregroundStyle(Theme.ink).multilineTextAlignment(.leading)72                Spacer()73                Image(systemName: "chevron.right").foregroundStyle(Theme.mute)74            }75            HStack(spacing: 6) {76                Pill(text: RiskWords.mode(record.mode), tone: RiskWords.modeTone(record.mode), icon: RiskWords.modeIcon(record.mode))77                Pill(text: MandateWords.state(record.state) + " · " + MandateWords.phase(record.phase), tone: MandateWords.tone(record))78            }79            Text([MandateWords.kind(record.kind), record.principal.label].joined(separator: " · ")).font(.spFootnote).foregroundStyle(Theme.mute).multilineTextAlignment(.leading)80            if let m = record.mandate {81                Text(String(localized: "Budget \(Fmt.usd(m.maxCapitalUsd)) · par ordre \(Fmt.usd(m.maxOrderNotionalUsd)) · levier \(Money.exact(m.maxLeverage)) × · expire le \(RiskWords.date(seconds: m.notAfter) ?? "—")"))82                    .font(.spFootnote).foregroundStyle(Theme.mute).multilineTextAlignment(.leading)83            } else { Text(String(localized: "Limites illisibles par cette version : voir le détail")).font(.spFootnote).foregroundStyle(Theme.warn) }84            if let u = record.usage { Text(String(localized: "Ordres acceptés : \(u.ordersAccepted.map(String.init) ?? "—") · refusés : \(u.ordersRejected.map(String.init) ?? "—") · ouverts : \(u.openOrders.map(String.init) ?? "—")")).font(.spFootnote).foregroundStyle(Theme.mute) }85        }86        .spCard().contentShape(Rectangle())87    }88}8990struct MandateDetailView: View {91    @Environment(AppModel.self) private var model92    @State var record: TradingMandateRecord93    let changed: () -> Void94    @State private var confirmRevoke = false95    @State private var busy = false96    @State private var error: Error?97    @State private var revocation: MandateRevocationResult?98    @State private var approving = false99100    var body: some View {101        ScrollView {102            VStack(alignment: .leading, spacing: Theme.Space.section) {103                HStack(spacing: 6) {104                    Pill(text: RiskWords.mode(record.mode), tone: RiskWords.modeTone(record.mode), icon: RiskWords.modeIcon(record.mode))105                    Pill(text: MandateWords.state(record.state) + " · " + MandateWords.phase(record.phase), tone: MandateWords.tone(record))106                    Spacer()107                }.accessibilityIdentifier("mandate.state")108                if record.integrity?.ok == false { Notice(tone: .danger, title: String(localized: "Intégrité de l’approbation rompue : mandat inutilisable"), message: record.integrity?.reason) }109                if let s = record.stop { Notice(tone: .warn, title: String(localized: "Arrêté : \(s.code)"), message: [RiskWords.date(ms: s.at), s.detail].compactMap { $0 }.joined(separator: " · ")) }110                if record.isQuoting { Notice(tone: .info, title: String(localized: "Mandat de tenue de marché"), message: String(localized: "Cette app l’affiche et peut le révoquer. Son approbation ne se fait pas ici.")) }111                if let r = revocation {112                    Notice(tone: .ok, title: String(localized: "Révocation enregistrée par le serveur"),113                           message: [String(localized: "\(r.cancelled) annulation(s) d’ordres demandée(s)."),114                                     r.signerRevoked == true ? String(localized: "Copie du signataire révoquée.") : r.signerRevoked == false ? String(localized: "Le signataire n’a PAS encore révoqué sa copie ; il sera redemandé. \(r.signerError ?? "")") : nil].compactMap { $0 }.joined(separator: " "))115                        .accessibilityIdentifier("mandate.revoked")116                }117                if let m = record.mandate { MandateFieldsCard(mandate: m, hash: record.hash) }118                else {119                    Notice(tone: .danger, title: String(localized: "Mandat illisible par cette version"), message: record.mandateProblem)120                    VStack(alignment: .leading) { Text(String(localized: "Objet brut, tel que servi")).spEyebrow(); JSONFields(value: record.mandateRaw) }.spCard()121                }122                if !record.enforcement.isEmpty { MandateEnforcementCard(rows: record.enforcement) }123                if let d = record.derived, !d.isEmpty { MandateDerivedCard(rows: d) }124                if let u = record.usage { usageCard(u) }125                if let a = record.approval {126                    VStack(alignment: .leading, spacing: 0) {127                        SectionHeader(title: String(localized: "Approbation enregistrée")).padding(.bottom, 4)128                        FieldRow(label: String(localized: "Approuvé le"), value: RiskWords.date(ms: a.approvedAt) ?? "—"); Divider()129                        FieldRow(label: String(localized: "Empreinte du mandat de trading"), value: a.tradingMandateHash, mono: true, copyable: true); Divider()130                        FieldRow(label: String(localized: "Empreinte du mandat du signataire"), value: a.signerMandateHash, mono: true, copyable: true)131                    }.spCard()132                }133                if let e = error { ErrorNotice(error: e).accessibilityIdentifier("mandate.error") }134                if record.state == "created", !record.isQuoting, record.mandate != nil {135                    Button { approving = true } label: { Label(String(localized: "Revoir et approuver"), systemImage: "checkmark.shield") }136                        .buttonStyle(.spPrimary).disabled(!model.canOperate || busy).accessibilityIdentifier("mandate.approve")137                }138                if record.state != "revoked" {139                    Button { confirmRevoke = true } label: { HStack { if busy { ProgressView() }; Label(String(localized: "Révoquer ce mandat"), systemImage: "xmark.shield.fill") } }140                        .buttonStyle(.spDestructive).disabled(!model.canOperate || busy).accessibilityIdentifier("mandate.revoke")141                    Text(String(localized: "Révoquer est définitif et ne demande aucune clé d’accès : cela ne fait que retirer de l’autorité.")).font(.spFootnote).foregroundStyle(Theme.mute)142                }143            }144            .padding(.horizontal, Theme.Space.gutter).padding(.bottom, 28)145            .frame(maxWidth: 900).frame(maxWidth: .infinity)146        }147        .spPage()148        .navigationTitle(record.label ?? String(localized: "Mandat")).navigationBarTitleDisplayMode(.inline)149        .confirmationDialog(String(localized: "Révoquer ce mandat ?"), isPresented: $confirmRevoke, titleVisibility: .visible) {150            Button(String(localized: "Révoquer et annuler ses ordres ouverts"), role: .destructive) { Task { await revoke(cancel: true) } }151            Button(String(localized: "Révoquer sans annuler ses ordres"), role: .destructive) { Task { await revoke(cancel: false) } }152            Button(String(localized: "Ne pas révoquer"), role: .cancel) {}153        } message: { Text(String(localized: "Le bénéficiaire ne pourra plus prendre de risque. Les ordres strictement réducteurs restent possibles pendant la période de liquidation.")) }154        .sheet(isPresented: $approving, onDismiss: { Task { await reload() } }) {155            if let m = record.mandate { MandateApprovalFlow(mandateId: record.id, expecting: .displayed(m)).wallet(model) }156        }157    }158159    private func usageCard(_ u: TradingMandateRecord.Usage) -> some View {160        func n(_ x: Int?) -> String { x.map(String.init) ?? "—" }161        return VStack(alignment: .leading, spacing: 0) {162            SectionHeader(title: String(localized: "Utilisation")).padding(.bottom, 4)163            FieldRow(label: String(localized: "Ordres acceptés / refusés / refus consécutifs"), value: "\(n(u.ordersAccepted)) / \(n(u.ordersRejected)) / \(n(u.consecutiveRejects))"); Divider()164            FieldRow(label: String(localized: "Ordres : dernière minute / heure / aujourd’hui / ouverts"), value: "\(n(u.ordersLastMinute)) / \(n(u.ordersLastHour)) / \(n(u.ordersToday)) / \(n(u.openOrders))"); Divider()165            FieldRow(label: String(localized: "Notionnel cumulé"), value: Fmt.usd(u.notionalTotal))166            if let t = u.lastOrderAt { Divider(); FieldRow(label: String(localized: "Dernier ordre"), value: RiskWords.date(ms: t) ?? "") }167        }.spCard()168    }169170    private func revoke(cancel: Bool) async {171        busy = true; error = nil; defer { busy = false }172        do {173            let r = try await MandatesAPI(model.env.client).revoke(id: record.id, cancelOpenOrders: cancel)174            revocation = r; record = r.mandate; changed()175        } catch { self.error = error }176    }177    private func reload() async { if let r = try? await MandatesAPI(model.env.client).mandate(record.id) { record = r; changed() } }178}179180struct MandateFieldsCard: View {181    let mandate: TradingMandate182    let hash: String183    var body: some View {184        VStack(alignment: .leading, spacing: 0) {185            SectionHeader(title: String(localized: "Le mandat, en entier")).padding(.bottom, 4)186            ForEach(MandateWords.fields(mandate), id: \.key) { f in187                FieldRow(label: f.label + " (\(f.key))", value: f.value, mono: f.mono, copyable: f.mono).accessibilityIdentifier("mandate.field.\(f.key)")188                Divider()189            }190            FieldRow(label: String(localized: "Empreinte du mandat (recalculée par l’app)"), value: hash, mono: true, copyable: true)191        }.spCard(padding: 16)192    }193}194195/** Who enforces each limit, with the server's own notes verbatim. */196struct MandateEnforcementCard: View {197    let rows: [MandateFieldEnforcement]198    var body: some View {199        VStack(alignment: .leading, spacing: 0) {200            SectionHeader(title: String(localized: "Qui fait respecter chaque limite")).padding(.bottom, 4)201            Text(String(localized: "« Signataire isolé » : la limite tient même si l’API est compromise. « API seulement » : seule l’API la vérifie — une API compromise pourrait l’ignorer."))202                .font(.spFootnote).foregroundStyle(Theme.mute).padding(.bottom, 6)203            ForEach(rows, id: \.field) { e in204                let w = MandateWords.enforcedBy(e.enforcedBy)205                VStack(alignment: .leading, spacing: 4) {206                    Text(e.field).font(.spMono).foregroundStyle(Theme.ink)207                    Pill(text: w.text, tone: w.tone, icon: w.icon)208                    Text((e.signerField.map { "\($0) — " } ?? "") + e.note).font(.spFootnote).foregroundStyle(Theme.mute).fixedSize(horizontal: false, vertical: true)209                }210                .padding(.vertical, 7).accessibilityElement(children: .combine).accessibilityIdentifier("mandate.enf.\(e.field)")211                if e.field != rows.last?.field { Divider() }212            }213        }.spCard(padding: 16)214    }215}216217struct MandateDerivedCard: View {218    let rows: [MandateDerivedValue]219    var body: some View {220        VStack(alignment: .leading, spacing: 0) {221            SectionHeader(title: String(localized: "Valeurs dérivées par le serveur")).padding(.bottom, 4)222            ForEach(rows, id: \.field) { d in FieldRow(label: d.field + " — " + d.from, value: d.value, mono: true); if d.field != rows.last?.field { Divider() } }223        }.spCard(padding: 16)224    }225}226227// MARK: approval228229@MainActor @Observable230final class MandateApprovalModel {231    var sheet: MandateApprovalSheet?232    var busy = false233    var error: Error?234    var acknowledged = false235    /** 0: no prompt on screen; 1: signer; 2: API */236    var promptStep = 0237    var approved: TradingMandateRecord?238239    func prepare(id: String, expecting: MandateExpectation, app: AppModel) async {240        guard sheet == nil, !busy else { return }241        busy = true; error = nil; defer { busy = false }242        do { sheet = try await MandatesAPI(app.env.client).prepareApproval(id: id, expecting: expecting, locale: Locale.current.language.languageCode?.identifier == "en" ? "en" : "fr") }243        catch { self.error = error }244    }245246    func approve(_ app: AppModel) async {247        guard let s = sheet, !busy else { return }248        busy = true; error = nil; promptStep = 0249        defer { busy = false; promptStep = 0 }250        let api = MandatesAPI(app.env.client)251        let stepper = MandateStepAuthenticator(app.env.passkeys) { [weak self] n in await MainActor.run { self?.promptStep = n } }252        do { approved = try await api.approve(s, acknowledgementConfirmed: acknowledged, with: stepper) }253        catch PasskeyError.cancelled {}254        catch let e as APIError where e.isOffline {255            // lost answer: read the record instead of signing again256            if let r = try? await api.mandate(s.mandateId), r.state != "created" { approved = r } else { error = e }257        } catch { self.error = error }258    }259}260261/** Prepares the approval of a mandate, shows the verified sheet, and approves. Used after a creation and from a `created` record. */262struct MandateApprovalFlow: View {263    @Environment(AppModel.self) private var model264    @Environment(\.dismiss) private var dismiss265    let mandateId: String266    let expecting: MandateExpectation267    @State private var flow = MandateApprovalModel()268269    var body: some View {270        NavigationStack {271            ScrollView {272                VStack(alignment: .leading, spacing: 14) { MandateApprovalContent(flow: flow, mandateId: mandateId, expecting: expecting) { dismiss() } }273                    .padding(.horizontal, Theme.Space.gutter).padding(.vertical, 12)274                    .frame(maxWidth: 680).frame(maxWidth: .infinity)275            }276            .spPage()277            .navigationTitle(String(localized: "Vérifier et approuver")).navigationBarTitleDisplayMode(.inline)278            .toolbar { ToolbarItem(placement: .cancellationAction) { Button(String(localized: "Fermer")) { dismiss() }.disabled(flow.busy) } }279        }280        .interactiveDismissDisabled()281    }282}283284struct MandateApprovalContent: View {285    @Environment(AppModel.self) private var model286    let flow: MandateApprovalModel287    let mandateId: String288    let expecting: MandateExpectation289    let close: () -> Void290291    var body: some View {292        @Bindable var flow = flow293        Group {294            if let r = flow.approved { done(r) }295            else if let s = flow.sheet {296                let live = s.live297                HStack(spacing: 6) { Pill(text: RiskWords.mode(s.mandate.mode), tone: RiskWords.modeTone(s.mandate.mode), icon: RiskWords.modeIcon(s.mandate.mode)); Spacer() }298                Notice(tone: live == nil ? .info : .warn,299                       title: live == nil ? String(localized: "Mandat PAPIER : rien n’est signé") : String(localized: "Mandat RÉEL : deux demandes de clé d’accès"),300                       message: live == nil ? String(localized: "En mode papier aucun fonds réel n’est engagé : l’approbation se fait avec la session seule, sans clé d’accès.")301                        : String(localized: "1/2 : signataire — ta clé d’accès approuve le mandat dérivé que le signataire isolé stockera et fera respecter. 2/2 : API — ta clé d’accès approuve l’empreinte du mandat de trading complet."))302                    .accessibilityIdentifier("mandate.review.mode")303                MandateFieldsCard(mandate: s.mandate, hash: s.hash)304                if !s.derived.isEmpty { MandateDerivedCard(rows: s.derived) }305                MandateEnforcementCard(rows: s.enforcement)306                if s.enforcement.contains(where: { $0.field == "maxDailyLossUsd" && $0.enforcedBy == "api_only" }) {307                    Notice(tone: .warn, title: String(localized: "La perte maximale par jour est appliquée par l’API seulement"), message: String(localized: "Le signataire isolé ne la vérifie pas. Le plancher de fonds propres, lui, figure dans le tableau ci-dessus avec son responsable."))308                }309                if let n = s.note { Text(n).font(.spFootnote).foregroundStyle(Theme.mute) }310                if let d = s.principalDescriptor { FieldRow(label: String(localized: "Descripteur du bénéficiaire"), value: d, mono: true).spCard(padding: 16) }311                if let live {312                    VStack(alignment: .leading, spacing: 0) {313                        Text(String(localized: "Ce que le signataire isolé stockera (demande 1/2)")).spEyebrow().padding(.bottom, 4)314                        JSONFields(value: (try? JSONValue.from(live.signer.object)) ?? .null)315                        Divider()316                        FieldRow(label: String(localized: "Empreinte du mandat du signataire (défi 1/2)"), value: live.signer.digest.hex, mono: true, copyable: true); Divider()317                        FieldRow(label: String(localized: "Empreinte de l’intention d’approbation (défi 2/2)"), value: live.binding.digest.hex, mono: true, copyable: true)318                    }.spCard(padding: 16)319                    if let w = live.warning { Notice(tone: .warn, title: String(localized: "Avertissement du serveur"), message: w) }320                    VStack(alignment: .leading, spacing: 10) {321                        Text(live.acknowledgement.title ?? String(localized: "Reconnaissance")).font(.spHeadline).foregroundStyle(Theme.ink)322                        Text(live.acknowledgement.text ?? String(localized: "Le serveur n’a pas fourni le texte de la reconnaissance."))323                            .font(.spCallout).foregroundStyle(Theme.ink).textSelection(.enabled).fixedSize(horizontal: false, vertical: true)324                            .accessibilityIdentifier("mandate.review.ackText")325                        Toggle(isOn: $flow.acknowledged) { Text(String(localized: "J’ai lu ce texte en entier et je l’accepte.")).font(.spCallout.weight(.semibold)) }326                            .toggleStyle(MandateCheckboxStyle()).disabled(live.acknowledgement.text == nil).accessibilityIdentifier("mandate.review.ack")327                    }.spCard(padding: 16)328                    RiskApprovalFacts(expiry: live.binding.object.expiry, digest: live.binding.digest, domain: MandateApprovalIntent.domain)329                }330                if flow.promptStep > 0 {331                    Notice(tone: .info, title: flow.promptStep == 1 ? String(localized: "Demande 1/2 : signataire") : String(localized: "Demande 2/2 : API"),332                           message: flow.promptStep == 1 ? String(localized: "Tu approuves le mandat dérivé que le signataire isolé fera respecter.") : String(localized: "Tu approuves l’empreinte du mandat de trading complet."))333                        .accessibilityIdentifier("mandate.review.step")334                }335                if let e = flow.error { ErrorNotice(error: e).accessibilityIdentifier("mandate.review.error") }336                if let live {337                    RiskApproveButtons(expiry: live.binding.object.expiry, busy: flow.busy, title: String(localized: "Approuver : 2 demandes de clé d’accès"), enabled: flow.acknowledged, identifier: "mandate.review.approve",338                                       approve: { Task { await flow.approve(model) } }, cancel: close)339                } else {340                    Button { Task { await flow.approve(model) } } label: { HStack { if flow.busy { ProgressView().tint(Theme.onPrimary) }; Text(String(localized: "Approuver ce mandat PAPIER (session seule)")) } }341                        .buttonStyle(.spPrimary).disabled(flow.busy || !model.canOperate).accessibilityIdentifier("mandate.review.approve")342                    Button(String(localized: "Fermer sans approuver"), action: close).buttonStyle(.spSecondary).disabled(flow.busy)343                }344                Text(String(localized: "Fermer sans approuver laisse le mandat « créé, non approuvé » : il n’a aucun effet et peut être révoqué.")).font(.spFootnote).foregroundStyle(Theme.mute)345            } else if let e = flow.error {346                ErrorNotice(error: e).accessibilityIdentifier("mandate.review.error")347                Text(String(localized: "Rien n’a été approuvé. Le mandat reste « créé, non approuvé », sans effet.")).font(.spFootnote).foregroundStyle(Theme.mute)348                Button(String(localized: "Fermer"), action: close).buttonStyle(.spSecondary)349            } else { ProgressView().frame(maxWidth: .infinity).padding(.top, 40) }350        }351        .task { await flow.prepare(id: mandateId, expecting: expecting, app: model) }352    }353354    @ViewBuilder private func done(_ r: TradingMandateRecord) -> some View {355        Notice(tone: MandateWords.tone(r), title: String(localized: "État renvoyé par le serveur : \(MandateWords.state(r.state)) · \(MandateWords.phase(r.phase))"),356               message: r.isActive ? nil : String(localized: "Le mandat n’est PAS en vigueur tant que le serveur ne l’indique pas."))357            .accessibilityIdentifier("mandate.review.result")358        if let m = r.mandate { MandateFieldsCard(mandate: m, hash: r.hash) }359        Button(String(localized: "Terminer"), action: close).buttonStyle(.spSecondary).accessibilityIdentifier("mandate.review.done")360    }361}362363struct MandateCheckboxStyle: ToggleStyle {364    func makeBody(configuration: Configuration) -> some View {365        Button { configuration.isOn.toggle() } label: {366            HStack(alignment: .top, spacing: 10) {367                Image(systemName: configuration.isOn ? "checkmark.square.fill" : "square").font(.system(size: 22)).foregroundStyle(configuration.isOn ? Theme.blue : Theme.mute)368                configuration.label.foregroundStyle(Theme.ink).multilineTextAlignment(.leading)369                Spacer(minLength: 0)370            }.frame(minHeight: 44).contentShape(Rectangle())371        }372        .buttonStyle(.plain)373        .accessibilityValue(configuration.isOn ? String(localized: "coché") : String(localized: "non coché"))374    }375}376
Files main
Menu

Theme