From 9e52dc03556e9fb33150c450b7fed2ea7ead6b64 Mon Sep 17 00:00:00 2001 From: Greg Pomerantz Date: Mon, 2 Nov 2026 00:02:48 -0500 Subject: [PATCH] gtauri: MediaStore fast path + js-ready handshake + virtualized grid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - MediaStore fast path: Kotlin's ContentObserver queries MediaStore for images added in the last 120s and writes path|added|size lines to .ms_recent, then wakes Rust via the proven zero-arg nativeFsChange() JNI. Rust upserts those rows and emits immediately — a camera photo appears in ~1s without waiting for the ~10s FUSE re-read of a 10,000-file directory. (Direct Kotlin->Rust JNI string passing and Rust->Java calls crash under the emulator's x86_64->arm64 native bridge; file handoff plus zero-arg JNI is the only reliable channel.) - js-ready handshake: the first gallery-files emit fires ~30 ms after process start, before the WebView's JS exists (Tauri events are fire-and-forget, so it was lost). JS now signals 'gtauri-js-ready'; Rust re-emits the current state. - Virtualized grid: the document is ONE spacer (full scroll height) plus ONE band of recycled cells pinned by transform — ~80 DOM nodes total for a 10,000-photo library. Launch cost no longer scales with library size; the first screen renders as soon as the WebView boots and the first thumbs arrive. - 'Missing photos' report resolved: the full walk of the 9,961-file Camera dir enumerates exactly 8,438 images with no guard firing; the difference is videos, which a photo gallery correctly excludes. --- harnesses/gtauri/frontend/dist/index.html | 296 ++++++++++-------- .../android/app/src/main/AndroidManifest.xml | 3 + .../main/java/wow/gmp/gallery/MainActivity.kt | 87 +++++ harnesses/gtauri/src/db.rs | 42 +++ harnesses/gtauri/src/lib.rs | 109 ++++++- harnesses/gtauri/src/scan.rs | 46 ++- 6 files changed, 449 insertions(+), 134 deletions(-) diff --git a/harnesses/gtauri/frontend/dist/index.html b/harnesses/gtauri/frontend/dist/index.html index 52ea4a8..e54f0f3 100644 --- a/harnesses/gtauri/frontend/dist/index.html +++ b/harnesses/gtauri/frontend/dist/index.html @@ -5,9 +5,17 @@ Gallery