SPB Git

Repository Public License

PrivacyAuditView.swift 3.9 KB 77 lines swift

1// ORIX Secure2// File: App/Sources/Features/Privacy/PrivacyAuditView.swift3// Description: The privacy audit: ORIX Secure's own permissions with their purpose, the app's data practices, the privacy4//              checklist, and what cannot be read about other apps.5//6// Author: Simon-Pierre Boucher7// Contact: contact@spboucher.ai8import ORIXDesign9import ORIXSecureEngines10import ORIXSecureModel11import SwiftUI1213struct PrivacyAuditView: View {14    @Environment(AppModel.self) private var model15    @Environment(Router.self) private var router16    @State private var saved = false17    @State private var showChecklist = false1819    var body: some View {20        let audit = model.privacy21        let summary = AssessmentSummary(findings: audit.checklist)22        ScreenScroll {23            VStack(alignment: .leading, spacing: ORIX.Space.sm) {24                Text("\(summary.userConfirmed) confirmed · \(summary.attention) to review · \(summary.awaitingConfirmation) not checked")25                    .font(.orixHeadline).foregroundStyle(ORIX.Palette.textPrimary)26                Text("iOS shows privacy settings to you, not to apps. The checklist tells you where each one is.")27                    .font(.orixCaption).foregroundStyle(ORIX.Palette.textSecondary)28                Button { showChecklist = true } label: { Label("Open Privacy Checklist", systemImage: "checklist") }.buttonStyle(.orixPrimary)29                    .accessibilityIdentifier("privacy.openChecklist")30            }31            .orixCard()32            let improvements = audit.checklist.filter { $0.state == .attention }.prioritized()33            if !improvements.isEmpty {34                ORIXSectionHeader("Recommended improvements")35                FindingList(findings: improvements)36            }37            ORIXSectionHeader("ORIX Secure's own permissions")38            Text("The only permission states an app can read are its own. Each is requested only when you use the feature that needs it.")39                .font(.orixCaption).foregroundStyle(ORIX.Palette.textSecondary)40            FindingList(findings: audit.appPermissions)41            ORIXSectionHeader("What ORIX Secure does with data")42            VStack(alignment: .leading, spacing: 0) {43                ForEach(Array(audit.practices.enumerated()), id: \.offset) { index, fact in44                    VStack(alignment: .leading, spacing: 2) {45                        Text(verbatim: fact.label).font(.orixCaption).foregroundStyle(ORIX.Palette.textSecondary)46                        Text(verbatim: fact.value).font(.orixCallout).foregroundStyle(ORIX.Palette.textPrimary)47                    }48                    .padding(.vertical, 8)49                    .frame(maxWidth: .infinity, alignment: .leading)50                    .accessibilityElement(children: .combine)51                    if index < audit.practices.count - 1 { Divider() }52                }53            }54            .orixCard()55            ORIXSectionHeader("Privacy settings")56            FindingList(findings: audit.checklist.filter { $0.state != .attention }.prioritized())57            LimitsCard(title: "What a privacy app cannot see", items: audit.notAssessable.map { "\($0.title) — \($0.reason)" })58        }59        .navigationTitle("Privacy Audit")60        .toolbar {61            ToolbarItem(placement: .topBarTrailing) {62                Button { saved = model.store.save(ReportBuilder.privacy(model.privacy)); ORIXHaptics.success() } label: {63                    Label("Save Report", systemImage: saved ? "checkmark" : "square.and.arrow.down")64                }65                .accessibilityIdentifier("privacy.save")66            }67        }68        .sheet(isPresented: $showChecklist) {69            NavigationStack {70                ChecklistView(domain: .privacy)71                    .toolbar { ToolbarItem(placement: .confirmationAction) { Button("Done") { showChecklist = false }.accessibilityIdentifier("privacyChecklist.done") } }72            }73        }74        .accessibilityIdentifier("privacy")75    }76}77
Files main
Menu

Theme