Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

Add copy argument to SaveToCameraRoll #38

Closed
olokobayusuf opened this issue Oct 26, 2018 · 3 comments
Closed

Add copy argument to SaveToCameraRoll #38

olokobayusuf opened this issue Oct 26, 2018 · 3 comments
Labels
android Issues that affect Android ios Issues that affect iOS

Comments

@olokobayusuf
Copy link
Collaborator

When copy is false, the media file will be deleted from the app's private documents directory once it has been added to the camera roll. The default will be copy = true

This was referenced Oct 26, 2018
@mikkoh
Copy link

mikkoh commented Oct 27, 2018

So this is definitely cool. However if someone wants to do something like the following sequence:

  1. SaveToCameraRoll
  2. Share*
  3. Delete the file that was saved to camera roll and shared

If I do copy = false during Step #1 then I won't be able to share. I still think the right fix is to add a callback for when SaveToCameraRoll completes.

This is why in iOS they have completionHandler. I really wish Unity just added something beside SendMessage to specifically handle callbacks. It's such bad api design not to. Although I guess 3ps can create a lib thats like a messaging bridge.

@olokobayusuf
Copy link
Collaborator Author

However if someone wants to do something like the following sequence:
...
If I do copy = false during Step #1 then I won't be able to share. I still think the right fix is to add a callback for when SaveToCameraRoll completes.

This would be fine, since you can use the ShareCallback when calling Share to delete the file.

This is why in iOS they have completionHandler. I really wish Unity just added something beside SendMessage to specifically handle callbacks. It's such bad api design not to.

I agree with this. We never use UnitySendMessage because it is very sloppy (you are limited to one string argument). So instead we use C# delegates invoked directly from C++/C/Obj-C. It's much much more flexible, but we have to manually handle threading concerns (because most of the time, the thread that calls back into C# isn't UnityMain, and we all know how Unity hates its API's being called on non-main threads).

@olokobayusuf olokobayusuf added ios Issues that affect iOS android Issues that affect Android labels Nov 3, 2018
@olokobayusuf
Copy link
Collaborator Author

Implemented in 230a472

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
android Issues that affect Android ios Issues that affect iOS
Projects
None yet
Development

No branches or pull requests

2 participants