feat(chat): "Take photo" option in the attach menu on mobile - #520
Merged
Merged
Conversation
A second hidden file input with `accept="image/*" capture="environment"` sends the mobile WebView straight to the camera; the photo then flows through the same attachment pipeline as a picked file. Desktop ignores `capture`, so the row is only offered when `Platform.isMobile`. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
Desktop ignores `capture` on a file input, so the row now opens a modal with a live `getUserMedia` preview: a camera dropdown when there is more than one (Continuity Camera included), Enter or "Take photo" to snap a frame at the camera's full resolution, then Retake / Attach / Attach & take another so a stack of pages can be captured in one go. Mobile keeps the native camera via the capture input. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…ture On macOS Electron resolves getUserMedia with a live track that never delivers a frame while the OS camera prompt is unanswered or denied, so gate Take photo on the video's playing event and say what to check. Co-Authored-By: Claude <noreply@anthropic.com>
… streams On macOS a renderer getUserMedia resolves with a frameless track while camera access is undetermined or denied, so check and request it through Electron's systemPreferences first and surface a denial as an error. Also stop a stream that resolves after a device switch or close, and revoke the frozen frame's object URL on teardown (review findings). Co-Authored-By: Claude <noreply@anthropic.com>
…ackground Co-Authored-By: Claude <noreply@anthropic.com>
…s refused Obsidian's macOS build is hardened-runtime signed without com.apple.security.device.camera, so the OS denies silently and never lists the app under the Camera privacy pane; say so instead of sending the user to a setting that does not exist. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…-only Obsidian's macOS build lacks the com.apple.security.device.camera entitlement, so the modal could only ever show an error there, and on Windows/Linux a laptop webcam is a poor way to photograph pages. Back to the mobile-only row: one tap straight into the camera instead of the "From device" sheet. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Take photo row to the composer's attach (+) menu on mobile, between "From device" and "From vault". It clicks a second hidden
<input type="file" accept="image/*" capture="environment">, which the mobile WebView routes straight to the camera, instead of the "From device" sheet where Take Photo is one of several choices. The photo goes through the existingonFileAttachment→processFilespath (size cap, vision-model check, temp copy into the attachment folder). The row is only rendered whenPlatform.isMobile.An earlier revision also added a desktop webcam modal. It was dropped: Obsidian's macOS build (1.13.7, notarized Developer ID) is signed with the hardened runtime but without
com.apple.security.device.camera, so macOS denies camera access silently on every Mac and the modal could only show an error; on Windows/Linux a laptop webcam is a poor way to photograph pages. It is recoverable from this PR's history if Obsidian ever ships the entitlement.How I tested it
bun run check,bun run format,bun run lint,bun run testpass locally (1943 tests). Not tried on a device yet; the maintainer tests on iOS before merge.AI assistance: Claude Code wrote the change from Leo's brief ("add a from camera option to the attach menu", later "cut it back to mobile only"); Leo reviews and tests on iOS.
Checklist
bun run check,bun run format,bun run lint, andbun run testpass locallymanifest.json: I noted that the docs site needs updating (n/a)