Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Web Share API to photo viewer and clipboard #48

Merged
merged 3 commits into from
Jan 30, 2022

Conversation

kvalev
Copy link
Owner

@kvalev kvalev commented Jan 30, 2022

Author: photoprism#1792

photoprism_webshare

This PR adds share buttons using the Web Share API in browsers that support it. Basically, it opens the native Share menu on mobile devices and some desktop browsers, letting users share / edit / mail photos from the PWA as you would from a native photo gallery app.

I built this after watching someone struggle to share a photo from the PhotoPrism PWA on Android with a friend on WhatsApp.

  • It works alongside the existing sharing features, which may be a bit confusing, but at least there are different icons

  • It works from the photo viewer toolbar, and from the photo clipboard after selecting one or more photos

  • I left the share button in the album toolbar alone, I think it makes more sense to share URLs to albums instead of downloading and sharing all the files

  • I had a bit of a name collision between the JS File and your model, so I broke that part of the code out into common/util. Let me know if there's a better way to do that

  • I tested it on Windows in Edge, Chrome and Firefox (where it's not supported and doesn't show up by design), but couldn't test on my mobile devices since Web Share requires HTTPS and I couldn't get that set up between my dev environment and my phone

  • AFAIK there's no easy way to cover this with automated testcases, so I didn't write any

@kvalev kvalev merged commit 4b927f0 into kvalev:preview Jan 30, 2022
@kvalev kvalev added the enhancement New feature or request label Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants