SPB Git

Repository Public

PHASE1-iOS.md 9.0 KB

# SP Drive Next (2.0) on iPhone and iPad — phase 1

Branch next. Phase 1 = everything that does not need the 2.0 endpoints. The File Provider extension, the sync engine's core (journal, change feed, transfers), authentication, signing and bundle identifiers are those of 1.0; nothing was rebuilt. Audit and baseline: AUDIT-iOS.md. Contract: ARCHITECTURE-NEXT.md (mirror). Test state: ../TESTS.md. Everything was run on simulators only — no real device was connected.

# What changed, by area

# Sync engine 2.0 (Sync/, extended)

Piece File Notes
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)
Enforcement while suspended SyncEngine.shape(_:for:) every transfer request carries allowsExpensiveNetworkAccess, allowsCellularAccess, allowsConstrainedNetworkAccess
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
Priority, user-initiated first SyncEngine.pump background transfers (offline pins) are pre-empted when every slot is busy
Retry Backoff.delay exponential 0.5 s → 60 s, jitter in [step/2, step]
Selective offline kept consistent enforcePinConsistency, pinStatus after each pull and each local move
Crash-safe recovery SyncEngine.start, requeueOrphans, adoption in handle replayed results first, then requeue; 2 s grace with the real background session
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.
Per-item state SyncBadge synced (none), on device, pinned, pending (waiting), uploading, downloading, download waiting, unavailable offline, conflict, error
Conflict description conflictSides local size/date/base version, server size/date/version number, reachability

# iPhone design v2

  • Tokens: SPDTheme in Components/Theme.swift (palette, radii, spacing, type scale on text styles, elevation, motion with a Reduce Motion gate). The shared table DESIGN-SYSTEM-V2.md did not exist yet in ../SPDrive (branch next) when phase 1 ended: token names are to be reconciled with it (expected to be a rename, the structure follows the contract's list).
  • Rows and cards with real thumbnails (ItemRowView, ItemGridCell, ItemPreviewTile); the grid's columns scale with the text size.
  • Zoom transitions (Components/Transitions.swift): card → folder, thumbnail → full preview and back, pill → transfer centre; none with Reduce Motion.
  • Contextual bottom sheet with detents (ItemActionSheet), details sheet with detents.
  • Transfer pill above the tab bar (TransferPill), expanding into the transfer centre; says why transfers wait.
  • Smart empty states with several real actions; haptics on selection, actions and outcomes.
  • Dynamic Type: names wrap (3 lines from XL, unlimited at accessibility sizes), rows reflow, action sheet and conflict sheet stack.
  • VoiceOver: one element per item (name + kind, size/content, date, favourite, state), custom actions, spoken states everywhere.
  • Languages: French (source) and English through Resources/Localizable.xcstrings. English is partial: 170 strings of the main interface (tabs, explorer, actions, states, pill, conflict sheet, scanner, shortcuts); strings built in code as String (plurals, toasts, the settings, sharing and deposit editors) are still French only.

# iPad

  • Sidebar / browser / inspector column (ItemInspector, .inspector), large preview.
  • 15 keyboard shortcuts in the menu bar (system ⌘-hold overlay) + the in-app list (⌘/).
  • Secondary windows: « Ouvrir dans une nouvelle fenêtre » on a folder, ⌥⌘N (BrowserWindow).
  • Drag and drop: between folders (existing), onto sidebar sections (Mon Drive, Favoris, Hors ligne, Corbeille), files out to other apps and in from other apps (existing).
  • Pointer hover effects on cards, rows' buttons, the pill, sidebar rows.

# Conflicts

Features/Conflicts/ConflictSheet.swift: both versions side by side (date, size, version number, thumbnail when one exists, QuickLook preview of either — the Drive's version is fetched to a scratch file and verified, the local edit is not touched); keep both / keep mine as a new version / keep the Drive's (confirmation). Opening a file in conflict opens the sheet.

# Apple integration

Item State
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
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
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
Widgets WidgetExtension/: recent files, favourite folders, storage (also lock-screen circular/rectangular), transfers, quick upload (deep links `spdrive://upload
Files app File Provider extension untouched; its hosted test and the Files-app UI test re-run after the changes

# Known limits of phase 1 (stated, not hidden)

  • Nothing was observed on a real device: camera scanning, Apple Pencil input, widgets on a home screen, background relaunch, cellular / Low Power Mode / battery as reported by real hardware, share sheet from Safari/Photos/Mail, multiple windows by hand.
  • The share extension's and the widgets' own interfaces are not driven by automated tests (their logic and data are).
  • Bandwidth cap (contract §3) is not implemented on iOS.
  • English is partial (see above).
  • Tags, content/semantic search, AI, collections, shared-with-me, activity, server-side storage breakdown: phase 2 (SPDriveNext).
  • MARKETING_VERSION is 2.0.0 and CURRENT_PROJECT_VERSION 2 in project.yml; nothing was archived or uploaded.

# Needed at delivery (developer portal / App Store Connect) — nothing was created

Existing and unchanged: App IDs ai.spboucher.spdrive.ios, .fileprovider, .share; app group group.ai.spboucher.spdrive.ios; keychain group 3YM54G49SN.ai.spboucher.spdrive.ios.shared; team 3YM54G49SN; App Store Connect record 6836524538.

# Item Why
1 New App ID ai.spboucher.spdrive.ios.widgets (explicit, team 3YM54G49SN) the WidgetKit extension target SPDriveWidgets
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)
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
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
5 Regenerate nothing for the existing profiles their entitlements did not change
6 App Store Connect: new version 2.0.0 on record 6836524538, build number > 1 project.yml already says 2.0.0 (2)
7 App Store Connect: localisation English of the store page if English is announced the app now declares fr + en in CFBundleLocalizations
8 Review notes: mention the widget and that spdrive:// links only open places inside the app —
9 Privacy: no new data type collected; WidgetExtension/PrivacyInfo.xcprivacy declares file timestamps (C617.1) the app's privacy answers do not change

Not needed: push notification capability (still local notifications only), iCloud, Siri/App Intents (the widgets use StaticConfiguration), background modes beyond the existing fetch and processing.

Files main
Menu

Theme