Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make stateless BSFormatter functions static and remove dead code #3239

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/main/java/bisq/core/app/WalletAppSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void init(@Nullable Consumer<String> chainFileLockedExceptionHandler,
result = Res.get("mainView.footer.btcInfo",
peers,
Res.get("mainView.footer.btcInfo.synchronizingWith"),
getBtcNetworkAsString() + ": " + formatter.formatToPercentWithSymbol(percentage));
getBtcNetworkAsString() + ": " + BSFormatter.formatToPercentWithSymbol(percentage));
} else {
result = Res.get("mainView.footer.btcInfo",
peers,
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/java/bisq/core/dao/presentation/DaoUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public static String getNextPhaseDuration(int height, DaoPhase.Phase phase, DaoF
long now = new Date().getTime();
SimpleDateFormat dateFormatter = new SimpleDateFormat("dd MMM", Locale.getDefault());
SimpleDateFormat timeFormatter = new SimpleDateFormat("HH:mm", Locale.getDefault());
String startDateTime = formatter.formatDateTime(new Date(now + (start - height) * 10 * 60 * 1000L), dateFormatter, timeFormatter);
String endDateTime = formatter.formatDateTime(new Date(now + (end - height) * 10 * 60 * 1000L), dateFormatter, timeFormatter);
String startDateTime = BSFormatter.formatDateTime(new Date(now + (start - height) * 10 * 60 * 1000L), dateFormatter, timeFormatter);
String endDateTime = BSFormatter.formatDateTime(new Date(now + (end - height) * 10 * 60 * 1000L), dateFormatter, timeFormatter);

return Res.get("dao.cycle.phaseDurationWithoutBlocks", start, end, startDateTime, endDateTime);
}
Expand All @@ -53,9 +53,9 @@ public static String getPhaseDuration(int height, DaoPhase.Phase phase, DaoFacad
long now = new Date().getTime();
SimpleDateFormat dateFormatter = new SimpleDateFormat("dd MMM", Locale.getDefault());
SimpleDateFormat timeFormatter = new SimpleDateFormat("HH:mm", Locale.getDefault());
String startDateTime = formatter.formatDateTime(new Date(now + (start - height) * 10 * 60 * 1000L), dateFormatter, timeFormatter);
String endDateTime = formatter.formatDateTime(new Date(now + (end - height) * 10 * 60 * 1000L), dateFormatter, timeFormatter);
String durationTime = formatter.formatDurationAsWords(duration * 10 * 60 * 1000, false, false);
String startDateTime = BSFormatter.formatDateTime(new Date(now + (start - height) * 10 * 60 * 1000L), dateFormatter, timeFormatter);
String endDateTime = BSFormatter.formatDateTime(new Date(now + (end - height) * 10 * 60 * 1000L), dateFormatter, timeFormatter);
String durationTime = BSFormatter.formatDurationAsWords(duration * 10 * 60 * 1000, false, false);
return Res.get("dao.cycle.phaseDuration", duration, durationTime, start, end, startDateTime, endDateTime);
}
}
3 changes: 2 additions & 1 deletion core/src/main/java/bisq/core/dao/state/DaoStateService.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import bisq.core.dao.state.model.governance.Issuance;
import bisq.core.dao.state.model.governance.IssuanceType;
import bisq.core.dao.state.model.governance.ParamChange;
import bisq.core.util.BSFormatter;
import bisq.core.util.BsqFormatter;

import org.bitcoinj.core.Coin;
Expand Down Expand Up @@ -923,7 +924,7 @@ public Coin getParamValueAsCoin(Param param, String paramValue) {
}

public double getParamValueAsPercentDouble(String paramValue) {
return bsqFormatter.parsePercentStringToDouble(paramValue);
return BSFormatter.parsePercentStringToDouble(paramValue);
}

public int getParamValueAsBlock(String paramValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ else if (!isFiatCurrency && !isSellOffer)
ratio = Math.abs(ratio);
String msg = Res.get("account.notifications.marketAlert.message.msg",
direction,
formatter.getCurrencyPair(currencyCode),
BSFormatter.getCurrencyPair(currencyCode),
formatter.formatPrice(offerPrice),
formatter.formatToPercentWithSymbol(ratio / 10000d),
BSFormatter.formatToPercentWithSymbol(ratio / 10000d),
marketDir,
Res.get(offer.getPaymentMethod().getId()),
shortOfferId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ private void update() {
if (priceAsLong > filter.getHigh() || priceAsLong < filter.getLow()) {
String msg = Res.get("account.notifications.priceAlert.message.msg",
currencyName,
formatter.formatMarketPrice(priceAsDouble, currencyCode),
formatter.getCurrencyPair(currencyCode));
BSFormatter.formatMarketPrice(priceAsDouble, currencyCode),
BSFormatter.getCurrencyPair(currencyCode));
MobileMessage message = new MobileMessage(Res.get("account.notifications.priceAlert.message.title", currencyName),
msg,
MobileMessageType.PRICE);
Expand Down
Loading