Added Web Share API to photo viewer and clipboard #48
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Author: photoprism#1792
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 intocommon/util
. Let me know if there's a better way to do thatI 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