Coder Social home page Coder Social logo

Comments (3)

mikkoh avatar mikkoh commented on July 30, 2024

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.

from natshare.

olokobayusuf avatar olokobayusuf commented on July 30, 2024

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).

from natshare.

olokobayusuf avatar olokobayusuf commented on July 30, 2024

Implemented in 230a472

from natshare.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.