diff --git a/mbw/src/main/java/com/mycelium/wallet/external/changelly/ChangellyAPIService.kt b/mbw/src/main/java/com/mycelium/wallet/external/changelly/ChangellyAPIService.kt index a7482ddbb..f5afd0a2b 100644 --- a/mbw/src/main/java/com/mycelium/wallet/external/changelly/ChangellyAPIService.kt +++ b/mbw/src/main/java/com/mycelium/wallet/external/changelly/ChangellyAPIService.kt @@ -100,10 +100,10 @@ interface ChangellyAPIService { ): Response>> - @TestOnly - @POST("getFixRate") - suspend fun getFixRate(@Query("from") from: String, - @Query("to") to: String): Response> +// @TestOnly +// @POST("getFixRate") +// suspend fun getFixRateTest(@Query("from") from: String, +// @Query("to") to: String): Response> companion object { diff --git a/mbw/src/main/java/com/mycelium/wallet/external/changelly/ChangellyOfferActivity.java b/mbw/src/main/java/com/mycelium/wallet/external/changelly/ChangellyOfferActivity.java index bfd999d9b..51c15810e 100644 --- a/mbw/src/main/java/com/mycelium/wallet/external/changelly/ChangellyOfferActivity.java +++ b/mbw/src/main/java/com/mycelium/wallet/external/changelly/ChangellyOfferActivity.java @@ -208,7 +208,7 @@ public GetOfferCallback(double amountFrom) { public void onResponse(@NonNull Call> call, @NonNull Response> response) { ChangellyResponse result = response.body(); - if(result != null && !result.getResult().isEmpty()) { + if(result != null && result.getResult() != null) { progressDialog.dismiss(); // if the amount changed after the offer was requested but before the offer was // received, we reset the amount to the requested amount instead of ignoring the @@ -216,7 +216,7 @@ public void onResponse(@NonNull Call response?.result?.first()?.let { result -> - binding?.toolbar?.title = result.first().getReadableStatus("exchange") - viewModel.setTransaction(result.first()) + binding?.toolbar?.title = result.getReadableStatus("exchange") + viewModel.setTransaction(result) } ?: let { AlertDialog.Builder(requireContext()) .setMessage(response?.error?.message) diff --git a/mbw/src/main/java/com/mycelium/wallet/external/changelly2/HistoryFragment.kt b/mbw/src/main/java/com/mycelium/wallet/external/changelly2/HistoryFragment.kt index 347c51462..d14ae8f0d 100644 --- a/mbw/src/main/java/com/mycelium/wallet/external/changelly2/HistoryFragment.kt +++ b/mbw/src/main/java/com/mycelium/wallet/external/changelly2/HistoryFragment.kt @@ -69,13 +69,13 @@ class HistoryFragment : DialogFragment() { Changelly2Repository.getTransactions(lifecycleScope, txIds, { it?.result?.first()?.let { - adapter.submitList(it.map { + adapter.submitList(listOf( TxItem(it.id, it.amountExpectedFrom.toString(), it.getExpectedAmount().toString(), it.fixedCurrencyFrom(), it.fixedCurrencyTo(), DateFormat.getDateInstance(DateFormat.LONG).format(Date(it.createdAt * 1000L)), - it.getReadableStatus()) - }) + it.getReadableStatus())) + ) } }, { _, _ -> diff --git a/mbw/src/main/java/com/mycelium/wallet/external/changelly2/viewmodel/ExchangeViewModel.kt b/mbw/src/main/java/com/mycelium/wallet/external/changelly2/viewmodel/ExchangeViewModel.kt index 2a0f17202..dd6e99246 100644 --- a/mbw/src/main/java/com/mycelium/wallet/external/changelly2/viewmodel/ExchangeViewModel.kt +++ b/mbw/src/main/java/com/mycelium/wallet/external/changelly2/viewmodel/ExchangeViewModel.kt @@ -14,7 +14,6 @@ import com.mycelium.wallet.WalletApplication import com.mycelium.wallet.activity.util.toStringFriendlyWithUnit import com.mycelium.wallet.activity.util.toStringWithUnit import com.mycelium.wallet.external.changelly.model.FixRate -import com.mycelium.wallet.external.changelly.model.FixRateForAmount import com.mycelium.wapi.wallet.Address import com.mycelium.wapi.wallet.Transaction import com.mycelium.wapi.wallet.Util @@ -35,7 +34,7 @@ class ExchangeViewModel(application: Application) : AndroidViewModel(application val mbwManager = MbwManager.getInstance(WalletApplication.getInstance()) var currencies = setOf("BTC", "ETH") val fromAccount = MutableLiveData>() - val exchangeInfo = MutableLiveData() + val exchangeInfo = MutableLiveData() val sellValue = object : MutableLiveData() { override fun setValue(value: String?) { if (this.value != value) { @@ -152,7 +151,7 @@ class ExchangeViewModel(application: Application) : AndroidViewModel(application } val exchangeRateToValue = Transformations.map(exchangeInfo) { - it.getExpectedValue().toPlainString() + it.result.toPlainString() } val exchangeRateToCurrency = Transformations.map(exchangeInfo) {