Repository Public
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : Vrai-Prix iOS9// File : VraiPrix/Features/More/SettingsView.swift10// Description : réglages (thème, animations, photo de la rue, données sur11// l'appareil), à propos, confidentialité, conditions. Aucun12// compte ; contact unique : contact@spboucher.ai.13// Module : VraiPrix14// Repository : https://git.spboucher.ai/vrai-prix-ios-v315// Project Website : https://www.vrai-prix.com16// Created : 2026-11-2617// Last Modified : 2026-11-2618//19// =============================================================================20// AUTHOR & PROFESSIONAL AFFILIATION21// =============================================================================22//23// Author : Simon-Pierre Boucher24// Position : Professor of Finance25// Institution : Université du Québec en Outaouais (UQO)26// Department : Département des sciences administratives27// Organization : SP Boucher28//29// Website : https://spboucher.ai30// Git : https://git.spboucher.ai31//32// =============================================================================33// OFFICIAL CONTACT DIRECTORY34// =============================================================================35//36// General : info@spboucher.ai37// Professional : contact@spboucher.ai38// Direct : simon@spboucher.ai39// Research : research@spboucher.ai40// Development : dev@spboucher.ai41// Support : support@spboucher.ai42// Security/Admin : admin@spboucher.ai43// Notifications : notifications@spboucher.ai44//45// Preferred Contact: support@spboucher.ai46//47// =============================================================================48// COPYRIGHT & INTELLECTUAL PROPERTY49// =============================================================================50//51// Copyright (c) 202652// Simon-Pierre Boucher53//54// All rights reserved where applicable.55//56// This file is governed by the applicable project license,57// copyright notices, institutional agreements and relevant law.58//59// Unless expressly authorized by the applicable license or60// rights holder, copying, redistribution, sublicensing,61// publication and commercial exploitation are not permitted.62//63// Existing third-party rights and notices remain unaffected.64//65// =============================================================================66// CONFIDENTIALITY & SECURITY67// =============================================================================68//69// Classification : Public70// Distribution : Public repository; use is governed by the project license71// Security Contact : admin@spboucher.ai72//73// Access to this source does not independently grant permission74// to redistribute or disclose confidential materials.75//76// Do not embed credentials, private keys, access tokens,77// certificates or confidential personal information.78//79// =============================================================================80// LICENSE & MAINTENANCE81// =============================================================================82//83// License : None specified (no license file in this repository)84// Maintainer : Simon-Pierre Boucher85// Technical Contact: dev@spboucher.ai86//87// =============================================================================88// END OF SP BOUCHER SOURCE HEADER89// =============================================================================9091import SwiftUI9293struct SettingsView: View {94 @Environment(AppModel.self) private var model95 @Environment(Library.self) private var library96 @Environment(MotionCenter.self) private var motion97 @Environment(\.accessibilityReduceMotion) private var reduceMotion98 @AppStorage("streetPhoto") private var streetPhoto = true99 @State private var confirmErase = false100 @State private var replay = 0101 @State private var service: String?102103 var body: some View {104 @Bindable var model = model105 @Bindable var motion = motion106 ScrollView {107 VStack(alignment: .leading, spacing: 0) {108 group("Apparence") {109 SlidingSegmented(selection: $model.appearance, options: Appearance.allCases.map { ($0, $0 == .system ? "Système" : $0.label) }, label: "Thème")110 }111112 group("Animations") {113 SlidingSegmented(selection: $motion.preference, options: MotionCenter.Preference.allCases.map { ($0, $0.label) }, label: "Animations")114 Text(motionNote).font(.footnote).foregroundStyle(Theme.ink3).fixedSize(horizontal: false, vertical: true)115 // le geste, rejouable : on voit ce que le réglage change116 VStack(spacing: 8) {117 PlumbScene(data: PlumbData(value: 460_100, low: 400_200, high: 566_000, price: 489_000, priceLabel: "Prix demandé"),118 photo: nil, level: MotionCenter.level(trigger: .reveal, preference: motion.preference, reduceMotion: reduceMotion, signaturePlayed: 0),119 background: Theme.surface)120 .id("\(replay)-\(motion.preference.rawValue)")121 Button("Rejouer le geste") { replay += 1 }122 .font(.subheadline.weight(.medium)).foregroundStyle(Theme.brand).frame(minHeight: 44)123 .disabled(motion.preference == .off || reduceMotion)124 }125 .cardStyle(padding: 14)126 .accessibilityIdentifier("gesture-demo")127 }128129 group("Fiche d'une propriété") {130 Toggle(isOn: $streetPhoto) {131 VStack(alignment: .leading, spacing: 2) {132 Text("Photo de la rue").font(.body).foregroundStyle(Theme.ink)133 Text("Vue de la rue de Plans d'Apple en tête de fiche, quand elle existe. Sinon, un pignon dessiné.")134 .font(.footnote).foregroundStyle(Theme.ink3).fixedSize(horizontal: false, vertical: true)135 }136 }137 .tint(Theme.brand)138 }139140 group("Données sur cet appareil") {141 Text("\(library.favorites.count) favoris, \(library.compare.count) au comparateur, \(library.recents.count) fiches récentes. Rien n'est envoyé à un serveur : il n'y a pas de compte.")142 .font(.subheadline).num().foregroundStyle(Theme.ink2).fixedSize(horizontal: false, vertical: true)143 Button("Effacer les favoris, le comparateur et l'historique") { confirmErase = true }144 .buttonStyle(SecondaryButtonStyle())145 .disabled(library.favorites.isEmpty && library.compare.isEmpty && library.recents.isEmpty && library.searches.isEmpty)146 }147148 VStack(spacing: 0) {149 Hairline()150 NavRow(icon: .estimation, title: "Méthodologie") { model.open(.methodology) }151 NavRow(icon: .aplomb, title: "À propos de Vrai-Prix") { model.open(.about) }152 NavRow(icon: .roleEvaluation, title: "Confidentialité") { model.open(.privacy) }153 NavRow(icon: .roleEvaluation, title: "Conditions d'utilisation", divider: false) { model.open(.terms) }154 }155 .padding(.top, 30)156157 Text("Vrai-Prix \(Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "") (\(Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? ""))\(service.map { " · service \($0)" } ?? "")")158 .font(.footnote).num().foregroundStyle(Theme.ink3).padding(.top, 22)159 }160 .pageColumn()161 .padding(.top, 4).padding(.bottom, 36)162 }163 .background(Theme.bg)164 .navigationTitle("Réglages")165 .navigationBarTitleDisplayMode(.inline)166 .confirmationDialog("Effacer les données gardées sur cet appareil ?", isPresented: $confirmErase, titleVisibility: .visible) {167 Button("Tout effacer", role: .destructive) { library.eraseAll(); ResponseCache.clear(); model.showToast("Données effacées") }168 Button("Annuler", role: .cancel) {}169 } message: {170 Text("Favoris, comparateur, fiches et recherches récentes, et copies hors ligne.")171 }172 .task { service = await APIClient.shared.baseURL().host() }173 }174175 private var motionNote: String {176 if reduceMotion { return "« Réduire les animations » est activé dans les réglages d'accessibilité : l'app n'anime rien." }177 switch motion.preference {178 case .auto: return "Le fil à plomb oscille à l'ouverture d'une fiche : en entier pour une estimation demandée et les premières fiches, plus brièvement ensuite."179 case .discrete: return "Le geste est toujours joué dans sa version courte."180 case .off: return "Aucune animation : la mesure s'affiche d'emblée."181 }182 }183184 private func group<C: View>(_ title: String, @ViewBuilder _ content: () -> C) -> some View {185 VStack(alignment: .leading, spacing: 12) {186 Text(title).eyebrowStyle()187 content()188 }189 .padding(.top, 26)190 }191}192193struct AboutView: View {194 @Environment(AppModel.self) private var model195 @Environment(\.openURL) private var openURL196197 var body: some View {198 ScrollView {199 VStack(alignment: .leading, spacing: 0) {200 BrandSymbol().frame(width: 64, height: 64).padding(.top, 8)201 Wordmark(size: 30, withSymbol: false).padding(.top, 12)202 Text("Le fil à plomb est l'outil avec lequel les bâtisseurs vérifient qu'un mur est vrai : d'aplomb. Vrai-Prix fait la même chose avec un prix. Il donne la verticale, c'est-à-dire la valeur estimée et les ventes réellement conclues, et mesure de combien un prix s'en écarte.")203 .font(.body).foregroundStyle(Theme.ink2).lineSpacing(3).fixedSize(horizontal: false, vertical: true).padding(.top, 16)204205 SectionHeader("Ce que contient l'app").padding(.top, 32)206 VStack(alignment: .leading, spacing: 10) {207 line("Une estimation, avec sa fourchette et sa fiabilité, pour chaque propriété du rôle d'évaluation foncière du Québec.")208 line("Le registre des ventes publiées depuis 2021, par lieu, type, prix et période.")209 line("Les propriétés à vendre, leur prix demandé lu contre leur valeur estimée.")210 line("L'indice de marché, les portraits des municipalités et la méthode du coût.")211 }212 .padding(.top, 12)213214 SectionHeader("Sources").padding(.top, 32)215 Text("Rôles d'évaluation foncière du Québec (ministère des Affaires municipales et de l'Habitation, données ouvertes), millésimes 2021 à 2026. Transactions publiées dans le flux « Transactions immobilières » du Journal de Québec et du Journal de Montréal. Indices des prix de la construction de Statistique Canada. Annonces publiques des agences et plateformes immobilières.")216 .font(.subheadline).foregroundStyle(Theme.ink2).lineSpacing(2).fixedSize(horizontal: false, vertical: true).padding(.top, 10)217218 SectionHeader("Limites").padding(.top, 32)219 Text("Une estimation est une mesure statistique : elle a une fourchette, et sa fiabilité dépend du nombre de ventes comparables. Elle ne tient pas compte de l'état intérieur, des rénovations ni de ce qu'une visite révèle. Elle ne remplace pas le rapport d'un évaluateur agréé.")220 .font(.subheadline).foregroundStyle(Theme.ink2).lineSpacing(2).fixedSize(horizontal: false, vertical: true).padding(.top, 10)221222 SectionHeader("Contact").padding(.top, 32)223 Button { if let u = URL(string: "mailto:contact@spboucher.ai") { openURL(u) } } label: {224 Text("contact@spboucher.ai").font(.body.weight(.medium)).foregroundStyle(Theme.brand).frame(minHeight: 44)225 }226 .buttonStyle(.plain)227 .accessibilityIdentifier("contact-link")228 Text("Simon-Pierre Boucher. Une erreur dans une fiche, une question sur la méthode : écrivez.")229 .font(.footnote).foregroundStyle(Theme.ink3).fixedSize(horizontal: false, vertical: true)230231 VStack(spacing: 0) {232 Hairline()233 NavRow(icon: .estimation, title: "Méthodologie") { model.open(.methodology) }234 NavRow(icon: .roleEvaluation, title: "Confidentialité") { model.open(.privacy) }235 NavRow(icon: .roleEvaluation, title: "Conditions d'utilisation", divider: false) { model.open(.terms) }236 }237 .padding(.top, 28)238 }239 .pageColumn()240 .padding(.bottom, 36)241 }242 .background(Theme.bg)243 .navigationTitle("À propos")244 .navigationBarTitleDisplayMode(.inline)245 }246247 private func line(_ s: String) -> some View {248 HStack(alignment: .firstTextBaseline, spacing: 10) {249 Rectangle().fill(Theme.ink).frame(width: 10, height: 1.5).offset(y: -4)250 Text(s).font(.subheadline).foregroundStyle(Theme.ink2).fixedSize(horizontal: false, vertical: true)251 }252 }253}254255struct LegalView: View {256 enum Kind { case privacy, terms }257 let kind: Kind258259 private var sections: [(String, String)] {260 switch kind {261 case .privacy: [262 ("Aucun compte, aucun profil", "Vrai-Prix ne demande ni nom, ni courriel, ni mot de passe. Il n'y a pas de compte."),263 ("Ce qui reste sur l'appareil", "Les favoris, le comparateur, les fiches et recherches récentes, les réglages et les copies hors ligne sont gardés sur cet appareil seulement. Ils s'effacent dans Réglages, ou en supprimant l'app."),264 ("Ce qui est transmis", "Pour afficher une fiche, l'app demande au service Vrai-Prix l'adresse ou l'identifiant de la propriété consultée. Ces requêtes ne sont liées à aucun identifiant de personne ni d'appareil. Aucun outil de mesure d'audience, aucune publicité, aucun traceur."),265 ("Carte et position", "La carte et la vue de la rue viennent de Plans d'Apple, qui reçoit la zone affichée. La position de l'appareil n'est utilisée que si vous touchez le bouton de localisation, pour centrer la carte ; elle n'est ni conservée ni transmise à Vrai-Prix."),266 ("Photos des annonces", "Les photos des propriétés à vendre sont chargées depuis les sites qui les publient ; ces sites voient alors la demande d'image, comme pour une page web."),267 ("Renseignements des propriétaires", "Les rôles d'évaluation publiés en données ouvertes ne contiennent pas le nom des propriétaires. Vrai-Prix n'en affiche aucun."),268 ("Contact", "Pour toute question ou demande de correction : contact@spboucher.ai."),269 ]270 case .terms: [271 ("Nature de l'information", "Les estimations sont des mesures statistiques fournies à titre indicatif. Elles ne constituent ni une évaluation au sens de la Loi sur les évaluateurs agréés, ni un avis financier, juridique ou fiscal."),272 ("Exactitude", "Les données proviennent de sources publiques (rôles d'évaluation, transactions publiées, annonces). Elles peuvent contenir des erreurs ou des retards. Vérifiez toute information importante auprès de la source ou d'un professionnel."),273 ("Usage", "L'app sert à la consultation personnelle. L'extraction automatisée du service est interdite."),274 ("Annonces de tiers", "Les annonces de propriétés à vendre appartiennent à leurs auteurs. Vrai-Prix les relie à leur page d'origine et n'intervient dans aucune transaction."),275 ("Responsabilité", "L'app est fournie telle quelle, sans garantie. Aucune décision d'achat, de vente ou de financement ne devrait reposer sur une estimation seule."),276 ("Contact", "contact@spboucher.ai."),277 ]278 }279 }280281 var body: some View {282 ScrollView {283 VStack(alignment: .leading, spacing: 0) {284 ForEach(sections, id: \.0) { t, body in285 Text(t).font(.editorial(19)).foregroundStyle(Theme.ink).padding(.top, 24).accessibilityAddTraits(.isHeader)286 Text(body).font(.subheadline).foregroundStyle(Theme.ink2).lineSpacing(2).fixedSize(horizontal: false, vertical: true).padding(.top, 6)287 }288 Text("En vigueur le 26 novembre 2026.").font(.footnote).foregroundStyle(Theme.ink3).padding(.top, 26)289 }290 .pageColumn()291 .padding(.bottom, 36)292 }293 .background(Theme.bg)294 .navigationTitle(kind == .privacy ? "Confidentialité" : "Conditions d'utilisation")295 .navigationBarTitleDisplayMode(.inline)296 }297}298