Repository Public BSD-3-Clause
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : ORIX Maps9// File : Apps/ORIXMaps/Sources/App/LaunchOptions.swift10// Module : App11// Repository : https://git.spboucher.ai/orix-maps12// Created : 2026-11-2513// Last Modified : 2026-11-2514//15// =============================================================================16// AUTHOR & PROFESSIONAL AFFILIATION17// =============================================================================18//19// Author : Simon-Pierre Boucher20// Position : Professor of Finance21// Institution : Université du Québec en Outaouais (UQO)22// Department : Département des sciences administratives23// Organization : SP Boucher24//25// Website : https://spboucher.ai26// Git : https://git.spboucher.ai27//28// =============================================================================29// OFFICIAL CONTACT DIRECTORY30// =============================================================================31//32// General : info@spboucher.ai33// Professional : contact@spboucher.ai34// Direct : simon@spboucher.ai35// Research : research@spboucher.ai36// Development : dev@spboucher.ai37// Support : support@spboucher.ai38// Security/Admin : admin@spboucher.ai39// Notifications : notifications@spboucher.ai40//41// Preferred Contact: support@spboucher.ai42//43// =============================================================================44// COPYRIGHT & INTELLECTUAL PROPERTY45// =============================================================================46//47// Copyright (c) 202648// Simon-Pierre Boucher49//50// All rights reserved where applicable.51//52// This file is governed by the applicable project license,53// copyright notices, institutional agreements and relevant law.54//55// Unless expressly authorized by the applicable license or56// rights holder, copying, redistribution, sublicensing,57// publication and commercial exploitation are not permitted.58//59// Existing third-party rights and notices remain unaffected.60//61// =============================================================================62// CONFIDENTIALITY & SECURITY63// =============================================================================64//65// Classification : Public66// Distribution : Public repository; use is governed by the project license67// Security Contact : admin@spboucher.ai68//69// Access to this source does not independently grant permission70// to redistribute or disclose confidential materials.71//72// Do not embed credentials, private keys, access tokens,73// certificates or confidential personal information.74//75// =============================================================================76// LICENSE & MAINTENANCE77// =============================================================================78//79// License : Proprietary, all rights reserved (see license file)80// License File : LICENSE81// Maintainer : Simon-Pierre Boucher82// Technical Contact: dev@spboucher.ai83//84// =============================================================================85// END OF SP BOUCHER SOURCE HEADER86// =============================================================================8788import Foundation89import ORIXGeoCore90import ORIXMapRenderer9192/// Launch arguments used by tests, screenshots and development. They never change behaviour in normal use.93/// Pass them as `-Name value` (they are read through UserDefaults' argument domain).94struct LaunchOptions {95 /// Use an isolated, in-memory preferences domain and a temporary data directory.96 var isUITest: Bool97 /// Erase preferences and stored data before starting.98 var reset: Bool99 var skipOnboarding: Bool100 /// Path of a raw `.pmtiles` archive drawn as a region without installation (development only, DEBUG builds).101 var devRegionPath: String?102 /// Directory holding development region components (`map.pmtiles`, `search.sqlite`, `routing.orixgraph`), DEBUG builds.103 var devRegionDirectory: String?104 var themeID: String?105 var camera: MapCamera?106 /// Screen to open directly, for screenshots.107 var screen: String?108 /// Simulate the position along a route or GPX instead of using Core Location.109 var simulatePosition: Coordinate?110 /// Base URL of the map catalog (staging or a local test server).111 var catalogURL: URL?112 /// Region to download from the catalog right after launch (DEBUG builds; end-to-end tests and screenshots).113 var autoDownload: String?114 /// Plan a route between two coordinates right after launch, and optionally start a simulated drive (DEBUG builds).115 var routeFrom: Coordinate?116 var routeTo: Coordinate?117 var simulateDrive = false118 var travelMode: String?119 /// Run a search right after launch (DEBUG builds).120 var searchText: String?121 /// Feed Map Studio's theme import with a generated file when it opens: "valid" or "invalid" (DEBUG builds; the system122 /// document picker cannot be driven reliably by UI tests).123 var importThemeFixture: String?124125 init(defaults: UserDefaults = .standard) {126 isUITest = defaults.bool(forKey: "ORIXUITest")127 reset = defaults.bool(forKey: "ORIXReset")128 skipOnboarding = defaults.bool(forKey: "ORIXSkipOnboarding")129 #if DEBUG130 devRegionPath = defaults.string(forKey: "ORIXDevRegion")131 devRegionDirectory = defaults.string(forKey: "ORIXDevRegionDir")132 autoDownload = defaults.string(forKey: "ORIXAutoDownload")133 func coordinate(_ key: String) -> Coordinate? {134 let p = (defaults.string(forKey: key) ?? "").split(separator: ",").compactMap { Double($0) }135 return p.count == 2 ? Coordinate(latitude: p[0], longitude: p[1]) : nil136 }137 routeFrom = coordinate("ORIXRouteFrom")138 routeTo = coordinate("ORIXRouteTo")139 simulateDrive = defaults.bool(forKey: "ORIXSimulate")140 travelMode = defaults.string(forKey: "ORIXMode")141 searchText = defaults.string(forKey: "ORIXSearch")142 importThemeFixture = defaults.string(forKey: "ORIXImportTheme")143 #endif144 themeID = defaults.string(forKey: "ORIXTheme")145 screen = defaults.string(forKey: "ORIXScreen")146 if let text = defaults.string(forKey: "ORIXCamera") {147 let p = text.split(separator: ",").compactMap { Double($0) }148 if p.count >= 3 { camera = MapCamera(center: Coordinate(latitude: p[0], longitude: p[1]), zoom: p[2], bearing: p.count > 3 ? p[3] : 0, pitch: p.count > 4 ? p[4] : 0) }149 }150 if let text = defaults.string(forKey: "ORIXPosition") {151 let p = text.split(separator: ",").compactMap { Double($0) }152 if p.count == 2 { simulatePosition = Coordinate(latitude: p[0], longitude: p[1]) }153 }154 if let text = defaults.string(forKey: "ORIXCatalogURL") { catalogURL = URL(string: text) }155 }156}157