textileio / ios-textile

[DEPRECATED] iOS bindings for https://github.com/textileio/go-textile
MIT License
10 stars 6 forks source link

Need a stop node confirmation callback #42

Open asutula opened 5 years ago

asutula commented 5 years ago

Currently, the native sdk stops the node exactly when it decides it needs to. I think we need to delegate the exact timing to the host application. Would go something like:

  1. Native sdk sets timer to run the node in the background for a period of time
  2. When that timer is up, we send a callback to the host application notifying it that the node needs to be stopped asap. That callback passes a block/closure that the host app will call once it is ready to have the node stop
  3. The native sdk stops the node once that block/closure is called.
  4. If the block/closure isn't called within n milliseconds, the node is stopped anyway.

The use case for something like this exists in the Photos app where we need to process camera roll photos, adding them to Textile. That takes time, time during which the node might need to shut down. This allows us to finish processing the currently running photo adds, and then allow the node to stop.