Skip to content

Commit

Permalink
fix: [#266] add null checking and default value based on iOS since ge…
Browse files Browse the repository at this point in the history
…tCurrency can produce null (#278)

* fix: [#266] add null checking and default value based on iOS since getCurrency can produce null

* chore: [#266] cleanup comment
  • Loading branch information
andhikayuana authored Nov 21, 2024
1 parent aedf585 commit 342ae91
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/src/main/java/com/breadwallet/tools/util/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,13 @@ else if (name == PartnerNames.PUSHERSTAGING) {
/// Description: 1715876807
public static long tieredOpsFee(Context app, long sendAmount) {

double doubleRate = 83.000;
double sendAmountDouble = new Double(String.valueOf(sendAmount));
String usIso = Currency.getInstance(new Locale("en", "US")).getCurrencyCode();
CurrencyEntity currency = CurrencyDataSource.getInstance(app).getCurrencyByIso(usIso);
double doubleRate = currency.rate;
if (currency != null) {
doubleRate = currency.rate;
}
double usdInLTC = sendAmountDouble * doubleRate / 100_000_000.0;
usdInLTC = Math.floor(usdInLTC * 100) / 100;

Expand Down

0 comments on commit 342ae91

Please sign in to comment.