Repository Public MIT
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : ORIX Astra9// File : Packages/AstraUI/Sources/Onboarding/OnboardingView.swift10// Module : Onboarding11// Repository : https://git.spboucher.ai/orix-astra12// Created : 2026-11-2113// Last Modified : 2026-11-2114//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 SwiftUI89import AstraCore90import AstraDesign91import AstraLocal9293/// First launch: what the app is, what stays on the device, and a path to a first model that does not require any account.94struct OnboardingView: View {95 @Environment(AppModel.self) private var app96 @State private var page = 097 @Environment(\.accessibilityReduceMotion) private var reduceMotion9899 var body: some View {100 ZStack {101 Starfield(density: 1, twinkle: true)102 VStack(spacing: 0) {103 TabView(selection: $page) {104 welcome.tag(0)105 privacy.tag(1)106 firstModel.tag(2)107 }108 .tabViewStyle(.page(indexDisplayMode: .never))109 .animation(AstraMotion.resolve(AstraMotion.hero, reduceMotion: reduceMotion), value: page)110111 HStack(spacing: 6) {112 ForEach(0..<3, id: \.self) { i in113 Capsule().fill(i == page ? AnyShapeStyle(AstraColor.signatureHorizontal) : AnyShapeStyle(AstraColor.strokeStrong)).frame(width: i == page ? 22 : 7, height: 7)114 }115 }116 .animation(AstraMotion.resolve(AstraMotion.standard, reduceMotion: reduceMotion), value: page)117 .accessibilityElement().accessibilityLabel("Page \(page + 1) of 3")118 .padding(.bottom, 18)119120 VStack(spacing: 10) {121 Button(page < 2 ? "Continue" : "Start using ORIX Astra") {122 if page < 2 { page += 1 } else { Task { await app.finishOnboarding() } }123 }124 .buttonStyle(AstraPrimaryButtonStyle()).accessibilityIdentifier("onboarding-continue")125 if page < 2 {126 Button("Skip") { Task { await app.finishOnboarding() } }127 .font(AstraFont.subheadline).foregroundStyle(AstraColor.textSecondary).frame(minHeight: AstraSpace.hit)128 .accessibilityIdentifier("onboarding-skip")129 }130 }131 .padding(.horizontal, AstraSpace.xxl).padding(.bottom, 12)132 }133 }134 }135136 private var welcome: some View {137 VStack(spacing: 22) {138 Spacer()139 AstraGlyph().frame(width: 132, height: 132)140 VStack(spacing: 10) {141 Text("ORIX Astra").font(AstraFont.display).foregroundStyle(AstraColor.textPrimary)142 Text("Every Intelligence. One Universe.").font(AstraFont.title).foregroundStyle(AstraColor.signatureHorizontal).multilineTextAlignment(.center)143 }144 Text("Models that run on your iPhone and the cloud models you already use, in one native studio.")145 .font(AstraFont.callout).foregroundStyle(AstraColor.textSecondary).multilineTextAlignment(.center).padding(.horizontal, 36)146 Spacer(); Spacer()147 }148 .accessibilityElement(children: .combine)149 }150151 private var privacy: some View {152 VStack(alignment: .leading, spacing: 18) {153 Spacer()154 Text("Yours, on your device").font(AstraFont.display).foregroundStyle(AstraColor.textPrimary)155 point("iphone", "Local first", "Chats, files, prompts and settings are stored on this iPhone. There is no account and no ORIX server in between.")156 point("key.fill", "Your own keys", "Cloud models use API keys you provide. They are kept in the iOS Keychain and sent only to their own provider.")157 point("arrow.up.right.circle", "You decide what leaves", "A message to a cloud model goes to that provider under its terms. On-device models send nothing anywhere.")158 point("chart.bar.xaxis", "No analytics", "The app collects no usage data and contains no tracking.")159 Spacer(); Spacer()160 }161 .padding(.horizontal, AstraSpace.xxl)162 }163164 private func point(_ symbol: String, _ title: String, _ text: String) -> some View {165 HStack(alignment: .top, spacing: 14) {166 Image(systemName: symbol).font(.title3).foregroundStyle(AstraColor.signature).frame(width: 30)167 VStack(alignment: .leading, spacing: 3) {168 Text(title).font(AstraFont.headline).foregroundStyle(AstraColor.textPrimary)169 Text(text).font(AstraFont.subheadline).foregroundStyle(AstraColor.textSecondary).fixedSize(horizontal: false, vertical: true)170 }171 }172 .accessibilityElement(children: .combine)173 }174175 private var firstModel: some View {176 VStack(alignment: .leading, spacing: 16) {177 Spacer()178 Text("Your first model").font(AstraFont.display).foregroundStyle(AstraColor.textPrimary)179 Text("You can add or change this at any time in Models.").font(AstraFont.callout).foregroundStyle(AstraColor.textSecondary)180181 AstraCard {182 VStack(alignment: .leading, spacing: 8) {183 Label("On this iPhone", systemImage: "cpu").font(AstraFont.headline).foregroundStyle(AstraColor.textPrimary)184 if app.local.appleAvailability.isAvailable {185 Label("Apple Intelligence is ready: you can chat right now with no download.", systemImage: "checkmark.circle.fill")186 .font(AstraFont.subheadline).foregroundStyle(AstraColor.success)187 } else if let reason = app.local.appleAvailability.reason {188 Text("Apple Intelligence: \(reason)").font(AstraFont.footnote).foregroundStyle(AstraColor.textSecondary)189 }190 if let reason = app.local.mlxUnavailableReason {191 Text(reason).font(AstraFont.footnote).foregroundStyle(AstraColor.textSecondary)192 } else {193 Text("Download an open model (from about 0.3 GB) and run it offline with MLX. Sizes and memory needs are shown before anything downloads.")194 .font(AstraFont.subheadline).foregroundStyle(AstraColor.textSecondary).fixedSize(horizontal: false, vertical: true)195 }196 Button("Browse on-device models") { Task { app.tab = .models; await app.finishOnboarding() } }197 .buttonStyle(AstraSecondaryButtonStyle()).accessibilityIdentifier("onboarding-local")198 }199 }200 AstraCard {201 VStack(alignment: .leading, spacing: 8) {202 Label("In the cloud, optional", systemImage: "cloud").font(AstraFont.headline).foregroundStyle(AstraColor.textPrimary)203 HStack(spacing: 8) { ForEach(ProviderKind.cloudKeyed) { ProviderLogo(provider: $0, size: 30) } }204 Text("Connect OpenAI, Anthropic, Google Gemini, xAI or OpenRouter with your own key, or add your own compatible server.")205 .font(AstraFont.subheadline).foregroundStyle(AstraColor.textSecondary).fixedSize(horizontal: false, vertical: true)206 }207 }208 Spacer()209 }210 .padding(.horizontal, AstraSpace.xxl)211 }212}213