Repository Public
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : Lou-Ka iOS9// File : LouKa/Features/Account/AccountView.swift10// Description : « Mon compte » — nom, courriel, synchronisation, mot de11// passe, appareils connectés, déconnexion, suppression du12// compte (mot de passe et confirmation). Lignes d'entrée du13// compte pour les Réglages et les Favoris.14// Module : LouKa15// Repository : https://git.spboucher.ai/lou-ka-ios-v316// Project Website : https://www.lou-ka.com17// Created : 2026-11-3018// Last Modified : 2026-11-3019//20// =============================================================================21// AUTHOR & PROFESSIONAL AFFILIATION22// =============================================================================23//24// Author : Simon-Pierre Boucher25// Position : Professor of Finance26// Institution : Université du Québec en Outaouais (UQO)27// Department : Département des sciences administratives28// Organization : SP Boucher29//30// Website : https://spboucher.ai31// Git : https://git.spboucher.ai32//33// =============================================================================34// OFFICIAL CONTACT DIRECTORY35// =============================================================================36//37// General : info@spboucher.ai38// Professional : contact@spboucher.ai39// Direct : simon@spboucher.ai40// Research : research@spboucher.ai41// Development : dev@spboucher.ai42// Support : support@spboucher.ai43// Security/Admin : admin@spboucher.ai44// Notifications : notifications@spboucher.ai45//46// Preferred Contact: support@spboucher.ai47//48// =============================================================================49// COPYRIGHT & INTELLECTUAL PROPERTY50// =============================================================================51//52// Copyright (c) 202653// Simon-Pierre Boucher54//55// All rights reserved where applicable.56//57// This file is governed by the applicable project license,58// copyright notices, institutional agreements and relevant law.59//60// Unless expressly authorized by the applicable license or61// rights holder, copying, redistribution, sublicensing,62// publication and commercial exploitation are not permitted.63//64// Existing third-party rights and notices remain unaffected.65//66// =============================================================================67// CONFIDENTIALITY & SECURITY68// =============================================================================69//70// Classification : Public71// Distribution : Public repository; use is governed by the project license72// Security Contact : admin@spboucher.ai73//74// Access to this source does not independently grant permission75// to redistribute or disclose confidential materials.76//77// Do not embed credentials, private keys, access tokens,78// certificates or confidential personal information.79//80// =============================================================================81// LICENSE & MAINTENANCE82// =============================================================================83//84// License : None specified (no license file in this repository)85// Maintainer : Simon-Pierre Boucher86// Technical Contact: dev@spboucher.ai87//88// =============================================================================89// END OF SP BOUCHER SOURCE HEADER90// =============================================================================9192import SwiftUI9394enum AccountSupport {95 static let email = "support@lou-ka.com"96 static var mailto: URL? { URL(string: "mailto:\(email)") }97}9899struct AccountView: View {100 @Environment(Account.self) private var account101 @Environment(AppModel.self) private var app102 @Environment(Library.self) private var library103 @Environment(\.dismiss) private var dismiss104105 @State private var name = ""106 @State private var savingName = false107 @State private var devices: [DeviceSession]?108 @State private var devicesError: String?109 @State private var failure: String?110 @State private var changingPassword = false111 @State private var deleting = false112 @State private var confirmSignOut = false113 @State private var confirmOthers = false114 @State private var busy = false115 #if DEBUG116 @State private var didAutoOpen = false117 #endif118119 var body: some View {120 Group {121 if let user = account.user {122 form(user)123 } else {124 // session fermée pendant que l'écran était ouvert125 EmptyStateView(door: .ajar, title: "Vous n'êtes pas connecté",126 message: "Vos favoris restent sur cet appareil.",127 actionTitle: "Se connecter") { dismiss(); app.accountSheet = true }128 .frame(maxWidth: .infinity, maxHeight: .infinity).background(Theme.bg)129 }130 }131 .navigationTitle("Mon compte")132 .navigationBarTitleDisplayMode(.inline)133 .sheet(isPresented: $changingPassword) { ChangePasswordSheet() }134 .sheet(isPresented: $deleting) { DeleteAccountSheet { dismiss() } }135 .task {136 name = account.user?.name ?? ""137 await account.refresh()138 name = account.user?.name ?? name139 await loadDevices()140 #if DEBUG141 // -LKAccountPanel password|delete : ouvre une feuille au lancement (captures d'écran)142 if !didAutoOpen {143 didAutoOpen = true144 switch UserDefaults.standard.string(forKey: "LKAccountPanel") {145 case "password": changingPassword = true146 case "delete": deleting = true147 default: break148 }149 }150 #endif151 }152 }153154 private func form(_ user: AccountUser) -> some View {155 Form {156 if let failure {157 Section { Label(failure, systemImage: "exclamationmark.triangle").font(.subheadline).foregroundStyle(Theme.bad).accessibilityIdentifier("account.error") }158 }159 Section {160 HStack {161 TextField("Nom", text: $name)162 .textContentType(AutoFill.type(.name))163 .textInputAutocapitalization(.words)164 .submitLabel(.done)165 .onSubmit(saveName)166 .accessibilityLabel("Nom")167 .accessibilityIdentifier("account.name")168 if name.trimmingCharacters(in: .whitespaces) != user.name {169 Button("Enregistrer", action: saveName).font(.subheadline.weight(.semibold)).disabled(savingName)170 .accessibilityIdentifier("account.name.save")171 }172 }173 if user.isPhoneAccount {174 LabeledContent("Cellulaire") { Text(verbatim: user.contact).foregroundStyle(Theme.ink2).textSelection(.enabled) }175 .accessibilityIdentifier("account.phone.value")176 } else if !user.contact.isEmpty {177 LabeledContent("Courriel") { Text(verbatim: user.contact).foregroundStyle(Theme.ink2).textSelection(.enabled) }178 .accessibilityIdentifier("account.email.value")179 }180 } header: {181 Text("Profil")182 } footer: {183 if user.isPhoneAccount {184 Text("Ce compte est lié à votre numéro de cellulaire. Vous ne recevez pas de courriels de Lou-Ka : les nouveaux messages s'affichent dans l'application.")185 .accessibilityIdentifier("account.phone.note")186 }187 }188189 if let access = user.manager, user.isManager { managerSection(user, access) }190191 Section {192 NavigationLink(value: Route.messages) { MessagesEntryRow() }193 .accessibilityIdentifier("account.messages")194 } footer: {195 Text(user.isManager ? "Boîte partagée de votre entreprise : les messages des chercheurs de logement."196 : user.isPhoneAccount ? "Vos conversations avec les gestionnaires vérifiés. Votre numéro ne leur est jamais transmis."197 : "Vos conversations avec les gestionnaires vérifiés. Votre adresse courriel ne leur est jamais transmise.")198 }199200 if !user.isManager {201 Section {202 LabeledContent("Favoris", value: Fmt.int(library.favoriteIDs.count))203 LabeledContent("Dernière synchronisation") {204 if account.sync.syncing { ProgressView() } else {205 Text(account.sync.lastSync.map { $0.formatted(.relative(presentation: .named).locale(Fmt.locale)) } ?? "pas encore")206 .foregroundStyle(Theme.ink2)207 }208 }209 if let e = account.sync.lastError {210 Label(e, systemImage: "wifi.exclamationmark").font(.footnote).foregroundStyle(Theme.high)211 }212 Button("Synchroniser maintenant") { Task { await account.sync.sync() } }213 .disabled(account.sync.syncing)214 .accessibilityIdentifier("account.sync")215 } header: {216 Text("Synchronisation")217 } footer: {218 Text("Vos favoris, leurs notes et vos recherches enregistrées sont gardés dans votre compte et retrouvés sur le site et sur vos autres appareils. Le comparateur, l'historique de consultation et vos réglages restent sur cet appareil.")219 }220 }221222 Section("Sécurité") {223 Button { changingPassword = true } label: {224 HStack { Label("Changer de mot de passe", systemImage: "key").foregroundStyle(Theme.ink); Spacer(); Image(systemName: "chevron.right").font(.footnote.weight(.semibold)).foregroundStyle(Theme.ink3) }225 }226 .accessibilityIdentifier("account.changePassword")227 }228229 Section {230 if let devices {231 ForEach(devices) { d in232 HStack(spacing: 12) {233 Image(systemName: d.client == "web" ? "globe" : d.client == "android" ? "candybarphone" : "iphone")234 .foregroundStyle(Theme.ink2).frame(width: 26).accessibilityHidden(true)235 VStack(alignment: .leading, spacing: 2) {236 Text(d.current ? "\(d.clientLabel) · cet appareil" : d.clientLabel).font(.subheadline.weight(.medium)).foregroundStyle(Theme.ink)237 Text(deviceCaption(d)).font(.caption).foregroundStyle(Theme.ink3)238 }239 Spacer()240 if !d.current {241 Button("Déconnecter") { revoke(d) }.font(.subheadline).buttonStyle(.borderless).disabled(busy)242 .accessibilityLabel("Déconnecter \(d.clientLabel)")243 }244 }245 .accessibilityElement(children: .combine)246 }247 if devices.contains(where: { !$0.current }) {248 Button("Déconnecter les autres appareils") { confirmOthers = true }249 .disabled(busy)250 .accessibilityIdentifier("account.signOutOthers")251 }252 } else if let devicesError {253 Label(devicesError, systemImage: "wifi.exclamationmark").font(.footnote).foregroundStyle(Theme.ink3)254 Button("Réessayer") { Task { await loadDevices() } }255 } else {256 ProgressView()257 }258 } header: {259 Text("Appareils connectés")260 }261 .confirmationDialog("Déconnecter les autres appareils ?", isPresented: $confirmOthers, titleVisibility: .visible) {262 Button("Déconnecter les autres", role: .destructive) { signOutOthers() }263 Button("Annuler", role: .cancel) {}264 } message: {265 Text("Seul cet appareil restera connecté à votre compte.")266 }267268 Section {269 Button("Se déconnecter") { confirmSignOut = true }270 .disabled(busy)271 .accessibilityIdentifier("account.signOut")272 } footer: {273 Text("Vos favoris, vos notes et vos recherches restent sur cet appareil après la déconnexion.")274 }275 .confirmationDialog("Se déconnecter ?", isPresented: $confirmSignOut, titleVisibility: .visible) {276 Button("Se déconnecter") { signOut() }.accessibilityIdentifier("account.signOut.confirm")277 Button("Annuler", role: .cancel) {}278 } message: {279 Text("Vos favoris restent sur cet appareil ; ils ne seront plus synchronisés.")280 }281282 Section {283 Button("Supprimer mon compte", role: .destructive) { deleting = true }284 .accessibilityIdentifier("account.delete")285 } footer: {286 Text("Efface définitivement votre compte et tout ce qu'il contient sur nos serveurs. Besoin d'aide ? Écrivez à \(AccountSupport.email).")287 }288289 if let mail = AccountSupport.mailto {290 Section("Aide") {291 Link(destination: mail) { Label(AccountSupport.email, systemImage: "envelope") }292 NavigationLink(value: Route.privacy) { Label("Confidentialité", systemImage: "hand.raised") }293 }294 }295 }296 }297298 /// Compte de gestionnaire : état de l'accès, motif transmis, renvoi vers le site pour le portail.299 @ViewBuilder300 private func managerSection(_ user: AccountUser, _ access: ManagerAccess) -> some View {301 Section {302 if let company = access.company, !company.isEmpty {303 LabeledContent("Entreprise") { Text(verbatim: company).foregroundStyle(Theme.ink2) }304 }305 let state = access.state306 Label {307 Text(state == .approved ? "Accès approuvé" : state == .refused ? "Demande refusée" : state == .suspended ? "Accès suspendu" : "Demande en attente de validation")308 .foregroundStyle(Theme.ink)309 } icon: {310 Image(systemName: state == .approved ? "checkmark.seal.fill" : state == .pending ? "hourglass" : "xmark.octagon")311 .foregroundStyle(state == .approved ? Theme.brand : state == .pending ? Theme.high : Theme.bad)312 }313 .accessibilityIdentifier("account.manager.state")314 if state != .approved, let reason = access.reason, !reason.isEmpty {315 VStack(alignment: .leading, spacing: 3) {316 Text("Motif transmis").font(.caption).foregroundStyle(Theme.ink3)317 Text(verbatim: reason).font(.subheadline).foregroundStyle(Theme.ink).fixedSize(horizontal: false, vertical: true)318 }319 .accessibilityElement(children: .combine)320 }321 if let pro = URL(string: Account.baseURL().absoluteString.trimmingCharacters(in: CharacterSet(charactersIn: "/")) + "/pro") {322 Link(destination: pro) { Label("Ouvrir le portail sur le site", systemImage: "safari") }323 }324 } header: {325 Text("Accès de gestionnaire")326 } footer: {327 Text(access.state == .pending ? "Votre adresse est confirmée. L'équipe de Lou-Ka valide chaque demande à la main ; vous recevrez un courriel. L'éditeur de fiche, l'inventaire et le tableau de bord sont sur le site, à lou-ka.com/pro."328 : access.state == .approved ? "L'éditeur de fiche, l'inventaire et le tableau de bord sont sur le site, à lou-ka.com/pro. Dans l'app, vous pouvez lire les messages reçus et y répondre."329 : "Pour toute question sur cette décision : \(AccountSupport.email).")330 }331 }332333 private func deviceCaption(_ d: DeviceSession) -> String {334 var parts: [String] = []335 if let seen = d.seenAt ?? d.createdAt {336 parts.append("actif \(Date(timeIntervalSince1970: seen).formatted(.relative(presentation: .named).locale(Fmt.locale)))")337 }338 if let created = d.createdAt {339 parts.append("connecté le \(Date(timeIntervalSince1970: created).formatted(.dateTime.day().month().locale(Fmt.locale)))")340 }341 return parts.joined(separator: " · ")342 }343344 private func loadDevices() async {345 guard account.isSignedIn else { return }346 do { devices = try await account.devices(); devicesError = nil } catch {347 if devices == nil { devicesError = AccountFailure(error).message }348 }349 }350351 private func saveName() {352 guard let user = account.user, name.trimmingCharacters(in: .whitespaces) != user.name, !savingName else { return }353 savingName = true; failure = nil354 Task {355 defer { savingName = false }356 do { try await account.rename(name); name = account.user?.name ?? name; app.showToast("Nom enregistré") } catch { failure = AccountFailure(error).message }357 }358 }359360 private func revoke(_ d: DeviceSession) {361 busy = true; failure = nil362 Task {363 defer { busy = false }364 do { try await account.revoke(d); await loadDevices() } catch { failure = AccountFailure(error).message }365 }366 }367368 private func signOutOthers() {369 busy = true; failure = nil370 Task {371 defer { busy = false }372 do {373 let n = try await account.signOutEverywhereElse()374 app.showToast(n == 0 ? "Aucun autre appareil connecté" : Fmt.plural(n, "appareil déconnecté", "appareils déconnectés"))375 await loadDevices()376 } catch { failure = AccountFailure(error).message }377 }378 }379380 private func signOut() {381 busy = true382 Task {383 await account.signOut()384 busy = false385 app.showToast("Vous êtes déconnecté. Vos favoris restent sur cet appareil.")386 dismiss()387 }388 }389}390391// MARK: - Changer de mot de passe392393private struct ChangePasswordSheet: View {394 @Environment(Account.self) private var account395 @Environment(AppModel.self) private var app396 @Environment(\.dismiss) private var dismiss397 @State private var current = ""398 @State private var new = ""399 @State private var busy = false400 @State private var failure: AccountFailure?401402 var body: some View {403 NavigationStack {404 ScrollView {405 VStack(alignment: .leading, spacing: 20) {406 Text("Vos autres appareils seront déconnectés ; celui-ci reste connecté.")407 .font(.subheadline).foregroundStyle(Theme.ink2).fixedSize(horizontal: false, vertical: true)408 if let m = failure?.general(fields: ["current_password", "new_password", "password"]) { AccountBanner(text: m) }409 // courriel présent pour que le trousseau associe le nouveau mot de passe au bon compte410 if let contact = account.user?.contact, !contact.isEmpty {411 TextField("", text: .constant(contact)).textContentType(AutoFill.type(.username)).frame(width: 0, height: 0).opacity(0).accessibilityHidden(true)412 }413 PasswordInput(label: "Mot de passe actuel", text: $current, contentType: .password,414 error: failure?.on("current_password"), identifier: "account.currentPassword")415 PasswordInput(label: "Nouveau mot de passe", text: $new, contentType: .newPassword, hint: "Au moins \(Account.passwordMin) caractères.",416 error: failure?.on("new_password") ?? failure?.on("password"), identifier: "account.newPassword", onSubmit: submit)417 AccountSubmit(title: "Changer le mot de passe", busy: busy, enabled: !current.isEmpty && !new.isEmpty, action: submit)418 }419 .padding(24)420 .frame(maxWidth: 480, alignment: .leading).frame(maxWidth: .infinity)421 }422 .background(Theme.bg)423 .navigationTitle("Mot de passe")424 .navigationBarTitleDisplayMode(.inline)425 .toolbar { ToolbarItem(placement: .cancellationAction) { Button("Annuler") { dismiss() } } }426 }427 .tint(Theme.brand)428 }429430 private func submit() {431 guard !busy else { return }432 guard new.count >= Account.passwordMin else {433 failure = AccountFailure(message: "Le mot de passe doit compter au moins \(Account.passwordMin) caractères.", param: "new_password"); return434 }435 failure = nil; busy = true436 Task {437 defer { busy = false }438 do {439 try await account.changePassword(current: current, new: new)440 dismiss()441 app.showToast("Mot de passe changé")442 } catch {443 var f = AccountFailure(error)444 if f.code == "mot_de_passe_incorrect" { f.param = "current_password" }445 failure = f446 if !account.isSignedIn { dismiss() }447 }448 }449 }450}451452// MARK: - Supprimer le compte453454private struct DeleteAccountSheet: View {455 var onDeleted: () -> Void456 @Environment(Account.self) private var account457 @Environment(AppModel.self) private var app458 @Environment(\.dismiss) private var dismiss459 @State private var password = ""460 @State private var busy = false461 @State private var confirm = false462 @State private var failure: AccountFailure?463464 var body: some View {465 NavigationStack {466 ScrollView {467 VStack(alignment: .leading, spacing: 20) {468 VStack(alignment: .leading, spacing: 10) {469 Text("Supprimer votre compte").font(.editorial(26)).foregroundStyle(Theme.ink).accessibilityAddTraits(.isHeader)470 Text("La suppression est définitive et immédiate.").font(.subheadline.weight(.semibold)).foregroundStyle(Theme.ink)471 }472 VStack(alignment: .leading, spacing: 10) {473 bullet("minus.circle", "Votre compte, votre courriel et votre nom sont effacés de nos serveurs.")474 bullet("minus.circle", "Les favoris, notes et recherches gardés dans le compte sont effacés ; ils disparaîtront du site et de vos autres appareils connectés.")475 bullet("iphone", "Ce qui se trouve sur cet appareil y reste : vous pourrez continuer d'utiliser Lou-Ka sans compte.")476 }477 .padding(14)478 .background(Theme.surface2, in: RoundedRectangle(cornerRadius: Theme.radius, style: .continuous))479 if let m = failure?.general(fields: ["password"]) { AccountBanner(text: m) }480 PasswordInput(label: "Confirmez avec votre mot de passe", text: $password, contentType: .password,481 error: failure?.on("password"), identifier: "account.delete.password", onSubmit: { if !password.isEmpty { confirm = true } })482 AccountSubmit(title: "Supprimer définitivement mon compte", busy: busy, enabled: !password.isEmpty, destructive: true,483 identifier: "account.delete.submit") { confirm = true }484 Text("Mot de passe oublié ou besoin d'aide ? Écrivez à \(AccountSupport.email).")485 .font(.footnote).foregroundStyle(Theme.ink3).fixedSize(horizontal: false, vertical: true)486 }487 .padding(24)488 .frame(maxWidth: 480, alignment: .leading).frame(maxWidth: .infinity)489 }490 .background(Theme.bg)491 .navigationTitle("Suppression")492 .navigationBarTitleDisplayMode(.inline)493 .toolbar { ToolbarItem(placement: .cancellationAction) { Button("Annuler") { dismiss() } } }494 .confirmationDialog("Supprimer votre compte pour de bon ?", isPresented: $confirm, titleVisibility: .visible) {495 Button("Supprimer mon compte", role: .destructive) { submit() }.accessibilityIdentifier("account.delete.confirm")496 Button("Annuler", role: .cancel) {}497 } message: {498 Text("Cette action ne peut pas être annulée.")499 }500 }501 .tint(Theme.brand)502 }503504 private func bullet(_ icon: String, _ text: String) -> some View {505 HStack(alignment: .firstTextBaseline, spacing: 10) {506 Image(systemName: icon).font(.footnote).foregroundStyle(Theme.ink3).frame(width: 18).accessibilityHidden(true)507 Text(text).font(.subheadline).foregroundStyle(Theme.ink2).fixedSize(horizontal: false, vertical: true)508 }509 }510511 private func submit() {512 guard !busy, !password.isEmpty else { return }513 failure = nil; busy = true514 Task {515 defer { busy = false }516 do {517 try await account.deleteAccount(password: password)518 dismiss()519 onDeleted()520 app.showToast("Compte supprimé. Vos favoris restent sur cet appareil.")521 } catch {522 var f = AccountFailure(error)523 if f.code == "mot_de_passe_incorrect" { f.param = "password" }524 failure = f525 if !account.isSignedIn { dismiss() }526 }527 }528 }529}530531// MARK: - Lignes d'entrée (Réglages, Favoris)532533/// Section « Compte » des Réglages : état du compte, ou invitation à se connecter.534struct AccountSettingsSection: View {535 @Environment(Account.self) private var account536 @Environment(AppModel.self) private var app537538 var body: some View {539 Section {540 if let user = account.user {541 NavigationLink(value: Route.account) {542 HStack(spacing: 12) {543 Image(systemName: "person.crop.circle").font(.title2).foregroundStyle(Theme.brand).accessibilityHidden(true)544 VStack(alignment: .leading, spacing: 2) {545 Text(user.displayName).font(.body.weight(.medium)).foregroundStyle(Theme.ink).lineLimit(1)546 Text(verbatim: user.name.isEmpty || user.contact.isEmpty ? "Favoris synchronisés" : user.contact).font(.footnote).foregroundStyle(Theme.ink3).lineLimit(1)547 }548 }549 }550 .accessibilityIdentifier("settings.account")551 NavigationLink(value: Route.messages) { MessagesEntryRow() }552 .accessibilityIdentifier("settings.messages")553 } else {554 Button { app.accountSheet = true } label: {555 HStack(spacing: 12) {556 Image(systemName: "person.crop.circle").font(.title2).foregroundStyle(Theme.brand).accessibilityHidden(true)557 Text("Se connecter ou créer un compte").foregroundStyle(Theme.ink)558 Spacer()559 Image(systemName: "chevron.right").font(.footnote.weight(.semibold)).foregroundStyle(Theme.ink3).accessibilityHidden(true)560 }561 }562 .accessibilityIdentifier("settings.account")563 }564 } header: {565 Text("Compte")566 } footer: {567 Text(account.user?.isManager == true ? "Compte de gestionnaire : la boîte de messages de votre entreprise est ici ; le portail est sur le site."568 : account.isSignedIn ? "Vos favoris, vos notes et vos recherches enregistrées sont synchronisés avec votre compte."569 : "Facultatif. Un compte sert à retrouver vos favoris, vos notes et vos recherches sur tous vos appareils.")570 }571 }572}573574/// Bas de l'onglet Favoris : invitation discrète quand on n'est pas connecté, état de la synchronisation sinon.575struct FavoritesAccountNote: View {576 @Environment(Account.self) private var account577 @Environment(AppModel.self) private var app578579 var body: some View {580 if let user = account.user {581 VStack(alignment: .leading, spacing: 10) {582 Button { app.open(.messages) } label: {583 HStack(spacing: 8) {584 MessagesEntryRow().font(.subheadline)585 Image(systemName: "chevron.right").font(.footnote.weight(.semibold)).foregroundStyle(Theme.ink3).accessibilityHidden(true)586 }587 .padding(.vertical, 12)588 .contentShape(Rectangle())589 }590 .buttonStyle(.plain)591 .overlay(alignment: .top) { Divider().overlay(Theme.line) }592 .overlay(alignment: .bottom) { Divider().overlay(Theme.line) }593 .accessibilityIdentifier("favorites.messages")594 Button { app.open(.account) } label: {595 Label {596 Text(user.isManager ? "Compte de gestionnaire : vos favoris restent sur cet appareil."597 : account.sync.lastError == nil ? "Synchronisés avec votre compte\(user.contact.isEmpty ? "" : " (\(user.contact))")."598 : "Synchronisation en attente : elle reprendra au retour du réseau.")599 .multilineTextAlignment(.leading)600 } icon: {601 Image(systemName: user.isManager ? "building.2" : account.sync.lastError == nil ? "arrow.triangle.2.circlepath" : "wifi.exclamationmark")602 }603 .font(.caption).foregroundStyle(Theme.ink3)604 }605 .buttonStyle(.plain)606 .accessibilityHint("Ouvre Mon compte")607 .accessibilityIdentifier("favorites.account")608 }609 } else {610 VStack(alignment: .leading, spacing: 10) {611 Button { app.accountSheet = true } label: {612 HStack(spacing: 12) {613 Image(systemName: "person.crop.circle").font(.title3).foregroundStyle(Theme.brand).accessibilityHidden(true)614 Text("Connectez-vous pour retrouver vos favoris sur tous vos appareils")615 .font(.subheadline).foregroundStyle(Theme.ink).multilineTextAlignment(.leading)616 .fixedSize(horizontal: false, vertical: true)617 Spacer(minLength: 8)618 Image(systemName: "chevron.right").font(.footnote.weight(.semibold)).foregroundStyle(Theme.ink3).accessibilityHidden(true)619 }620 .padding(.vertical, 12)621 .contentShape(Rectangle())622 }623 .buttonStyle(.plain)624 .overlay(alignment: .top) { Divider().overlay(Theme.line) }625 .overlay(alignment: .bottom) { Divider().overlay(Theme.line) }626 .accessibilityIdentifier("favorites.signIn")627 Label("Sans compte, rien ne quitte votre appareil : favoris, notes et recherches y sont enregistrés.", systemImage: "lock.shield")628 .font(.caption).foregroundStyle(Theme.ink3)629 }630 }631 }632}633