Commit Graph
12 Commits
Author SHA1 Message Date
DarkSky 7605b96e7b feat(hosts): mount MobileShellView in iOS and Android native runtimes
The iOS and Android hosts now start on the mobile product shell (Home,
Explorer, Journals, Search, Settings, and the Page route) instead of one
bare page editor.

- Add a runtime root that is a bare PlaygroundView or a MobileShellView.
  Editor calls go to the root editor, or to the shell's embedded page
  editor while the Page route shows with no sheet or drawer above it.
  Otherwise the focused shell input handler (Search or the drawer
  filter) takes UITextInput and InputConnection text.
- Send every shell touch to Rust outside the page editor, and ask for
  the software keyboard when a touch focuses a shell text field.
- Let the page editor close its overlay on back first, then run
  MobileBackCoordinator. A tab other than Home steps back to Home
  before the app exits.
- Mount the local workspace that bootstrap opened through
  SqliteWorkspaceStore and MobileWorkspaceBridge on every bootstrap
  path. The mount reads only the root document and db tables, and each
  page loads when the shell opens it. A failed load retries the next
  time the shell shows the page.
- Commit shell edits every second on the scheduler clock, and again
  when the app goes to the background. A commit without pending
  changes does no SQLite access.
- Drop text and composition edits while a sheet covers the shell,
  except in the drawer once its filter holds focus.
- Follow the system dark mode while the app runs, and publish the
  shell accessibility tree as Android virtual views with stable IDs
  and accessibility focus.
- Read the allowlist again on a retried Android bootstrap while no
  shell workspace is mounted.
- Keep the bare editor C ABI and JNI entry points for editor tests.
- Add Rust, Swift, and Kotlin tests for routes, IME, Search, sheets,
  back, lazy page loads, autosave, and a SQLite reopen.
2026-12-05 01:38:56 +09:00
DarkSky f21fa487cf feat(mobile): add atomic 0.27.5 share block ingest, deterministic probe lifecycle, and durable share inbox 2026-11-30 13:41:09 +09:00
DarkSky 59af2bcbe1 fix(hosts,ci): wire edge-triggered show_soft_keyboard on iOS/Android and enable shared CI Cargo cache 2026-11-29 05:35:31 +09:00
DarkSky bc927e6ed8 feat(ios-host): switch text selection to single-writer UITextInteraction and guard offline client IDs 2026-11-29 03:42:18 +09:00
DarkSky 0eff077e0d feat(doc,preview,editor,playground,mobile): add native previews, external embeds, TOC/DocInfo, table ops, and edgeless paste
- Wire asynchronous off-thread native Mermaid, Typst, and RaTeX previews with CJK/Emoji system .ttc collection discovery, compact bundled NewCMMath-Book OpenType MATH outlines, 2048px rasterization cap, and a 32 MiB byte-bounded PinnedPixelCache
- Enable preview-typst by default on affine-ios-host and affine-android-host with size-optimized release codegen and wake idle native host runtimes when background preview workers finish
- Add external embed cards (YouTube, Figma, GitHub, Loom) with Idle/Selected/Active click-shield states and validated http(s):// open_url bridges on iOS and Android hosts
- Add TOC Outline and Document Info side panels, atomic table row/column insert/delete toolbar with mobile non-overlap placement, and code block wrap/language/preview controls
- Implement lossless Edgeless Note subtree paste, upfront Connector endpoint ID remapping, Mindmap/Group Yjs V1 wire parity, mixed affine:table text predicate matching, and Web Worker crash recovery
2026-11-29 00:32:21 +09:00
DarkSky b7b44e921a fix(blocksuite,ui,mobile): resolve cross-platform editor, database, edgeless, and host IME regressions
- Unify mobile database Record detail sheet layout and rendering into a single PreparedRecordSheet source of truth, auto-release open sheets when the backing database or row is deleted, and render graphical Checkbox and Progress controls in both Record sheets and Kanban cards.
- Add stroke-level TouchStrokeOwner isolation so closing a modal overlay or dragging the sheet grabber within its threshold never leaks scroll events to the underlying page or sheet body.
- Fix RTL mobile database view tab strip clipping and horizontal swipe direction; focus newly created rows on desktop + New record, record pre-mutation Undo selection snapshots, and prune dangling selections after Undo/Redo and remote CRDT updates without interrupting local block-selection transitions.
- Grow Edgeless Connector inline label edit boxes dynamically on newlines with single-step Undo, and align Frame title inline edit padding and font weight so titles stay single-line.
- Dismiss the touch selection action menu on typing, IME composition, key input, and scroll; wire inline @ reference chips and embed-linked-doc cards to switch the active workspace page with back navigation history.
- Preserve horizontal goal_x across table cell Up/Down navigation, select full paragraphs on triple-click, focus trailing empty blocks or append a paragraph when clicking below the last block, and show desktop scrollbars regardless of narrow window width.
- Pass Web IME multi-clause selected_range, recomposition anchors, and adjacent repeated-character composition ranges through to input handlers, expose code-block input mode to iOS and Android hosts for software keyboard traits, and re-enable default wgpu validation flags outside Android.
2026-11-28 23:34:29 +09:00
DarkSky 044e710a8c feat(mobile): add touch interaction, mobile database views, and host frame scheduling
Implement touch interaction gestures, mobile database views, and responsive host frame scheduling across Android, iOS, and BlockSuite playground:

