feat(tui): wire Sharing overlay to PluginBridge #106

Merged
claude-desktop merged 1 commit from tui/sharing-wire-93 into main 2026-04-12 15:45:30 +00:00
Collaborator

Summary

  • Wire the scaffolded Sharing component to actually call sharing plugins via PluginBridge.share_image() for each enabled platform (Mastodon, Pixelfed, Bluesky, CivitAI)
  • Add SharingOverlay implementing the Overlay trait with full form UI: platform toggle checkboxes, caption text input, visibility cycling, and submit button
  • Async dispatch per platform via tokio::spawn, with per-platform outcome status (pending/success/error) routed back through AppAction::ShareOutcome
  • Add OverlayKind::Share and wire it into the app's overlay stack

Test plan

  • cargo clippy -p loom-tui -- -D warnings clean
  • cargo test -p loom-tui passes (120 tests including new sharing tests)
  • Manual: open sharing overlay, toggle platforms, type caption, submit — verify async calls dispatch and status updates render

Closes charles/loom#93

🤖 Generated with Claude Code

## Summary - Wire the scaffolded Sharing component to actually call sharing plugins via `PluginBridge.share_image()` for each enabled platform (Mastodon, Pixelfed, Bluesky, CivitAI) - Add `SharingOverlay` implementing the `Overlay` trait with full form UI: platform toggle checkboxes, caption text input, visibility cycling, and submit button - Async dispatch per platform via `tokio::spawn`, with per-platform outcome status (pending/success/error) routed back through `AppAction::ShareOutcome` - Add `OverlayKind::Share` and wire it into the app's overlay stack ## Test plan - [x] `cargo clippy -p loom-tui -- -D warnings` clean - [x] `cargo test -p loom-tui` passes (120 tests including new sharing tests) - [ ] Manual: open sharing overlay, toggle platforms, type caption, submit — verify async calls dispatch and status updates render Closes charles/loom#93 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Add SharingOverlay implementing the Overlay trait with full form UI
(platform toggles, caption, visibility, submit) and async dispatch to
sharing plugins via PluginBridge.share_image(). Per-platform outcomes
route back through AppAction::ShareOutcome for live status updates.

Closes charles/loom#93

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Collaborator

Review — PR #106: Sharing overlay wired to PluginBridge

Full-featured sharing form. Focus navigation, per-platform status, async dispatch — all clean.

Concern: as_sharing_mut downcasting on Overlay trait

Adding a concrete-type accessor to the trait object is a code smell — it means the trait knows about one of its implementors. This works for now with few overlay types, but consider using as_any_mut() -> &mut dyn Any (like PR #109 does) instead. Then the routing code downcasts via Any, and the trait stays generic.

Concern: no credential check before submit

The overlay dispatches share_image for all enabled platforms even if credential_missing is set. The plugin bridge call will presumably fail with an auth error, but the user gets a confusing "pending → error" flow instead of an upfront "no credentials configured" warning. Consider checking credential_missing in submit() and setting ShareOutcome::Error("no credentials") immediately for those platforms.

Cross-PR: duplicated centered_rect

Same helper as PRs #103 and #109. Extract to shared utility.

Nit

  • Pixelfed reuses mastodon as plugin_id — correct since Pixelfed speaks Mastodon API, but a comment explaining this would help future readers.
  • New serde_json dependency added. This is fine — it's already a transitive dep.

Good test coverage.

## Review — PR #106: Sharing overlay wired to PluginBridge **Full-featured sharing form.** Focus navigation, per-platform status, async dispatch — all clean. ### Concern: `as_sharing_mut` downcasting on `Overlay` trait Adding a concrete-type accessor to the trait object is a code smell — it means the trait knows about one of its implementors. This works for now with few overlay types, but consider using `as_any_mut() -> &mut dyn Any` (like PR #109 does) instead. Then the routing code downcasts via `Any`, and the trait stays generic. ### Concern: no credential check before submit The overlay dispatches `share_image` for all enabled platforms even if `credential_missing` is set. The plugin bridge call will presumably fail with an auth error, but the user gets a confusing "pending → error" flow instead of an upfront "no credentials configured" warning. Consider checking `credential_missing` in `submit()` and setting `ShareOutcome::Error("no credentials")` immediately for those platforms. ### Cross-PR: duplicated `centered_rect` Same helper as PRs #103 and #109. Extract to shared utility. ### Nit - `Pixelfed` reuses `mastodon` as `plugin_id` — correct since Pixelfed speaks Mastodon API, but a comment explaining this would help future readers. - New `serde_json` dependency added. This is fine — it's already a transitive dep. Good test coverage.
charles force-pushed tui/sharing-wire-93 from 3ba3ee660d to c2b8022a5d 2026-04-12 14:47:44 +00:00 Compare
claude-desktop changed target branch from tui/image-ctx-85 to main 2026-04-12 15:36:29 +00:00
charles force-pushed tui/sharing-wire-93 from c2b8022a5d to 6aba79bea0
All checks were successful
QA / qa (pull_request) Successful in 30m42s
2026-04-12 15:45:23 +00:00
Compare
claude-desktop deleted branch tui/sharing-wire-93 2026-04-12 15:45:30 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/loom!106
No description provided.