Skip to content

feat(chat): "Take photo" option in the attach menu on mobile - #520

Merged
Leo310 merged 10 commits into
mainfrom
feat/attach-from-camera
Sep 26, 2026
Merged

Leo310 merged 10 commits into
mainfrom
feat/attach-from-camera

Conversation

@Leo310

@Leo310 Leo310 commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

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 existing onFileAttachment → processFiles path (size cap, vision-model check, temp copy into the attachment folder). The row is only rendered when Platform.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 test pass 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, and bun run test pass locally
  • I tried the change in a real Obsidian vault (or explained above why that isn't applicable)
  • I read CONTRIBUTING.md, including the section on AI assistance
  • If this adds a provider, a bundled skill, a built-in tool, or changes manifest.json: I noted that the docs site needs updating (n/a)

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>
@greptile-apps

greptile-apps Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds camera capture option to the chat attach menu.

The PR appears safe to merge based on the reviewed changes.

Summary

Adds a mobile-only “Take photo” option to the chat attachment menu.

  • Opens a camera-targeted file input and passes the captured image through the existing attachment handler.
  • Leaves the desktop attachment menu unchanged.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Mobile attach menu] --> B[Take photo]
  B --> C[Camera file input]
  C --> D[Existing attachment handler]
  D --> E[Attachment checks and vault copy]
Loading

Reviews (8) · Last reviewed commit: "Merge branch 'main' into feat/attach-fro..."

Leo310 and others added 2 commits September 22, 2026 11:16
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>
Comment thread src/components/modal/CameraCapture.svelte Outdated
Comment thread src/components/modal/CameraCapture.svelte Outdated
Leo310 and others added 4 commits September 22, 2026 11:22
…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>
Comment thread src/components/modal/CameraCapture.svelte Outdated
Leo310 and others added 2 commits September 22, 2026 12:09
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>
Comment thread src/components/chat/Input.svelte
@Leo310
Leo310 merged commit d3e77a3 into main Sep 26, 2026
3 checks passed
@Leo310
Leo310 deleted the feat/attach-from-camera branch September 26, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant