Transactions with empty Model are not calling the TransactionListener
Hello,
I have found a possible issue regarding the Transactions and TransactionListeners. My problem is that I am receiving some data from a web services and storing them into a local database implemented using DBFlow. Eventually, the data from the web services might be empty, which provokes that my code tries to save an empty list into the database.
I am using a TransactionListener to check that the process has finished to inform the UI and stop a progress bar. The problem is that empty transactions are not calling the Transaction Listener so my progress bar never finishes in this case.
I have done some research and the problem exists at DBTransactionQueue:58, where the method onReady returns false as the Model is empty. This provokes the Listener is not called.
I think this might be an issue, however this might be the expected behavior. I found this a little missleading as I would expect one callback at least (sucess or error), but I would never expect not having a response. The solution was easy but I think my code would be cleaner with the expected behavior of the Listener.
I hope this may help you and congratulations for your great library!
Cheers
@jesdiart You will need to subclass ModelTransaction and override onReady(). Return true here, otherwise empty lists will not return a result.