Repository Public
1<!--2SP Drive iOS3File: docs/next/PHASE1-iOS.md4Author: Simon-Pierre Boucher5Contact: contact@spboucher.ai6-->7# SP Drive Next (2.0) on iPhone and iPad — phase 189Branch `next`. Phase 1 = everything that does not need the 2.0 endpoints. The File Provider extension, the sync engine's core10(journal, change feed, transfers), authentication, signing and bundle identifiers are those of 1.0; nothing was rebuilt.11Audit and baseline: [`AUDIT-iOS.md`](AUDIT-iOS.md). Contract: [`ARCHITECTURE-NEXT.md`](ARCHITECTURE-NEXT.md) (mirror).12Test state: [`../TESTS.md`](../TESTS.md). Everything was run on simulators only — no real device was connected.1314## What changed, by area1516### Sync engine 2.0 (`Sync/`, extended)1718| Piece | File | Notes |19|---|---|---|20| Policy: Wi-Fi only / cellular, Low Data Mode, Low Power Mode, battery | `Sync/TransferPolicy.swift` | pure decision (`TransferPolicy.evaluate`), fed by `App/DeviceConditions.swift` (`NWPathMonitor` `isExpensive` / `isConstrained`, `ProcessInfo.isLowPowerModeEnabled`, `UIDevice` battery) |21| Enforcement while suspended | `SyncEngine.shape(_:for:)` | every transfer request carries `allowsExpensiveNetworkAccess`, `allowsCellularAccess`, `allowsConstrainedNetworkAccess` |22| Adaptive concurrency 1–6 | `AdaptiveConcurrency` | additive increase while total throughput rises, back-off on a plateau, halved on 3 errors out of 8; « no network » is not an error |23| Priority, user-initiated first | `SyncEngine.pump` | background transfers (offline pins) are pre-empted when every slot is busy |24| Retry | `Backoff.delay` | exponential 0.5 s → 60 s, jitter in [step/2, step] |25| Selective offline kept consistent | `enforcePinConsistency`, `pinStatus` | after each pull and each local move |26| Crash-safe recovery | `SyncEngine.start`, `requeueOrphans`, adoption in `handle` | replayed results first, then requeue; 2 s grace with the real background session |27| Events listener | `Sync/ChangeListener.swift` | `ChangeEventSource` protocol (hints only), polling fallback 30 s, safety poll 5 min while streaming, reconnection 1 s → 60 s with jitter. **Phase 2 plugs the SSE stream by setting `AppModel.eventSource`.** |28| Per-item state | `SyncBadge` | synced (`none`), on device, pinned, pending (`waiting`), uploading, downloading, download waiting, unavailable offline, conflict, error |29| Conflict description | `conflictSides` | local size/date/base version, server size/date/version number, reachability |3031### iPhone design v23233- Tokens: `SPDTheme` in `Components/Theme.swift` (palette, radii, spacing, type scale on text styles, elevation, motion with a34 Reduce Motion gate). The shared table `DESIGN-SYSTEM-V2.md` did not exist yet in `../SPDrive` (branch `next`) when phase 135 ended: **token names are to be reconciled with it** (expected to be a rename, the structure follows the contract's list).36- Rows and cards with real thumbnails (`ItemRowView`, `ItemGridCell`, `ItemPreviewTile`); the grid's columns scale with the text size.37- Zoom transitions (`Components/Transitions.swift`): card → folder, thumbnail → full preview and back, pill → transfer centre;38 none with Reduce Motion.39- Contextual bottom sheet with detents (`ItemActionSheet`), details sheet with detents.40- Transfer pill above the tab bar (`TransferPill`), expanding into the transfer centre; says why transfers wait.41- Smart empty states with several real actions; haptics on selection, actions and outcomes.42- Dynamic Type: names wrap (3 lines from XL, unlimited at accessibility sizes), rows reflow, action sheet and conflict sheet stack.43- VoiceOver: one element per item (name + kind, size/content, date, favourite, state), custom actions, spoken states everywhere.44- Languages: French (source) and English through `Resources/Localizable.xcstrings`. **English is partial**: 170 strings of the main45 interface (tabs, explorer, actions, states, pill, conflict sheet, scanner, shortcuts); strings built in code as `String`46 (plurals, toasts, the settings, sharing and deposit editors) are still French only.4748### iPad4950- Sidebar / browser / **inspector column** (`ItemInspector`, `.inspector`), large preview.51- 15 keyboard shortcuts in the menu bar (system ⌘-hold overlay) + the in-app list (⌘/).52- Secondary windows: « Ouvrir dans une nouvelle fenêtre » on a folder, ⌥⌘N (`BrowserWindow`).53- Drag and drop: between folders (existing), onto sidebar sections (Mon Drive, Favoris, Hors ligne, Corbeille), files out to54 other apps and in from other apps (existing).55- Pointer hover effects on cards, rows' buttons, the pill, sidebar rows.5657### Conflicts5859`Features/Conflicts/ConflictSheet.swift`: both versions side by side (date, size, version number, thumbnail when one exists,60QuickLook preview of either — the Drive's version is fetched to a scratch file and verified, the local edit is not touched);61keep both / keep mine as a new version / keep the Drive's (confirmation). Opening a file in conflict opens the sheet.6263### Apple integration6465| Item | State |66|---|---|67| Share extension | `Core/Capture/ShareIntake.swift` (file, media, PDF when offered, web page → `.webloc`, text → `.txt`, multi-item), destination picker (existing), **park-first** inbox in the group container (`Sync/ShareInbox.swift`), « Wi-Fi only » respected, no double upload |68| Scanner | VisionKit camera (multi-page, crop and perspective by the framework) → `ScanReviewSheet` (name, folder, OCR on/off) → `Core/Capture/ScanPipeline.swift` (JPEG pages, optional Vision OCR as an invisible, positioned text layer) → upload queue |69| PDF annotation | `Features/MyDrive/PDFAnnotator.swift`: PencilKit canvases over PDFKit pages (`PDFPageOverlayViewProvider`), flattened (`PDFInk.flatten`), saved through `engine.replaceContent` = upload with `baseVersionId` → new version, or a conflict if the Drive moved on |70| Widgets | `WidgetExtension/`: recent files, favourite folders, storage (also lock-screen circular/rectangular), transfers, quick upload (deep links `spdrive://upload|scan|search|transfers|folder/<id>|file/<id>`); data = `Core/WidgetSnapshot.swift` written by the app into the group container; **no network, keychain or database in the widget**; names withheld when the app lock is on |71| Files app | File Provider extension untouched; its hosted test and the Files-app UI test re-run after the changes |7273## Known limits of phase 1 (stated, not hidden)7475- Nothing was observed on a real device: camera scanning, Apple Pencil input, widgets on a home screen, background relaunch,76 cellular / Low Power Mode / battery as reported by real hardware, share sheet from Safari/Photos/Mail, multiple windows by hand.77- The share extension's and the widgets' own interfaces are not driven by automated tests (their logic and data are).78- Bandwidth cap (contract §3) is not implemented on iOS.79- English is partial (see above).80- Tags, content/semantic search, AI, collections, shared-with-me, activity, server-side storage breakdown: phase 2 (`SPDriveNext`).81- `MARKETING_VERSION` is 2.0.0 and `CURRENT_PROJECT_VERSION` 2 in `project.yml`; nothing was archived or uploaded.8283## Needed at delivery (developer portal / App Store Connect) — nothing was created8485Existing and unchanged: App IDs `ai.spboucher.spdrive.ios`, `.fileprovider`, `.share`; app group86`group.ai.spboucher.spdrive.ios`; keychain group `3YM54G49SN.ai.spboucher.spdrive.ios.shared`; team `3YM54G49SN`;87App Store Connect record `6836524538`.8889| # | Item | Why |90|---|---|---|91| 1 | **New App ID** `ai.spboucher.spdrive.ios.widgets` (explicit, team `3YM54G49SN`) | the WidgetKit extension target `SPDriveWidgets` |92| 2 | Capability **App Groups** on that App ID, with `group.ai.spboucher.spdrive.ios` assigned | the widgets read the snapshot in the group container (its only entitlement; no keychain group, no associated domain) |93| 3 | **Provisioning profiles** for `ai.spboucher.spdrive.ios.widgets`: development and App Store distribution | with automatic signing (`CODE_SIGN_STYLE: Automatic`, `-allowProvisioningUpdates` in `Scripts/release.sh`) Xcode creates the App ID and both profiles on first signed build/archive; otherwise create them by hand |94| 4 | No new capability on the three existing App IDs | URL scheme `spdrive`, the widget, PencilKit, Vision OCR, VisionKit, multiple scenes need none; camera usage description already present |95| 5 | Regenerate nothing for the existing profiles | their entitlements did not change |96| 6 | App Store Connect: new version **2.0.0** on record `6836524538`, build number > 1 | `project.yml` already says 2.0.0 (2) |97| 7 | App Store Connect: localisation **English** of the store page if English is announced | the app now declares `fr` + `en` in `CFBundleLocalizations` |98| 8 | Review notes: mention the widget and that `spdrive://` links only open places inside the app | — |99| 9 | Privacy: no new data type collected; `WidgetExtension/PrivacyInfo.xcprivacy` declares file timestamps (C617.1) | the app's privacy answers do not change |100101Not needed: push notification capability (still local notifications only), iCloud, Siri/App Intents (the widgets use102`StaticConfiguration`), background modes beyond the existing `fetch` and `processing`.103