Repository Public
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : Vrai-Prix iOS9// File : VraiPrix/App/VraiPrixApp.swift10// Description : point d'entrée de l'application.11// Module : VraiPrix12// Repository : https://git.spboucher.ai/vrai-prix-ios-v313// Project Website : https://www.vrai-prix.com14// Created : 2026-11-2615// Last Modified : 2026-11-2816//17// =============================================================================18// AUTHOR & PROFESSIONAL AFFILIATION19// =============================================================================20//21// Author : Simon-Pierre Boucher22// Position : Professor of Finance23// Institution : Université du Québec en Outaouais (UQO)24// Department : Département des sciences administratives25// Organization : SP Boucher26//27// Website : https://spboucher.ai28// Git : https://git.spboucher.ai29//30// =============================================================================31// OFFICIAL CONTACT DIRECTORY32// =============================================================================33//34// General : info@spboucher.ai35// Professional : contact@spboucher.ai36// Direct : simon@spboucher.ai37// Research : research@spboucher.ai38// Development : dev@spboucher.ai39// Support : support@spboucher.ai40// Security/Admin : admin@spboucher.ai41// Notifications : notifications@spboucher.ai42//43// Preferred Contact: support@spboucher.ai44//45// =============================================================================46// COPYRIGHT & INTELLECTUAL PROPERTY47// =============================================================================48//49// Copyright (c) 202650// Simon-Pierre Boucher51//52// All rights reserved where applicable.53//54// This file is governed by the applicable project license,55// copyright notices, institutional agreements and relevant law.56//57// Unless expressly authorized by the applicable license or58// rights holder, copying, redistribution, sublicensing,59// publication and commercial exploitation are not permitted.60//61// Existing third-party rights and notices remain unaffected.62//63// =============================================================================64// CONFIDENTIALITY & SECURITY65// =============================================================================66//67// Classification : Public68// Distribution : Public repository; use is governed by the project license69// Security Contact : admin@spboucher.ai70//71// Access to this source does not independently grant permission72// to redistribute or disclose confidential materials.73//74// Do not embed credentials, private keys, access tokens,75// certificates or confidential personal information.76//77// =============================================================================78// LICENSE & MAINTENANCE79// =============================================================================80//81// License : None specified (no license file in this repository)82// Maintainer : Simon-Pierre Boucher83// Technical Contact: dev@spboucher.ai84//85// =============================================================================86// END OF SP BOUCHER SOURCE HEADER87// =============================================================================8889import CoreSpotlight90import SwiftUI91import UIKit9293@main94struct VraiPrixApp: App {95 @State private var motion: MotionCenter96 @State private var model: AppModel97 @State private var library = Library(inMemory: UserDefaults.standard.bool(forKey: "VPInMemory"))9899 init() {100 let m = MotionCenter()101 _motion = State(initialValue: m)102 _model = State(initialValue: AppModel(motion: m))103 // grands titres de navigation en New York (serif, graisse 500), comme les titres éditoriaux de l'app104 if let d = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .largeTitle).withDesign(.serif) {105 let medium = d.addingAttributes([.traits: [UIFontDescriptor.TraitKey.weight: UIFont.Weight.medium]])106 UINavigationBar.appearance().largeTitleTextAttributes = [.font: UIFont(descriptor: medium, size: 0)]107 }108 if let d = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .headline).withDesign(.serif) {109 let medium = d.addingAttributes([.traits: [UIFontDescriptor.TraitKey.weight: UIFont.Weight.medium]])110 UINavigationBar.appearance().titleTextAttributes = [.font: UIFont(descriptor: medium, size: 0)]111 }112 }113114 var body: some Scene {115 WindowGroup {116 RootView()117 .environment(model)118 .environment(library)119 .environment(motion)120 .preferredColorScheme(model.appearance.scheme)121 .tint(Theme.brand)122 .onOpenURL { model.handle(url: $0) }123 // liens universels de www.vrai-prix.com (/estimation/*, /a-vendre/*, /municipalite/*)124 .onContinueUserActivity(NSUserActivityTypeBrowsingWeb) { activity in125 if let url = activity.webpageURL { model.handle(url: url) }126 }127 .onContinueUserActivity(CSSearchableItemActionType) { activity in128 if let url = SpotlightIndex.url(from: activity) { model.handle(url: url) }129 }130 .onContinueUserActivity(Handoff.propertyActivity) { a in if let u = a.webpageURL { model.handle(url: u) } }131 .onContinueUserActivity(Handoff.listingActivity) { a in if let u = a.webpageURL { model.handle(url: u) } }132 .task {133 IntentRouter.shared.attach { model.handle(url: $0) }134 ResponseCache.prune()135 #if DEBUG136 // jeu d'essai pour les tests et captures : -VPSeed id1,id2 (favoris + comparateur)137 if let seed = UserDefaults.standard.string(forKey: "VPSeed") {138 for id in seed.split(separator: ",").map(String.init) {139 let saved: SavedProperty?140 if ServiceLevel.current == .v3 { saved = (try? await APIClient.shared.v3Property(id).value).map { SavedProperty(v3: $0) } }141 else { saved = (try? await APIClient.shared.unit(id).value).flatMap { SavedProperty(unit: $0) } }142 guard let s = saved else { continue }143 if !library.isFavorite(s.id) { library.toggleFavorite(s) }144 if !library.isCompared(s.id) { library.toggleCompare(s) }145 library.visit(s)146 }147 }148 #endif149 }150 }151 }152}153