- Record detail sheet layout and gesture isolation: measure real title, field, and wrapped tag-pill heights with block_flow::layout_inline so long multi-line titles scroll cleanly to the bottom; isolate all touch drags, flings, and wheel events inside the open sheet so the page behind stays stationary; support touch header/grabber pull-to-close and platform Back dismissal via PlaygroundView::handle_back and NativeBridge.nativeHandleBack.
- Mobile IME and block-selection continuity: preserve software keyboard focus and record the return block caret across adjacent block selection on Backspace, restore the text caret to the return paragraph on block deletion or direct typing during block selection, clear the flag on selection changes, and keep Android Autofill focus-generation isolation intact.
- Host frame scheduling, Vulkan cold-start safety, and wheel input: clear dirty state inside PlatformWindow::draw() while preserving post-draw animations and iOS keyboard transitions, wire SyncHostDispatcher::drain_ready() and next_timer_delay_ms() on both Android and iOS hosts, cache the process-lifetime NativeBridge jclass global reference in OnceLock, disable wgpu debug instance flags to avoid Vulkan emulator SetDebugUtilsObjectNameEXT crashes, dispatch Android ACTION_SCROLL via ScrollEvent::Pointer without synthetic touch flings, and remove sleep polling from Android runtime tests.
2026-11-28 12:36:27 +09:00
DarkSky 4e66722b44 feat(mobile): mount native GPU BlockSuite editor in iOS and Android hosts
- Add orthogonal PointerKind, FormFactor, and EditorCapabilities matrix in blocksuite-editor, decoupling database_readonly from edgeless_readonly and enforcing page_readonly across command/toolbar paths
- Attach cross-platform CJK and emoji FontFallbacks to blocksuite-editor text runs so iOS CoreText and Android CosmicTextSystem render CJK and emoji glyphs cleanly
- Wire real WgpuRenderer and CosmicTextSystem into Android ANativeWindow via SwappableAtlas, deterministic ui::clock_now() dispatch_after timer draining, single-JNI UTF-16 reads, surrogate-pair composing alignment, requestCursorUpdates + Matrix CursorAnchorInfo, historical ACTION_MOVE samples, hardware keyboard/scroll forwarding, and zero shadow-buffer pollution
- Frame iOS MetalHostView and SelectionOverlayView inside safeAreaInsets, gate software keyboard responder on PlaygroundView::wants_software_keyboard and pan-slop tap detection, avoid double safe_bottom subtraction on KeyboardToolbar insets, prevent spurious UITextInputDelegate textWillChange/textDidChange echo during IME composition, yield hardware pressesBegan during marked text, and guard UIEditMenuInteraction with explicit actions
- Enable wgpu/cosmic-text for target_os = "android" in packages/ui/ui and add Linux fontconfig/freetype packages to np-mobile CI workflow
2026-11-28 06:11:09 +09:00
DarkSky 65a2c9b097 refactor(mobile): remove duplicated logic across store and hosts
Remove eight duplicated or defensive code paths across affine-store,
affine-client, affine-mobile, and the web, iOS, and Android hosts:

- Remove explicit create recovery journals in store and client, and
  require WorkspaceDb::from_root_update_v1 to receive initial db$*
  tables at construction time instead of returning DbTableNotResolved.
- Consolidate auth protocol parsing, url::Url canonicalization,
  legacy_storage_endpoint_key (unbracketed IPv6 for 0.27.5 storage
  keys), chrono RFC3339 UTC Z normalization, Bearer checks, and
  permanent error codes into affine_store::auth while keeping iOS and
  Android 0.27.5 storage formats.
- Replace the duplicated legacy storage engine in affine-ios-host with
  affine-legacy-import, preserve malformed affine-local-workspace raw
  strings in one place, propagate iOS write-back serialization errors,
  delegate Android sentinel evaluation and probe filtering to Rust via
  a single JNI entry, and remove hardcoded Swift and Kotlin key lists.
- Remove the pure JS Yjs v1 decoder from hosts/web/src/idb-storage.js,
  expose a safe Rust wasm-codec cdylib from affine-store reusing
  merge_crdt_updates_v1, share a strict wasm-scalar-rpc.js loader with
  preview workers, wire crdt-wasm-client through index.html,
  worker-loader, host.js, stage-preview-workers, CI, and real-browser
  IDB E2E, and migrate real Yjs v1 fixtures to affine-store tests.
- Remove the 12-iteration blind SQLite retry loop in sqlite/doc.rs
  while preserving single-row empty-update registration.
- Upgrade SqliteDocStorage::checkpoint_passive to return WAL counts and
  remove duplicate maintenance pools from iOS and Android hosts.
- Remove top-level mirrored workspace fields and workspace-switch
  cloning in MobileAppState, and use generate_key_between for ordering.
- Remove pixel-fallback selection drag paths in iOS and Android hosts
  so text-layout endpoints remain the single drag authority.
