Skip to content
This repository was archived by the owner on Jun 14, 2018. It is now read-only.

Commit 15076be

Browse files
author
Anschutz1927
committed
reopen realm if unavailable, fixed amount via qr scan
1 parent 55c8b4a commit 15076be

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ android {
5757
resValue "string", "base_url", "https://api.multy.io/"
5858
}
5959
stage {
60-
resValue "string", "base_url", "http://stage.multy.io/"
60+
resValue "string", "base_url", "https://stage.multy.io/"
6161
}
6262
multyTest {
63-
resValue "string", "base_url", "http://test.multy.io/"
63+
resValue "string", "base_url", "https://test.multy.io/"
6464
}
6565
}
6666
variantFilter { variant ->

app/src/main/java/io/multy/storage/RealmManager.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@
77
package io.multy.storage;
88

99
import android.content.Context;
10-
import android.util.Log;
1110

1211
import java.io.File;
1312

1413
import io.multy.Multy;
1514
import io.realm.Realm;
16-
import timber.log.Timber;
1715

1816
public class RealmManager {
1917

@@ -67,7 +65,7 @@ public static void clear() {
6765
private static void isRealmAvailable() {
6866
try {
6967
if (realm == null || realm.isClosed()) {
70-
Log.e(TAG, "ERROR DB IS CLOSED OR NULL");
68+
throw new IllegalStateException("ERROR DB IS CLOSED OR NULL");
7169
}
7270
} catch (IllegalStateException e) {
7371
e.printStackTrace();

app/src/main/java/io/multy/ui/fragments/send/WalletChooserFragment.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,16 @@ private void proceed(Wallet wallet) {
118118
return;
119119
}
120120
if (viewModel.isAmountScanned()) {
121-
if (Double.parseDouble(CryptoFormatUtils
122-
.satoshiToBtc(wallet.getPendingBalance().longValue())) >= viewModel.getAmount()) {
121+
double walletAmount = 0;
122+
switch (NativeDataHelper.Blockchain.valueOf(wallet.getCurrencyId())) {
123+
case BTC:
124+
walletAmount = CryptoFormatUtils.satoshiToBtcDouble(wallet.getAvailableBalanceNumeric().longValue());
125+
break;
126+
case ETH:
127+
walletAmount = CryptoFormatUtils.weiToEth(wallet.getAvailableBalance());
128+
break;
129+
}
130+
if (walletAmount >= viewModel.getAmount()) {
123131
launchTransactionFee(wallet);
124132
} else {
125133
Toast.makeText(getContext(), getString(R.string.no_balance), Toast.LENGTH_SHORT).show();

0 commit comments

Comments
 (0)