videokit-ai / natshare

Cross-platform social sharing for Unity Engine.
https://github.com/natmlx/videokit
Apache License 2.0
134 stars 28 forks source link

Save to Camera Roll: API for requesting save permission? #118

Closed derwaldgeist closed 2 years ago

derwaldgeist commented 3 years ago

In our use-case, asking for the "album save permission" at the time-point when the image has to be saved leads to a pretty weird user experience. Thus, we would like to move this permission request to the user-settings, like WhatsApp does it. However, I could not see an API for just requesting the save permissions without actually saving an image to the system album. The only workaround would be to save a dummy image and delete it right afterwards, which is not the best solution. And there's also no API to delete the photo.

Thus, I'd love to see a separate API call for requesting the permission only, without actually saving anything.

olokobayusuf commented 3 years ago

This is a good feature request. I'll look into it.

derwaldgeist commented 3 years ago

Thanks Yusuf.

Another thing I'd like to point out: Since NatShare didn't offer a permission request so far, I was using yasirkula's NativeShare's permission dialog instead. However, since I upgraded Xcode to the latest version targeting iOS 14+ and also had to update NativeShare along the way (the old version threw compile errors), I noticed that now NativeShare won't ask the user for access to a specific album anymore. This is because according to its docs, iOS 14+ only allows access to the general album. From their docs:

On iOS 14+, the image/video will be saved to the default Photos album (i.e. album parameter will be ignored). On earlier iOS versions, the image/video will be saved to the target album.

This leads to a weird UX: If I ask for write access using NativeShare, only the general write permission popup shows. But if I later actually save a photo using NatShare, a second permission pops up (this time, only asking the user which album should be used). If I can trust the explanation of the NativeShare package, this addition permission would be useless, because iOS ignores the album anyways. So maybe NatShare should be adapted to reflect this change?

Of course, I could start using NativeShare instead, which also allows to store photos. However, I like the async interface of NatShare, so I would like to keep it. NativeShare also has quite a number of issues pending, while I never had a problem with NatShare.

olokobayusuf commented 3 years ago

This leads to a weird UX: If I ask for write access using NativeShare, only the general write permission popup shows. But if I later actually save a photo using NatShare, a second permission pops up (this time, only asking the user which album should be used). If I can trust the explanation of the NativeShare package, this addition permission would be useless, because iOS ignores the album anyways. So maybe NatShare should be adapted to reflect this change?

I'm not sure if this change actually affects NatShare. NatShare uses PHPhotoLibrary directly, and the process to add items to an album is slightly different. Feel free to create a separate issue for this; I'll try running the test to see if saving to an album works on iOS 14. I can't remember the last time I ran the suite of tests.

olokobayusuf commented 2 years ago

This has been added in NatShare 1.3.