mirror of
https://github.com/block/buzz.git
synced 2026-11-12 20:31:12 +00:00
## Summary Photos currently filters out videos, video messages without poster metadata stay grey until playback, and the native gallery rejects downward dismissal on video pages. - Include photos and videos in the native inline/popover pickers, system picker, and recent-media grid. Mixed selections retain their order and videos use the video upload path. Remove the redundant Video menu row on iOS and Android, whose Photos picker accepts both media types; reduce their menu height to four rows. Native pickers request the current asset representation to avoid compatibility transcoding and export up to three files concurrently, preserving order and cleaning up cancelled/failed batches. - Show local stills for queued videos. For older messages without posters, serialize thumbnail generation for the four rendered stack cards, bound/cancel downloads, remove temporary videos, and save stills in the existing account/community cache. Existing poster metadata is used directly. The native viewer uses the poster while loading instead of a play-button snapshot. - Allow downward dismissal on native video pages while preserving horizontal paging/scrubbing, zoomed-photo panning, and the accessible Close button. Fire selection-click haptics as a swipe begins rather than after the page settles, with no duplicate on completion or cancellation. Page-indicator changes retain immediate feedback. Replace visible video-loading text with the existing white arc-spinner treatment, implemented natively with reduced-motion and lifecycle handling. Completed swipes release the previous video player even after UIKit removes it from the active children. Legacy videos need one initial download (up to the existing 100 MB limit) to generate their cached preview. This does not start playback. ### Related issue Follow-up to merged #9259 and #9314. Searched open and closed gallery/video issues and PRs; no duplicate fix found. ### Testing - Full `just mobile-check` and `just mobile-test` passed at `12e6ed6ae3`: 4,688 Flutter tests (71 skipped), 4 unconfigured-push tests, and 27 crypto-package tests. File-size checks passed. Regressions cover mixed image/video upload routing, queued still previews, the rendered-card poster window, authenticated/cancelled downloads, caching/cleanup, and native poster loading. - Native gallery simulator regression fixture passed: photo/video dismissal guards, real MP4 decoding, paging, selected-only playback loading, and teardown. - Swift type-check of the native picker and its dependencies passed, with existing deprecation/capture warnings. - `just ci` passed its repository-wide lint/type checks. The unrelated Rust test rebuild was stopped after consuming about 13 GB to preserve remaining disk space; only that run's generated caches were removed. Release build at `fb09f9cb8` installed in place and launched on the physical iPhone Air as **Buzz Photo Stack**, with `BUZZ_NATIVE_PHOTO_ZOOM=true`. Existing app updated in place with the same bundle and Keychain identity; no uninstall or reset. Owner tested the physical-device preview and approved readiness for review. No before/after capture was produced. The simulator evidence above is an automated native fixture, not a full Buzz device journey. Native preparation follow-up: `scripts/test-mobile-picker-preparation.sh` passed on an iPhone Air simulator, covering bounded overlap, out-of-order completion, cancellation, and failure cleanup. The updated physical Air preview launched successfully with unchanged preferences metadata. Cloud-only assets may still require preparation. Loader/haptics follow-up native fixture passed: real video readiness hides the loader, error/retry and detach stop/restart it correctly, swipe start triggers one haptic before selection changes, and completion/cancellation/duplicate-start callbacks add none. Updated release installed and launched on the physical Air; owner approved the final preview for review. Review: focused code review and native regression checks completed; physical Air preview tested by the owner, who approved readiness. P2 follow-up: video presentation uses an already decoded poster or the source snapshot immediately, then forwards a pending poster asynchronously. Late poster updates are limited to the selected native page and do not restart playback. Added pending-provider presentation coverage and native late/stale-poster checks. This follow-up has not been installed on the physical preview yet. --------- Signed-off-by: kenny lopez <klopez4212@gmail.com> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
66 lines
2.7 KiB
Swift
66 lines
2.7 KiB
Swift
import Foundation
|
|
|
|
@MainActor
|
|
private final class ExportGate {
|
|
var pending: [Int: CheckedContinuation<String, Error>] = [:]
|
|
var started: [Int] = []
|
|
let directory = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)
|
|
|
|
init() throws { try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) }
|
|
|
|
func export(_ index: Int) async throws -> String {
|
|
started.append(index)
|
|
return try await withCheckedThrowingContinuation { pending[index] = $0 }
|
|
}
|
|
|
|
func waitFor(_ count: Int) async {
|
|
while started.count < count { await Task.yield() }
|
|
}
|
|
|
|
func finish(_ index: Int) throws {
|
|
let file = directory.appendingPathComponent("\(index).mov")
|
|
try Data([UInt8(index)]).write(to: file)
|
|
pending.removeValue(forKey: index)!.resume(returning: file.path)
|
|
}
|
|
}
|
|
|
|
@main
|
|
struct PickerFilePreparationTests {
|
|
@MainActor static func main() async throws {
|
|
let gate = try ExportGate()
|
|
defer { try? FileManager.default.removeItem(at: gate.directory) }
|
|
let task = Task { try await PickerFilePreparation.prepare(count: 5, export: gate.export) }
|
|
await gate.waitFor(3)
|
|
precondition(gate.pending.count == 3, "Exports overlap but stay bounded")
|
|
try gate.finish(2)
|
|
await gate.waitFor(4)
|
|
precondition(gate.pending.count == 3)
|
|
try gate.finish(0)
|
|
await gate.waitFor(5)
|
|
for index in [4, 3, 1] { try gate.finish(index) }
|
|
let paths = try await task.value
|
|
precondition(paths.map { URL(fileURLWithPath: $0).lastPathComponent } == (0..<5).map { "\($0).mov" }, "Completion order must not reorder the selection")
|
|
|
|
for cancel in [false, true] {
|
|
let gate = try ExportGate()
|
|
defer { try? FileManager.default.removeItem(at: gate.directory) }
|
|
let task = Task { try await PickerFilePreparation.prepare(count: cancel ? 5 : 3, export: gate.export) }
|
|
await gate.waitFor(3)
|
|
if cancel { task.cancel() }
|
|
else { gate.pending.removeValue(forKey: 0)!.resume(throwing: CocoaError(.fileReadUnknown)) }
|
|
if cancel { try gate.finish(0) }
|
|
// Providers may return files even after cancellation or another export fails.
|
|
try gate.finish(1)
|
|
try gate.finish(2)
|
|
do {
|
|
_ = try await task.value
|
|
preconditionFailure("Failed/cancelled batches must not become attachments")
|
|
} catch {}
|
|
precondition(gate.started.count == 3, "Stop scheduling after failure or cancellation")
|
|
let remaining = try FileManager.default.contentsOfDirectory(atPath: gate.directory.path)
|
|
precondition(remaining.isEmpty, "Remove every completed temporary file")
|
|
}
|
|
print("Picker export batching: order, concurrency, failure and cancellation passed")
|
|
}
|
|
}
|