Linking the getTransfersWithMissingValueIn method to the repository, viewmodel and activity
This commit is contained in:
parent
f197e44262
commit
771aed9429
3 changed files with 20 additions and 1 deletions
|
@ -26,6 +26,7 @@ import cy.agorise.bitsybitshareswallet.viewmodels.UserAccountViewModel
|
||||||
import cy.agorise.graphenej.Asset
|
import cy.agorise.graphenej.Asset
|
||||||
import cy.agorise.graphenej.AssetAmount
|
import cy.agorise.graphenej.AssetAmount
|
||||||
import cy.agorise.graphenej.UserAccount
|
import cy.agorise.graphenej.UserAccount
|
||||||
|
import cy.agorise.graphenej.api.ApiAccess
|
||||||
import cy.agorise.graphenej.api.ConnectionStatusUpdate
|
import cy.agorise.graphenej.api.ConnectionStatusUpdate
|
||||||
import cy.agorise.graphenej.api.android.NetworkService
|
import cy.agorise.graphenej.api.android.NetworkService
|
||||||
import cy.agorise.graphenej.api.android.RxBus
|
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
|
// If we got a disconnection notification, we should clear our response map, since
|
||||||
// all its stored request ids will now be reset
|
// all its stored request ids will now be reset
|
||||||
responseMap.clear()
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,10 @@ class TransferRepository internal constructor(context: Context) {
|
||||||
return mTransferDao.getTransferBlockNumberWithMissingTime()
|
return mTransferDao.getTransferBlockNumberWithMissingTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getTransfersWithMissingValueIn(symbol: String): LiveData<List<Transfer>> {
|
||||||
|
return mTransferDao.getTransfersWithMissingValueIn(symbol)
|
||||||
|
}
|
||||||
|
|
||||||
fun deleteAll() {
|
fun deleteAll() {
|
||||||
deleteAllAsyncTask(mTransferDao).execute()
|
deleteAllAsyncTask(mTransferDao).execute()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
package cy.agorise.bitsybitshareswallet.viewmodels
|
package cy.agorise.bitsybitshareswallet.viewmodels
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
|
import android.util.Log
|
||||||
import androidx.lifecycle.AndroidViewModel
|
import androidx.lifecycle.AndroidViewModel
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import cy.agorise.bitsybitshareswallet.repositories.TransferRepository
|
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) {
|
class TransferViewModel(application: Application) : AndroidViewModel(application) {
|
||||||
|
private val TAG = "TransferViewModel"
|
||||||
private var mRepository = TransferRepository(application)
|
private var mRepository = TransferRepository(application)
|
||||||
|
|
||||||
internal fun setBlockTime(blockNumber: Long, timestamp: Long) {
|
internal fun setBlockTime(blockNumber: Long, timestamp: Long) {
|
||||||
|
@ -15,4 +20,8 @@ class TransferViewModel(application: Application) : AndroidViewModel(application
|
||||||
internal fun getTransferBlockNumberWithMissingTime(): LiveData<Long> {
|
internal fun getTransferBlockNumberWithMissingTime(): LiveData<Long> {
|
||||||
return mRepository.getTransferBlockNumberWithMissingTime()
|
return mRepository.getTransferBlockNumberWithMissingTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getTransfersWithMissingValueIn(symbol: String) {
|
||||||
|
mRepository.getTransfersWithMissingValueIn(symbol)
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue