Skip to content

Conversation

@rektide
Copy link
Contributor

@rektide rektide commented Dec 27, 2025

Resolves #242, huzzah, adding share_target support. Flow is:

  1. Share target launches /home?addUrl=<url>.
  2. ComponentDrawer picks it up with useSearchParams hook,
  • sets it's own state to open,
  • forwards the initial url to AddCardDrawer.

There's some extra useEffect's sprinkled in to insure activation. But pretty simple. Left a comment on one that I'm not sure is really needed, but seems like a fair safeguard.

This should supercharge my Semble usage; I'm super thrilled for this to land! Thanks https://seams.so for reminding me how great share_target is. I'd love for semble to become a default Share... on my Android experience!

Note: I don't actually have this app up and running locally. I've spent considerable time researching, coding, & checking work, but I can't promise this actually works. It likely wont hurt, though.

Note2: happy to improve this pr. Very bikeshed'y, but addUrl feels... ok. Not great. I kind of want better. Happy to go rebase this PR with a better name.

@vercel
Copy link

vercel bot commented Dec 27, 2025

@rektide is attempting to deploy a commit to the Cosmik Team on Vercel.

A member of the Team first needs to authorize it.

}
}, [props.initialUrl]);

const handleAddCard = (e: React.FormEvent) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this makes sure that if the same component gets recycled for multiple adds, that the new url will indeed take effect. non-zero chance this can be deleted, but i'm not set up to test how needed this was.

onSuccess: () => {
setSelectedCollections([]);
props.onClose();
window.history.replaceState({}, '', window.location.pathname);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explanation: clears the addUrl from the query string, so that the same url does not pre-fill itself again next time.

@weswalla
Copy link
Contributor

Woah thanks for this work! I'll review it sometime next week

@weswalla
Copy link
Contributor

I'll have to update our developer docs to make it easier to setup a dev environment

@weswalla
Copy link
Contributor

weswalla commented Jan 5, 2026

@rektide - didn't have time last week. aiming to review later this week!

@weswalla
Copy link
Contributor

@rektide looks good! I don't have android so I wont be able to test the share target but @ronentk will be able to. Closing this PR since I added one commit over at #434

@weswalla weswalla merged commit b48fca9 into cosmik-network:main Jan 15, 2026
1 check failed
@weswalla
Copy link
Contributor

@rektide this is now merged to prod - can you test it out and see if it works as intended?

@rektide
Copy link
Contributor Author

rektide commented Jan 21, 2026

@weswalla I wasn't having luck getting it working. Looks like Android has a WONTFIX on being able to use url share_targets, which I was not aware of when I authored this PR. https://issues.chromium.org/issues/40552022

I just sent in #453, which should workaround this. Apologies for not handling Android appropriately the first time around.

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.

Target the PWA with a share sheet (Android only for now)

2 participants