diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/ConnectedActivity.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/ConnectedActivity.kt index 2230daa..ed01a6a 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/ConnectedActivity.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/activities/ConnectedActivity.kt @@ -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 + } } } } diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/repositories/TransferRepository.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/repositories/TransferRepository.kt index 7f328d5..7b70063 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/repositories/TransferRepository.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/repositories/TransferRepository.kt @@ -37,6 +37,10 @@ class TransferRepository internal constructor(context: Context) { return mTransferDao.getTransferBlockNumberWithMissingTime() } + fun getTransfersWithMissingValueIn(symbol: String): LiveData> { + return mTransferDao.getTransfersWithMissingValueIn(symbol) + } + fun deleteAll() { deleteAllAsyncTask(mTransferDao).execute() } diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/viewmodels/TransferViewModel.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/viewmodels/TransferViewModel.kt index 484d72c..16e959f 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/viewmodels/TransferViewModel.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/viewmodels/TransferViewModel.kt @@ -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 { return mRepository.getTransferBlockNumberWithMissingTime() } -} \ No newline at end of file + + fun getTransfersWithMissingValueIn(symbol: String) { + mRepository.getTransfersWithMissingValueIn(symbol) + } +}