Linking the getTransfersWithMissingValueIn method to the repository, viewmodel and activity

This commit is contained in:
Nelson R. Perez 2019-01-31 21:33:44 -05:00
parent f197e44262
commit 771aed9429
3 changed files with 20 additions and 1 deletions

View file

@ -26,6 +26,7 @@ import cy.agorise.bitsybitshareswallet.viewmodels.UserAccountViewModel
import cy.agorise.graphenej.Asset
import cy.agorise.graphenej.AssetAmount
import cy.agorise.graphenej.UserAccount
import cy.agorise.graphenej.api.ApiAccess
import cy.agorise.graphenej.api.ConnectionStatusUpdate
import cy.agorise.graphenej.api.android.NetworkService
import cy.agorise.graphenej.api.android.RxBus
@ -223,6 +224,11 @@ abstract class ConnectedActivity : AppCompatActivity(), ServiceConnection {
// If we got a disconnection notification, we should clear our response map, since
// all its stored request ids will now be reset
responseMap.clear()
} else if (message.updateCode == ConnectionStatusUpdate.API_UPDATE) {
// If we got an API update
if(message.api == ApiAccess.API_HISTORY) {
//TODO: Start the procedure that will obtain the missing equivalent values
}
}
}
}

View file

@ -37,6 +37,10 @@ class TransferRepository internal constructor(context: Context) {
return mTransferDao.getTransferBlockNumberWithMissingTime()
}
fun getTransfersWithMissingValueIn(symbol: String): LiveData<List<Transfer>> {
return mTransferDao.getTransfersWithMissingValueIn(symbol)
}
fun deleteAll() {
deleteAllAsyncTask(mTransferDao).execute()
}

View file

@ -1,11 +1,16 @@
package cy.agorise.bitsybitshareswallet.viewmodels
import android.app.Application
import android.util.Log
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import cy.agorise.bitsybitshareswallet.repositories.TransferRepository
import io.reactivex.Observable
import io.reactivex.functions.Function
import io.reactivex.schedulers.Schedulers
class TransferViewModel(application: Application) : AndroidViewModel(application) {
private val TAG = "TransferViewModel"
private var mRepository = TransferRepository(application)
internal fun setBlockTime(blockNumber: Long, timestamp: Long) {
@ -15,4 +20,8 @@ class TransferViewModel(application: Application) : AndroidViewModel(application
internal fun getTransferBlockNumberWithMissingTime(): LiveData<Long> {
return mRepository.getTransferBlockNumberWithMissingTime()
}
}
fun getTransfersWithMissingValueIn(symbol: String) {
mRepository.getTransfersWithMissingValueIn(symbol)
}
}