firebase-kotlin-sdk icon indicating copy to clipboard operation
firebase-kotlin-sdk copied to clipboard

[firebase-database] Add more customization to "doTransaction" callback

Open Tosunyan opened this issue 2 years ago • 0 comments
trafficstars

Currently, the "doTransaction" callback provides limited customization, which makes it difficult for users like me to implement certain functionalities.

Here is the code snippet from the library:

override fun doTransaction(currentData: MutableData): Transaction.Result {
    currentData.value = currentData.value?.let {
        transactionUpdate(decode(strategy, it))
    }
    return Transaction.success(currentData)
}

And the implementation I currently have

override fun doTransaction(mutableData: MutableData): Transaction.Result {
    if (mutableData.value == null) {
        mutableData.value = actionMap
        return Transaction.success(mutableData)
    }

    return Transaction.abort()
}

Tosunyan avatar Aug 02 '23 14:08 Tosunyan