2026-11-27 06:55:48 +09:00
DarkSky 5fc9486baf feat(ios): add native selection handles, keyboard avoidance, PDFKit renderer, and haptics
Add the native UIKit and PDFKit bridges in `packages/frontend/hosts/ios/`:

- Add teardrop selection handles, UTF-16 anchor drag probing, keyboard occlusion hiding, and loupe layout in `src/selection.rs` and `Sources/SelectionOverlayView.swift`.
- Add CoreText `CTTypesetter`, `CTLine`, and `CTRun` glyph-slot selection rects, BiDi endpoint carets, preferred-offset hit testing, and loupe drawing in `Sources/TextRenderingBridge.swift`, `src/ffi_text.rs`, and `src/text_layout.rs`.
- Add `UITextInput`, `HostTextPreviewView`, light canvas `#FAFAFC` clear color, rotation sync, and `UIEditMenuInteraction` wiring in `Sources/MetalHostViewController.swift`.
- Add per-frame keyboard avoidance in `src/keyboard_insets.rs` and `Sources/KeyboardAvoidanceCoordinator.swift` aligned with `ui::WindowInsets::effective()`.
- Add system `PDFKit` page rasterization in `src/pdf.rs` and `Sources/PdfRendererBridge.swift` with `.cropBox` rotation sizing and explicit document handles.
- Add UIKit haptics in `src/haptics.rs` and `Sources/HapticsBridge.swift`, `tests/IosHostS3SmokeTest.swift`, and `AGENTS.md`.
2026-11-27 06:55:48 +09:00
DarkSky 24e1b5d202 feat(ios-host): add in-place SQLite WAL, 2001-epoch auth, and zero-IDB localStorage bridge
Add the iOS host storage, authentication, and upgrade/rollback bridges under packages/frontend/hosts/ios:

- Wire affine-store and blocksuite-playground-doc into affine-ios-host for in-place SQLite WAL workspace and userspace databases under <Documents>/workspaces/<spaceType>/<sanitizedPeer>/<spaceId>.db, failing closed on missing or malformed affine-local-workspace allowlists so deleted local .db files never resurrect.
- Configure explicit SQLite busy_timeout (5000 ms), split remote_clock_ms from local_now_ms in apply_remote_update, add non-blocking PASSIVE WAL checkpoints on background entry, preserve dirty state whenever Metal drawables or render encoders are unavailable, and skip idle Metal draws.
- Align LegacyAuthBridge.swift and src/auth.rs with Keychain service app.affine.pro.auth-token (2001 reference-epoch f64 accessExpiresAt, shared process-level actor single-flight refresh with mutationEpochs across bridge instances, corrupt-entry self-healing, permanent invalidation cleanup, HTTP and WebKit auth cookie cleanup), UserDefaults key app.affine.pro.auth-installation-id, and /api/auth/session/{exchange,refresh,revoke} headers (x-affine-client-kind: native, x-affine-version).
- Unify LegacyLocalStorageProbe.swift and src/legacy_storage.rs on the WebViewStorageSentinel contract (all keys, whitelisted entries, idbAccessCount == 0, corrupt affine-local-workspace raw preservation, strict write-back whitelist guard, stopLoading and timeout cleanup) and wire HostBootstrapCoordinator (with allowlist eviction, rollback state sync, partial-mount error reporting, and retryable bootstrap) into MetalHostViewController with executable Swift and Rust smoke tests.
2026-11-27 06:55:48 +09:00
DarkSky ed72cca4a3 feat(mobile): deliver S1 thin hosts, Mermaid font measurer, and release probes
Add thin Web, iOS, and Android mobile hosts, harden the blocksuite-preview
Mermaid renderer and Wasm exports, and add S1 release performance probes
with CI artifact and native host linking gates.

- Preview: use FontPoolWidthMeasurer with variable-font HVAR weight
  instantiation, integer pixel ceil widths, front-matter theme injection,
  high-contrast Light and Dark palettes, premultiplied RGBA PNG compositing,
  and Wasm theme parameters.
- Probes and CI: add s1_sqlite_probe and s1_probes release tests, record
  measured latency and peak RSS in BENCHMARK.md, add timeout-minutes on all
  np-mobile jobs, upload s1-probes-artifacts, and link Android NDK .so,
  kotlinc Activity, and iOS Simulator swiftc executable in CI.
- Web host: use an offscreen canvas GPU probe, add OAuth redirect-loop and
  runtime GPU loss guards, restrict embed URLs and sandbox tokens, match
  /api/auth/captcha Turnstile headers, and launch four independent ES module
  Blob workers pinned to site root.
- iOS host: add affine-ios-host staticlib crate implementing all C-ABI
  functions with surrogate-pair safe UTF-16 editing, weak DisplayLinkProxy,
  absolute ime_bottom contract, and in-memory LegacyCapacitorSchemeHandler.
- Android host: implement hand-written JNI bridge with absolute ime_bottom
  logical-dp conversion, predictive and legacy back gesture handling, and a
  pure Android platform SDK MainActivity and LegacyLocalStorageProbe.
2026-11-27 06:55:47 +09:00