a04afc367b
Feature-detected navigator.share opens the OS share sheet with title+text+URL only (no QR files: — narrow support drops the URL when given file+URL). Hidden unless supported; Link másolása stays the universal fallback and catches the non-cancel rejection; AbortError is silent. Template JS + tests only. 2 red-proofs verified red.
80 lines
4.1 KiB
Markdown
80 lines
4.1 KiB
Markdown
# REPORT — felhom-controller v0.165.1 — Native "Megosztás…" button in the share modal (Web Share API)
|
|
|
|
## Baseline
|
|
|
|
| Repo | main @ start | version start → target |
|
|
|------|--------------|------------------------|
|
|
| felhom-controller | `570fb30` | v0.165.0 → **v0.165.1** |
|
|
|
|
Clean tree, `HEAD == origin/main`, verified before build.
|
|
|
|
## What shipped
|
|
|
|
The v0.165.0 "Indítópult megosztása" modal gains a feature-detected **"Megosztás…"** button that
|
|
opens the OS share sheet via `navigator.share`, sending the share **title + text + URL only**. Template
|
|
JS + tests only — no backend, no routes, no settings, no dependency changes.
|
|
|
|
## Files modified
|
|
|
|
- `controller/internal/web/templates/launcher.html` — the `#share-native-btn` button in the
|
|
share-link-row (`display:none` in markup); `nativeShare()` in the modal script; a `navigator.share`
|
|
feature-detect reveal in the existing IIFE.
|
|
- `controller/internal/web/launcher_share_modal_test.go` — **new**: Group A + Group B render tests.
|
|
- Docs: `CHANGELOG.md`, `controller/README.md`, `CONTEXT.md`.
|
|
|
|
## Behavior
|
|
|
|
- **Supported browser:** `#share-native-btn` is revealed (`navigator.share` truthy) and calls
|
|
`navigator.share({title:'Indítópult — <domain>', text:'Az otthoni alkalmazások egy helyen.',
|
|
url:<ShareURL>})` — **no `files:` key**. User cancel (`AbortError`) → silent; the modal stays open.
|
|
- **Unsupported browser** (Firefox desktop, Chrome/Linux): the button stays `display:none` (JS only
|
|
ever reveals it); "Link másolása" works exactly as in v0.165.0.
|
|
- **Non-cancel rejection:** falls back to `copyShareLink()` so the user still keeps the link on the
|
|
clipboard (with the existing "Másolva" feedback).
|
|
|
|
## Design ruling (CONTEXT)
|
|
|
|
The **QR is NOT attached** to the share payload (no Web Share Level-2 `files:`). File-share support is
|
|
narrow and several targets drop the URL when handed file+URL, leaving an unscannable QR picture in a
|
|
chat. The QR's job — physical cross-device scanning — is already served by the modal image (mobile
|
|
long-press covers "send the picture" with zero code).
|
|
|
|
## Tests + red-proofs
|
|
|
|
`go build ./... && go vet ./... && go test ./...` — all green. Gates: template_id, emoji,
|
|
native_confirm — OK.
|
|
|
|
New tests (`launcher_share_modal_test.go`), both PASS:
|
|
|
|
| Group | Scenario | Test |
|
|
|---|---|---|
|
|
| A | button hidden-by-default + feature-detect reveal + title/text/url-only payload (no `files:`) + copy retained | `TestShareModal_NativeShareButton` |
|
|
| B | AbortError-silent branch + non-abort fallback to `copyShareLink()` | `TestShareModal_NativeShareFallback` |
|
|
|
|
Companion **red-proofs** (mutate → FAIL → restore → green), both verified:
|
|
1. **Group A:** removed `style="display:none"` from the button (revealed it in markup) →
|
|
`TestShareModal_NativeShareButton` FAILS the hidden-by-default assertion. Restored → green.
|
|
2. **Group B:** swapped the `.catch` to swallow all errors (dropped the `copyShareLink()` fallback) →
|
|
`TestShareModal_NativeShareFallback` FAILS the fallback-presence assertion. Restored → green.
|
|
|
|
## Deployed version + validation (§13)
|
|
|
|
_Filled after build + deploy to guest 9201 — rendered-page assertion transcript below._
|
|
|
|
<!-- LIVE-VALIDATION -->
|
|
|
|
## Pending human check (stated, not claimed)
|
|
|
|
The **OS share sheet interaction is an OS-level dialog** that endpoint checks and browser automation
|
|
cannot exercise. CC validates markup + JS presence at the rendered `/launcher` (authed curl, Group-A
|
|
strings). The single pending manual check is the operator's: desktop Chrome/Edge or a phone → the
|
|
"Megosztás…" button is visible → the sheet opens → a WhatsApp/email target receives the title + a
|
|
tappable link; on Firefox desktop the button is absent and "Link másolása" still works.
|
|
|
|
## Observations
|
|
|
|
- No Web Share Level-2 `files:` — ruled out above (narrow support; URL-drop when given file+URL).
|
|
- "Link másolása" is unchanged and remains the universal path; feature detection only, no UA sniffing.
|
|
- The share `text` is deliberately conjugation-free ("Az otthoni alkalmazások egy helyen.") — a
|
|
user-to-user message, not magázó UI copy.
|