Zhuinden/realm-monarchy

Callbacks for Monarchy.writeAsync

Closed this issue · 2 comments

In one of our projects, we're using Realm.executeTransactionAsync() with onSuccess() and onError() callbacks. However, Monarchy's method writeAsync() doesn't have them. How would you suggest to do this with Monarchy?

Thanks in advance

writeAsync runs the transaction on a single threaded executor, and the code that Realm uses to delay success/failure callbacks until the UI thread Realm has been updated is super-internal (I think it's an OSSchemaVersionCallback? Something like that) so by default my assumption is that you'll be notified of changes anyway via RealmChangeListeners on RealmResults

If you really need the ability to executeTransactionAsync with a UI thread callback once the bg thread has succeeded AND the UI thread has been updated, you'd need to go through a Realm instance directly, because it's not exposed to me in such a way that I'd find it reliable to use it in Monarchy.

Okay, I understand. Just for the sake of completeness, the point of our use case is that we cache the time when data in Realm have been updated. I think RealmChangeListeners wouldn't be the right approach for this. I'm closing the issue as there's probably nothing to be done on the side of Monarchy.

Thanks for quick response