switch from controlsfx platform to drongo ostype

This commit is contained in:
Craig Raw 2024-11-26 11:30:32 +02:00
parent fffa636956
commit 6927423d68
26 changed files with 88 additions and 83 deletions

2
drongo

@ -1 +1 @@
Subproject commit a26ba49bc6d2431bf72eba6e77c314ed9345d80e Subproject commit 3cb3d322a0e1d821aea195d34c6ac9af89ed38b8

View file

@ -431,8 +431,8 @@ public class AppController implements Initializable {
} }
private void registerShortcuts() { private void registerShortcuts() {
org.controlsfx.tools.Platform platform = org.controlsfx.tools.Platform.getCurrent(); OsType osType = OsType.getCurrent();
if(platform == org.controlsfx.tools.Platform.OSX) { if(osType == OsType.MACOS) {
tabs.getScene().addEventFilter(KeyEvent.KEY_PRESSED, event -> { tabs.getScene().addEventFilter(KeyEvent.KEY_PRESSED, event -> {
if(event.isShortcutDown() && event.isAltDown() && (event.getCode() == KeyCode.LEFT || event.getCode() == KeyCode.RIGHT)) { if(event.isShortcutDown() && event.isAltDown() && (event.getCode() == KeyCode.LEFT || event.getCode() == KeyCode.RIGHT)) {
int currentIndex = tabs.getSelectionModel().getSelectedIndex(); int currentIndex = tabs.getSelectionModel().getSelectedIndex();
@ -447,8 +447,8 @@ public class AppController implements Initializable {
} }
private void setPlatformApplicationMenu() { private void setPlatformApplicationMenu() {
org.controlsfx.tools.Platform platform = org.controlsfx.tools.Platform.getCurrent(); OsType osType = OsType.getCurrent();
if(platform == org.controlsfx.tools.Platform.OSX) { if(osType == OsType.MACOS) {
MenuToolkit tk = MenuToolkit.toolkit(); MenuToolkit tk = MenuToolkit.toolkit();
MenuItem preferences = new MenuItem("Preferences..."); MenuItem preferences = new MenuItem("Preferences...");
preferences.setOnAction(this::openPreferences); preferences.setOnAction(this::openPreferences);
@ -462,11 +462,11 @@ public class AppController implements Initializable {
fileMenu.getItems().removeIf(item -> item.getStyleClass().contains("osxHide")); fileMenu.getItems().removeIf(item -> item.getStyleClass().contains("osxHide"));
toolsMenu.getItems().removeIf(item -> item.getStyleClass().contains("osxHide")); toolsMenu.getItems().removeIf(item -> item.getStyleClass().contains("osxHide"));
helpMenu.getItems().removeIf(item -> item.getStyleClass().contains("osxHide")); helpMenu.getItems().removeIf(item -> item.getStyleClass().contains("osxHide"));
} else if(platform == org.controlsfx.tools.Platform.WINDOWS) { } else if(osType == OsType.WINDOWS) {
toolsMenu.getItems().removeIf(item -> item.getStyleClass().contains("windowsHide")); toolsMenu.getItems().removeIf(item -> item.getStyleClass().contains("windowsHide"));
} }
if(platform == org.controlsfx.tools.Platform.UNIX || !TrayManager.isSupported()) { if(osType == OsType.UNIX || !TrayManager.isSupported()) {
viewMenu.getItems().remove(minimizeToTray); viewMenu.getItems().remove(minimizeToTray);
} }
} }
@ -538,7 +538,7 @@ public class AppController implements Initializable {
StackPane root = loader.load(); StackPane root = loader.load();
AboutController controller = loader.getController(); AboutController controller = loader.getController();
if(org.controlsfx.tools.Platform.getCurrent() == org.controlsfx.tools.Platform.WINDOWS) { if(OsType.getCurrent() == OsType.WINDOWS) {
root.setBorder(new Border(new BorderStroke(Color.DARKGRAY, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT))); root.setBorder(new Border(new BorderStroke(Color.DARKGRAY, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
} }
@ -590,7 +590,7 @@ public class AppController implements Initializable {
FileChooser fileChooser = new FileChooser(); FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Open Transaction"); fileChooser.setTitle("Open Transaction");
fileChooser.getExtensionFilters().addAll( fileChooser.getExtensionFilters().addAll(
new FileChooser.ExtensionFilter("All Files", org.controlsfx.tools.Platform.getCurrent().equals(org.controlsfx.tools.Platform.UNIX) ? "*" : "*.*"), new FileChooser.ExtensionFilter("All Files", OsType.getCurrent().equals(OsType.UNIX) ? "*" : "*.*"),
new FileChooser.ExtensionFilter("PSBT", "*.psbt"), new FileChooser.ExtensionFilter("PSBT", "*.psbt"),
new FileChooser.ExtensionFilter("TXN", "*.txn") new FileChooser.ExtensionFilter("TXN", "*.txn")
); );
@ -2098,7 +2098,7 @@ public class AppController implements Initializable {
FileChooser fileChooser = new FileChooser(); FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Open Image"); fileChooser.setTitle("Open Image");
fileChooser.getExtensionFilters().addAll( fileChooser.getExtensionFilters().addAll(
new FileChooser.ExtensionFilter("All Files", org.controlsfx.tools.Platform.getCurrent().equals(org.controlsfx.tools.Platform.UNIX) ? "*" : "*.*"), new FileChooser.ExtensionFilter("All Files", OsType.getCurrent().equals(OsType.UNIX) ? "*" : "*.*"),
new FileChooser.ExtensionFilter("Images", "*.png", "*.jpg", "*.jpeg", "*.gif") new FileChooser.ExtensionFilter("Images", "*.png", "*.jpg", "*.jpeg", "*.gif")
); );

View file

@ -3,6 +3,7 @@ package com.sparrowwallet.sparrow;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
import com.google.common.net.HostAndPort; import com.google.common.net.HostAndPort;
import com.sparrowwallet.drongo.Network; import com.sparrowwallet.drongo.Network;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.drongo.SecureString; import com.sparrowwallet.drongo.SecureString;
import com.sparrowwallet.drongo.address.Address; import com.sparrowwallet.drongo.address.Address;
import com.sparrowwallet.drongo.bip47.PaymentCode; import com.sparrowwallet.drongo.bip47.PaymentCode;
@ -379,7 +380,7 @@ public class AppServices {
exchangeSource == null ? DEFAULT_EXCHANGE_SOURCE : exchangeSource, exchangeSource == null ? DEFAULT_EXCHANGE_SOURCE : exchangeSource,
currency == null ? DEFAULT_FIAT_CURRENCY : currency); currency == null ? DEFAULT_FIAT_CURRENCY : currency);
//Delay startup on first run, Windows requires a longer delay //Delay startup on first run, Windows requires a longer delay
ratesService.setDelay(org.controlsfx.tools.Platform.getCurrent() == org.controlsfx.tools.Platform.WINDOWS ? Duration.seconds(RATES_DELAY_SECS_WINDOWS) : Duration.seconds(RATES_DELAY_SECS_DEFAULT)); ratesService.setDelay(OsType.getCurrent() == OsType.WINDOWS ? Duration.seconds(RATES_DELAY_SECS_WINDOWS) : Duration.seconds(RATES_DELAY_SECS_DEFAULT));
ratesService.setPeriod(Duration.seconds(RATES_PERIOD_SECS)); ratesService.setPeriod(Duration.seconds(RATES_PERIOD_SECS));
ratesService.setRestartOnFailure(true); ratesService.setRestartOnFailure(true);
@ -619,7 +620,7 @@ public class AppServices {
} }
private static double getReducedWindowHeight() { private static double getReducedWindowHeight() {
return org.controlsfx.tools.Platform.getCurrent() != org.controlsfx.tools.Platform.OSX ? 802d : 768d; //Check for menu bar of ~34px return OsType.getCurrent() != OsType.MACOS ? 802d : 768d; //Check for menu bar of ~34px
} }
public Application getApplication() { public Application getApplication() {
@ -1143,7 +1144,7 @@ public class AppServices {
} }
public static boolean isOnWayland() { public static boolean isOnWayland() {
if(org.controlsfx.tools.Platform.getCurrent() != org.controlsfx.tools.Platform.UNIX) { if(OsType.getCurrent() != OsType.UNIX) {
return false; return false;
} }

View file

@ -1,5 +1,6 @@
package com.sparrowwallet.sparrow; package com.sparrowwallet.sparrow;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.drongo.wallet.Keystore; import com.sparrowwallet.drongo.wallet.Keystore;
import com.sparrowwallet.sparrow.control.KeystorePassphraseDialog; import com.sparrowwallet.sparrow.control.KeystorePassphraseDialog;
import com.sparrowwallet.sparrow.control.TextUtils; import com.sparrowwallet.sparrow.control.TextUtils;
@ -48,7 +49,7 @@ public class DefaultInteractionServices implements InteractionServices {
} }
String[] lines = content.split("\r\n|\r|\n"); String[] lines = content.split("\r\n|\r|\n");
if(lines.length > 3 || org.controlsfx.tools.Platform.getCurrent() == org.controlsfx.tools.Platform.WINDOWS) { if(lines.length > 3 || OsType.getCurrent() == OsType.WINDOWS) {
double numLines = Arrays.stream(lines).mapToDouble(line -> Math.ceil(TextUtils.computeTextWidth(Font.getDefault(), line, 0) / 300)).sum(); double numLines = Arrays.stream(lines).mapToDouble(line -> Math.ceil(TextUtils.computeTextWidth(Font.getDefault(), line, 0) / 300)).sum();
alert.getDialogPane().setPrefHeight(200 + numLines * 20); alert.getDialogPane().setPrefHeight(200 + numLines * 20);
} }

View file

@ -1,6 +1,7 @@
package com.sparrowwallet.sparrow; package com.sparrowwallet.sparrow;
import com.sparrowwallet.drongo.Network; import com.sparrowwallet.drongo.Network;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.drongo.wallet.Wallet; import com.sparrowwallet.drongo.wallet.Wallet;
import com.sparrowwallet.sparrow.control.WalletIcon; import com.sparrowwallet.sparrow.control.WalletIcon;
import com.sparrowwallet.sparrow.glyphfont.FontAwesome5; import com.sparrowwallet.sparrow.glyphfont.FontAwesome5;
@ -15,7 +16,6 @@ import javafx.application.Application;
import javafx.scene.text.Font; import javafx.scene.text.Font;
import javafx.stage.Stage; import javafx.stage.Stage;
import org.controlsfx.glyphfont.GlyphFontRegistry; import org.controlsfx.glyphfont.GlyphFontRegistry;
import org.controlsfx.tools.Platform;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
@ -72,7 +72,7 @@ public class SparrowDesktop extends Application {
Config.get().setServerType(ServerType.ELECTRUM_SERVER); Config.get().setServerType(ServerType.ELECTRUM_SERVER);
} }
if(Config.get().getHdCapture() == null && Platform.getCurrent() == Platform.OSX) { if(Config.get().getHdCapture() == null && OsType.getCurrent() == OsType.MACOS) {
Config.get().setHdCapture(Boolean.TRUE); Config.get().setHdCapture(Boolean.TRUE);
} }
@ -119,7 +119,7 @@ public class SparrowDesktop extends Application {
GlyphFontRegistry.register(new FontAwesome5Brands()); GlyphFontRegistry.register(new FontAwesome5Brands());
Font.loadFont(AppServices.class.getResourceAsStream("/font/RobotoMono-Regular.ttf"), 13); Font.loadFont(AppServices.class.getResourceAsStream("/font/RobotoMono-Regular.ttf"), 13);
Font.loadFont(AppServices.class.getResourceAsStream("/font/RobotoMono-Italic.ttf"), 11); Font.loadFont(AppServices.class.getResourceAsStream("/font/RobotoMono-Italic.ttf"), 11);
if(Platform.getCurrent() == Platform.OSX) { if(OsType.getCurrent() == OsType.MACOS) {
Font.loadFont(AppServices.class.getResourceAsStream("/font/LiberationSans-Regular.ttf"), 13); Font.loadFont(AppServices.class.getResourceAsStream("/font/LiberationSans-Regular.ttf"), 13);
} }
} }

View file

@ -1,6 +1,7 @@
package com.sparrowwallet.sparrow.control; package com.sparrowwallet.sparrow.control;
import com.sparrowwallet.drongo.BitcoinUnit; import com.sparrowwallet.drongo.BitcoinUnit;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.drongo.protocol.Transaction; import com.sparrowwallet.drongo.protocol.Transaction;
import com.sparrowwallet.drongo.wallet.BlockTransactionHash; import com.sparrowwallet.drongo.wallet.BlockTransactionHash;
import com.sparrowwallet.sparrow.UnitFormat; import com.sparrowwallet.sparrow.UnitFormat;
@ -16,7 +17,6 @@ import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent; import javafx.scene.input.ClipboardContent;
import javafx.scene.layout.Region; import javafx.scene.layout.Region;
import javafx.util.Duration; import javafx.util.Duration;
import org.controlsfx.tools.Platform;
import java.text.DecimalFormat; import java.text.DecimalFormat;
@ -32,7 +32,7 @@ class CoinCell extends TreeTableCell<Entry, Number> implements ConfirmationsList
tooltip.setShowDelay(Duration.millis(500)); tooltip.setShowDelay(Duration.millis(500));
contextMenu = new CoinContextMenu(); contextMenu = new CoinContextMenu();
getStyleClass().add("coin-cell"); getStyleClass().add("coin-cell");
if(Platform.getCurrent() == Platform.OSX) { if(OsType.getCurrent() == OsType.MACOS) {
getStyleClass().add("number-field"); getStyleClass().add("number-field");
} }
} }

View file

@ -1,5 +1,6 @@
package com.sparrowwallet.sparrow.control; package com.sparrowwallet.sparrow.control;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.drongo.Utils; import com.sparrowwallet.drongo.Utils;
import com.sparrowwallet.drongo.pgp.PGPKeySource; import com.sparrowwallet.drongo.pgp.PGPKeySource;
import com.sparrowwallet.drongo.pgp.PGPUtils; import com.sparrowwallet.drongo.pgp.PGPUtils;
@ -24,7 +25,6 @@ import javafx.scene.input.TransferMode;
import javafx.scene.layout.*; import javafx.scene.layout.*;
import javafx.stage.FileChooser; import javafx.stage.FileChooser;
import javafx.stage.Stage; import javafx.stage.Stage;
import org.controlsfx.tools.Platform;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import tornadofx.control.Field; import tornadofx.control.Field;
@ -500,9 +500,9 @@ public class DownloadVerifierDialog extends Dialog<ButtonBar.ButtonData> {
} }
private List<String> getReleaseFileExtensions() { private List<String> getReleaseFileExtensions() {
Platform platform = Platform.getCurrent(); OsType osType = OsType.getCurrent();
switch(platform) { switch(osType) {
case OSX -> { case MACOS -> {
return MACOS_RELEASE_EXTENSIONS; return MACOS_RELEASE_EXTENSIONS;
} }
case WINDOWS -> { case WINDOWS -> {
@ -515,10 +515,10 @@ public class DownloadVerifierDialog extends Dialog<ButtonBar.ButtonData> {
} }
private String getReleaseFileExample(String version) { private String getReleaseFileExample(String version) {
Platform platform = Platform.getCurrent(); OsType osType = OsType.getCurrent();
String arch = System.getProperty("os.arch"); String arch = System.getProperty("os.arch");
switch(platform) { switch(osType) {
case OSX -> { case MACOS -> {
return "Sparrow-" + version + "-" + arch; return "Sparrow-" + version + "-" + arch;
} }
case WINDOWS -> { case WINDOWS -> {

View file

@ -1,6 +1,7 @@
package com.sparrowwallet.sparrow.control; package com.sparrowwallet.sparrow.control;
import com.sparrowwallet.drongo.KeyPurpose; import com.sparrowwallet.drongo.KeyPurpose;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.drongo.Utils; import com.sparrowwallet.drongo.Utils;
import com.sparrowwallet.drongo.address.Address; import com.sparrowwallet.drongo.address.Address;
import com.sparrowwallet.drongo.protocol.*; import com.sparrowwallet.drongo.protocol.*;
@ -824,7 +825,7 @@ public class EntryCell extends TreeTableCell<Entry, Entry> implements Confirmati
confirmationsListener.getConfirmationsProperty().unbind(); confirmationsListener.getConfirmationsProperty().unbind();
} }
} }
if(org.controlsfx.tools.Platform.getCurrent() == org.controlsfx.tools.Platform.OSX && transactionEntry.getBlockTransaction().getHeight() > 0) { if(OsType.getCurrent() == OsType.MACOS && transactionEntry.getBlockTransaction().getHeight() > 0) {
cell.getStyleClass().add("number-field"); cell.getStyleClass().add("number-field");
} }
} else if(entry instanceof NodeEntry) { } else if(entry instanceof NodeEntry) {
@ -834,7 +835,7 @@ public class EntryCell extends TreeTableCell<Entry, Entry> implements Confirmati
if(!utxoEntry.isSpendable()) { if(!utxoEntry.isSpendable()) {
cell.getStyleClass().add("unspendable"); cell.getStyleClass().add("unspendable");
} }
if(org.controlsfx.tools.Platform.getCurrent() == org.controlsfx.tools.Platform.OSX && utxoEntry.getHashIndex().getHeight() > 0) { if(OsType.getCurrent() == OsType.MACOS && utxoEntry.getHashIndex().getHeight() > 0) {
cell.getStyleClass().add("number-field"); cell.getStyleClass().add("number-field");
} }
} else if(entry instanceof HashIndexEntry hashIndexEntry) { } else if(entry instanceof HashIndexEntry hashIndexEntry) {

View file

@ -1,5 +1,6 @@
package com.sparrowwallet.sparrow.control; package com.sparrowwallet.sparrow.control;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.drongo.protocol.Transaction; import com.sparrowwallet.drongo.protocol.Transaction;
import com.sparrowwallet.sparrow.CurrencyRate; import com.sparrowwallet.sparrow.CurrencyRate;
import com.sparrowwallet.sparrow.UnitFormat; import com.sparrowwallet.sparrow.UnitFormat;
@ -10,7 +11,6 @@ import javafx.scene.control.Tooltip;
import javafx.scene.control.TreeTableCell; import javafx.scene.control.TreeTableCell;
import javafx.scene.input.Clipboard; import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent; import javafx.scene.input.ClipboardContent;
import org.controlsfx.tools.Platform;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Currency; import java.util.Currency;
@ -24,7 +24,7 @@ public class FiatCell extends TreeTableCell<Entry, Number> {
tooltip = new Tooltip(); tooltip = new Tooltip();
contextMenu = new FiatContextMenu(); contextMenu = new FiatContextMenu();
getStyleClass().add("coin-cell"); getStyleClass().add("coin-cell");
if(Platform.getCurrent() == Platform.OSX) { if(OsType.getCurrent() == OsType.MACOS) {
getStyleClass().add("number-field"); getStyleClass().add("number-field");
} }
} }

View file

@ -1,6 +1,7 @@
package com.sparrowwallet.sparrow.control; package com.sparrowwallet.sparrow.control;
import com.google.gson.JsonParseException; import com.google.gson.JsonParseException;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.drongo.crypto.InvalidPasswordException; import com.sparrowwallet.drongo.crypto.InvalidPasswordException;
import com.sparrowwallet.drongo.protocol.ScriptType; import com.sparrowwallet.drongo.protocol.ScriptType;
import com.sparrowwallet.drongo.wallet.Keystore; import com.sparrowwallet.drongo.wallet.Keystore;
@ -24,9 +25,7 @@ import javafx.stage.FileChooser;
import javafx.stage.Stage; import javafx.stage.Stage;
import org.controlsfx.control.SegmentedButton; import org.controlsfx.control.SegmentedButton;
import org.controlsfx.control.textfield.CustomPasswordField; import org.controlsfx.control.textfield.CustomPasswordField;
import org.controlsfx.control.textfield.TextFields;
import org.controlsfx.glyphfont.Glyph; import org.controlsfx.glyphfont.Glyph;
import org.controlsfx.tools.Platform;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -104,7 +103,7 @@ public abstract class FileImportPane extends TitledDescriptionPane {
FileChooser fileChooser = new FileChooser(); FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Open " + importer.getWalletModel().toDisplayString() + " File"); fileChooser.setTitle("Open " + importer.getWalletModel().toDisplayString() + " File");
fileChooser.getExtensionFilters().addAll( fileChooser.getExtensionFilters().addAll(
new FileChooser.ExtensionFilter("All Files", Platform.getCurrent().equals(Platform.UNIX) ? "*" : "*.*"), new FileChooser.ExtensionFilter("All Files", OsType.getCurrent().equals(OsType.UNIX) ? "*" : "*.*"),
new FileChooser.ExtensionFilter("JSON", "*.json"), new FileChooser.ExtensionFilter("JSON", "*.json"),
new FileChooser.ExtensionFilter("TXT", "*.txt") new FileChooser.ExtensionFilter("TXT", "*.txt")
); );

View file

@ -1,5 +1,6 @@
package com.sparrowwallet.sparrow.control; package com.sparrowwallet.sparrow.control;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.sparrow.AppServices; import com.sparrowwallet.sparrow.AppServices;
import com.sparrowwallet.sparrow.Theme; import com.sparrowwallet.sparrow.Theme;
import com.sparrowwallet.sparrow.glyphfont.FontAwesome5; import com.sparrowwallet.sparrow.glyphfont.FontAwesome5;
@ -57,7 +58,7 @@ public class MempoolSizeFeeRatesChart extends StackedAreaChart<String, Number> {
stage.setResizable(false); stage.setResizable(false);
StackPane scenePane = new StackPane(); StackPane scenePane = new StackPane();
if(org.controlsfx.tools.Platform.getCurrent() == org.controlsfx.tools.Platform.WINDOWS) { if(OsType.getCurrent() == OsType.WINDOWS) {
scenePane.setBorder(new Border(new BorderStroke(Color.DARKGRAY, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT))); scenePane.setBorder(new Border(new BorderStroke(Color.DARKGRAY, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
} }

View file

@ -2,6 +2,7 @@ package com.sparrowwallet.sparrow.control;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
import com.sparrowwallet.drongo.KeyDerivation; import com.sparrowwallet.drongo.KeyDerivation;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.drongo.SecureString; import com.sparrowwallet.drongo.SecureString;
import com.sparrowwallet.drongo.address.Address; import com.sparrowwallet.drongo.address.Address;
import com.sparrowwallet.drongo.address.InvalidAddressException; import com.sparrowwallet.drongo.address.InvalidAddressException;
@ -537,7 +538,7 @@ public class MessageSignDialog extends Dialog<ButtonBar.ButtonData> {
FileChooser fileChooser = new FileChooser(); FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Open Signed Text File"); fileChooser.setTitle("Open Signed Text File");
fileChooser.getExtensionFilters().addAll( fileChooser.getExtensionFilters().addAll(
new FileChooser.ExtensionFilter("All Files", org.controlsfx.tools.Platform.getCurrent().equals(org.controlsfx.tools.Platform.UNIX) ? "*" : "*.*"), new FileChooser.ExtensionFilter("All Files", OsType.getCurrent().equals(OsType.UNIX) ? "*" : "*.*"),
new FileChooser.ExtensionFilter("Text Files", "*.txt") new FileChooser.ExtensionFilter("Text Files", "*.txt")
); );

View file

@ -1,5 +1,6 @@
package com.sparrowwallet.sparrow.control; package com.sparrowwallet.sparrow.control;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.drongo.Utils; import com.sparrowwallet.drongo.Utils;
import com.sparrowwallet.drongo.wallet.Bip39MnemonicCode; import com.sparrowwallet.drongo.wallet.Bip39MnemonicCode;
import com.sparrowwallet.sparrow.AppServices; import com.sparrowwallet.sparrow.AppServices;
@ -256,7 +257,7 @@ public class MnemonicGridDialog extends Dialog<List<String>> {
FileChooser fileChooser = new FileChooser(); FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Open PDF"); fileChooser.setTitle("Open PDF");
fileChooser.getExtensionFilters().addAll( fileChooser.getExtensionFilters().addAll(
new FileChooser.ExtensionFilter("All Files", org.controlsfx.tools.Platform.getCurrent().equals(org.controlsfx.tools.Platform.UNIX) ? "*" : "*.*"), new FileChooser.ExtensionFilter("All Files", OsType.getCurrent().equals(OsType.UNIX) ? "*" : "*.*"),
new FileChooser.ExtensionFilter("PDF", "*.pdf") new FileChooser.ExtensionFilter("PDF", "*.pdf")
); );

View file

@ -1,14 +1,14 @@
package com.sparrowwallet.sparrow.control; package com.sparrowwallet.sparrow.control;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.sparrow.wallet.Entry; import com.sparrowwallet.sparrow.wallet.Entry;
import javafx.scene.control.TreeTableCell; import javafx.scene.control.TreeTableCell;
import org.controlsfx.tools.Platform;
public class NumberCell extends TreeTableCell<Entry, Number> { public class NumberCell extends TreeTableCell<Entry, Number> {
public NumberCell() { public NumberCell() {
super(); super();
getStyleClass().add("number-cell"); getStyleClass().add("number-cell");
if(Platform.getCurrent() == Platform.OSX) { if(OsType.getCurrent() == OsType.MACOS) {
getStyleClass().add("number-field"); getStyleClass().add("number-field");
} }
} }

View file

@ -1,10 +1,7 @@
package com.sparrowwallet.sparrow.control; package com.sparrowwallet.sparrow.control;
import com.github.sarxos.webcam.*; import com.github.sarxos.webcam.*;
import com.sparrowwallet.drongo.ExtendedKey; import com.sparrowwallet.drongo.*;
import com.sparrowwallet.drongo.KeyDerivation;
import com.sparrowwallet.drongo.OutputDescriptor;
import com.sparrowwallet.drongo.Utils;
import com.sparrowwallet.drongo.address.Address; import com.sparrowwallet.drongo.address.Address;
import com.sparrowwallet.drongo.address.P2PKHAddress; import com.sparrowwallet.drongo.address.P2PKHAddress;
import com.sparrowwallet.drongo.address.P2SHAddress; import com.sparrowwallet.drongo.address.P2SHAddress;
@ -138,7 +135,7 @@ public class QRScanDialog extends Dialog<QRScanDialog.Result> {
while(nested.getCause() != null) { while(nested.getCause() != null) {
nested = nested.getCause(); nested = nested.getCause();
} }
if(org.controlsfx.tools.Platform.getCurrent() == org.controlsfx.tools.Platform.WINDOWS && if(OsType.getCurrent() == OsType.WINDOWS &&
nested.getMessage().startsWith("Library 'OpenIMAJGrabber' was not loaded successfully from file")) { nested.getMessage().startsWith("Library 'OpenIMAJGrabber' was not loaded successfully from file")) {
exception = new WebcamDependencyException("Your system is missing a dependency required for the webcam. Follow the link below for more details.\n\n[https://sparrowwallet.com/docs/faq.html#your-system-is-missing-a-dependency-for-the-webcam]", exception); exception = new WebcamDependencyException("Your system is missing a dependency required for the webcam. Follow the link below for more details.\n\n[https://sparrowwallet.com/docs/faq.html#your-system-is-missing-a-dependency-for-the-webcam]", exception);
} else if(nested.getMessage().startsWith("Cannot start native grabber") && Config.get().getWebcamDevice() != null) { } else if(nested.getMessage().startsWith("Cannot start native grabber") && Config.get().getWebcamDevice() != null) {

View file

@ -2,6 +2,7 @@ package com.sparrowwallet.sparrow.control;
import com.csvreader.CsvReader; import com.csvreader.CsvReader;
import com.sparrowwallet.drongo.BitcoinUnit; import com.sparrowwallet.drongo.BitcoinUnit;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.drongo.address.Address; import com.sparrowwallet.drongo.address.Address;
import com.sparrowwallet.drongo.address.InvalidAddressException; import com.sparrowwallet.drongo.address.InvalidAddressException;
import com.sparrowwallet.drongo.protocol.Transaction; import com.sparrowwallet.drongo.protocol.Transaction;
@ -20,7 +21,6 @@ import javafx.stage.FileChooser;
import javafx.util.StringConverter; import javafx.util.StringConverter;
import org.controlsfx.control.spreadsheet.*; import org.controlsfx.control.spreadsheet.*;
import org.controlsfx.glyphfont.Glyph; import org.controlsfx.glyphfont.Glyph;
import org.controlsfx.tools.Platform;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@ -105,7 +105,7 @@ public class SendToManyDialog extends Dialog<List<Payment>> {
SpreadsheetCell amountCell = SpreadsheetCellType.DOUBLE.createCell(row, 1, 1, 1, amount < 0 ? null : amount); SpreadsheetCell amountCell = SpreadsheetCellType.DOUBLE.createCell(row, 1, 1, 1, amount < 0 ? null : amount);
amountCell.setFormat(bitcoinUnit == BitcoinUnit.BTC ? "0.00000000" : "###,###"); amountCell.setFormat(bitcoinUnit == BitcoinUnit.BTC ? "0.00000000" : "###,###");
amountCell.getStyleClass().add("number-value"); amountCell.getStyleClass().add("number-value");
if(Platform.getCurrent() == Platform.OSX) { if(OsType.getCurrent() == OsType.MACOS) {
amountCell.getStyleClass().add("number-field"); amountCell.getStyleClass().add("number-field");
} }
list.add(amountCell); list.add(amountCell);
@ -161,7 +161,7 @@ public class SendToManyDialog extends Dialog<List<Payment>> {
FileChooser fileChooser = new FileChooser(); FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Open CSV"); fileChooser.setTitle("Open CSV");
fileChooser.getExtensionFilters().addAll( fileChooser.getExtensionFilters().addAll(
new FileChooser.ExtensionFilter("All Files", org.controlsfx.tools.Platform.getCurrent().equals(org.controlsfx.tools.Platform.UNIX) ? "*" : "*.*"), new FileChooser.ExtensionFilter("All Files", OsType.getCurrent().equals(OsType.UNIX) ? "*" : "*.*"),
new FileChooser.ExtensionFilter("CSV", "*.csv") new FileChooser.ExtensionFilter("CSV", "*.csv")
); );

View file

@ -1,6 +1,7 @@
package com.sparrowwallet.sparrow.control; package com.sparrowwallet.sparrow.control;
import com.google.common.net.HostAndPort; import com.google.common.net.HostAndPort;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.sparrow.AppServices; import com.sparrowwallet.sparrow.AppServices;
import com.sparrowwallet.sparrow.glyphfont.FontAwesome5; import com.sparrowwallet.sparrow.glyphfont.FontAwesome5;
import com.sparrowwallet.sparrow.io.Config; import com.sparrowwallet.sparrow.io.Config;
@ -14,7 +15,6 @@ import javafx.scene.control.Label;
import javafx.scene.control.Tooltip; import javafx.scene.control.Tooltip;
import javafx.util.Duration; import javafx.util.Duration;
import org.controlsfx.glyphfont.Glyph; import org.controlsfx.glyphfont.Glyph;
import org.controlsfx.tools.Platform;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -28,7 +28,7 @@ public class TorStatusLabel extends Label {
public TorStatusLabel() { public TorStatusLabel() {
getStyleClass().add("tor-status"); getStyleClass().add("tor-status");
setPadding(Platform.getCurrent() == Platform.WINDOWS ? new Insets(0, 0, 1, 3) : new Insets(1, 0, 0, 3)); setPadding(OsType.getCurrent() == OsType.WINDOWS ? new Insets(0, 0, 1, 3) : new Insets(1, 0, 0, 3));
setGraphic(getIcon()); setGraphic(getIcon());
update(); update();
} }
@ -62,7 +62,7 @@ public class TorStatusLabel extends Label {
private Node getIcon() { private Node getIcon() {
Glyph adjust = new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.ADJUST); Glyph adjust = new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.ADJUST);
adjust.setFontSize(Platform.getCurrent() == Platform.WINDOWS ? 14 : 15); adjust.setFontSize(OsType.getCurrent() == OsType.WINDOWS ? 14 : 15);
adjust.setRotate(180); adjust.setRotate(180);
Glyph bullseye = new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.BULLSEYE); Glyph bullseye = new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.BULLSEYE);

View file

@ -1,6 +1,7 @@
package com.sparrowwallet.sparrow.control; package com.sparrowwallet.sparrow.control;
import com.sparrowwallet.drongo.KeyPurpose; import com.sparrowwallet.drongo.KeyPurpose;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.drongo.address.Address; import com.sparrowwallet.drongo.address.Address;
import com.sparrowwallet.drongo.protocol.Sha256Hash; import com.sparrowwallet.drongo.protocol.Sha256Hash;
import com.sparrowwallet.drongo.protocol.TransactionOutput; import com.sparrowwallet.drongo.protocol.TransactionOutput;
@ -44,7 +45,6 @@ import javafx.stage.Stage;
import javafx.stage.StageStyle; import javafx.stage.StageStyle;
import javafx.util.Duration; import javafx.util.Duration;
import org.controlsfx.glyphfont.Glyph; import org.controlsfx.glyphfont.Glyph;
import org.controlsfx.tools.Platform;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import java.awt.image.*; import java.awt.image.*;
@ -89,7 +89,7 @@ public class TransactionDiagram extends GridPane {
stage.setResizable(false); stage.setResizable(false);
StackPane scenePane = new StackPane(); StackPane scenePane = new StackPane();
if(Platform.getCurrent() == Platform.WINDOWS || Platform.getCurrent() == Platform.UNIX) { if(OsType.getCurrent() == OsType.WINDOWS || OsType.getCurrent() == OsType.UNIX) {
scenePane.setBorder(new Border(new BorderStroke(Color.DARKGRAY, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT))); scenePane.setBorder(new Border(new BorderStroke(Color.DARKGRAY, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
} }

View file

@ -1,5 +1,6 @@
package com.sparrowwallet.sparrow.control; package com.sparrowwallet.sparrow.control;
import com.sparrowwallet.drongo.OsType;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.stage.Stage; import javafx.stage.Stage;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -31,7 +32,7 @@ public class TrayManager {
try { try {
List<Image> imgList = new ArrayList<>(); List<Image> imgList = new ArrayList<>();
if(org.controlsfx.tools.Platform.getCurrent() == org.controlsfx.tools.Platform.WINDOWS) { if(OsType.getCurrent() == OsType.WINDOWS) {
imgList.add(ImageIO.read(getClass().getResource("/image/sparrow-black-small.png"))); imgList.add(ImageIO.read(getClass().getResource("/image/sparrow-black-small.png")));
imgList.add(ImageIO.read(getClass().getResource("/image/sparrow-black-small@2x.png"))); imgList.add(ImageIO.read(getClass().getResource("/image/sparrow-black-small@2x.png")));
imgList.add(ImageIO.read(getClass().getResource("/image/sparrow-black-small@3x.png"))); imgList.add(ImageIO.read(getClass().getResource("/image/sparrow-black-small@3x.png")));

View file

@ -1,6 +1,7 @@
package com.sparrowwallet.sparrow.io; package com.sparrowwallet.sparrow.io;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.drongo.address.Address; import com.sparrowwallet.drongo.address.Address;
import com.sparrowwallet.drongo.crypto.ChildNumber; import com.sparrowwallet.drongo.crypto.ChildNumber;
import com.sparrowwallet.drongo.crypto.ECKey; import com.sparrowwallet.drongo.crypto.ECKey;
@ -13,7 +14,6 @@ import com.sparrowwallet.sparrow.io.ckcard.CkCardApi;
import com.sparrowwallet.sparrow.io.satochip.SatoCardApi; import com.sparrowwallet.sparrow.io.satochip.SatoCardApi;
import javafx.beans.property.StringProperty; import javafx.beans.property.StringProperty;
import javafx.concurrent.Service; import javafx.concurrent.Service;
import org.controlsfx.tools.Platform;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -171,7 +171,7 @@ public abstract class CardApi {
} }
private static void setLibrary() { private static void setLibrary() {
if(!initialized && Platform.getCurrent() == Platform.UNIX) { if(!initialized && OsType.getCurrent() == OsType.UNIX) {
for(File lib : LINUX_PCSC_LIBS) { for(File lib : LINUX_PCSC_LIBS) {
if(lib.exists()) { if(lib.exists()) {
System.setProperty("sun.security.smartcardio.library", lib.getAbsolutePath()); System.setProperty("sun.security.smartcardio.library", lib.getAbsolutePath());

View file

@ -4,6 +4,7 @@ import com.google.common.io.ByteStreams;
import com.google.common.io.CharStreams; import com.google.common.io.CharStreams;
import com.google.gson.*; import com.google.gson.*;
import com.sparrowwallet.drongo.Network; import com.sparrowwallet.drongo.Network;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.drongo.OutputDescriptor; import com.sparrowwallet.drongo.OutputDescriptor;
import com.sparrowwallet.drongo.protocol.ScriptType; import com.sparrowwallet.drongo.protocol.ScriptType;
import com.sparrowwallet.drongo.psbt.PSBT; import com.sparrowwallet.drongo.psbt.PSBT;
@ -16,7 +17,6 @@ import javafx.concurrent.Task;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream; import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
import org.controlsfx.tools.Platform;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -358,7 +358,7 @@ public class Hwi {
String tmpDir = System.getProperty("java.io.tmpdir"); String tmpDir = System.getProperty("java.io.tmpdir");
String hwiPath = hwiExecutable.getAbsolutePath(); String hwiPath = hwiExecutable.getAbsolutePath();
if(command.isTestFirst() && (hwiPath.contains(tmpDir) || hwiPath.startsWith(homeDir.getAbsolutePath())) && (!hwiPath.contains(HWI_VERSION_DIR) || !testHwi(hwiExecutable))) { if(command.isTestFirst() && (hwiPath.contains(tmpDir) || hwiPath.startsWith(homeDir.getAbsolutePath())) && (!hwiPath.contains(HWI_VERSION_DIR) || !testHwi(hwiExecutable))) {
if(Platform.getCurrent() == Platform.OSX) { if(OsType.getCurrent() == OsType.MACOS) {
IOUtils.deleteDirectory(hwiExecutable.getParentFile()); IOUtils.deleteDirectory(hwiExecutable.getParentFile());
} else { } else {
hwiExecutable.delete(); hwiExecutable.delete();
@ -368,7 +368,7 @@ public class Hwi {
if(hwiExecutable == null || !hwiExecutable.exists()) { if(hwiExecutable == null || !hwiExecutable.exists()) {
try { try {
Platform platform = Platform.getCurrent(); OsType osType = OsType.getCurrent();
String osArch = System.getProperty("os.arch"); String osArch = System.getProperty("os.arch");
Set<PosixFilePermission> ownerExecutableWritable = PosixFilePermissions.fromString("rwxr--r--"); Set<PosixFilePermission> ownerExecutableWritable = PosixFilePermissions.fromString("rwxr--r--");
@ -376,7 +376,7 @@ public class Hwi {
//To avoid doing these with every invocation, use a --onedir packaging and expand into a temp folder on OSX //To avoid doing these with every invocation, use a --onedir packaging and expand into a temp folder on OSX
//The check will still happen on first invocation, but will not thereafter //The check will still happen on first invocation, but will not thereafter
//See https://github.com/bitcoin-core/HWI/issues/327 for details //See https://github.com/bitcoin-core/HWI/issues/327 for details
if(platform == Platform.OSX) { if(osType == OsType.MACOS) {
InputStream inputStream; InputStream inputStream;
if(osArch.equals("aarch64")) { if(osArch.equals("aarch64")) {
inputStream = Hwi.class.getResourceAsStream("/native/osx/aarch64/" + HWI_VERSION_DIR + "-mac-aarch64-signed.tar.bz2"); inputStream = Hwi.class.getResourceAsStream("/native/osx/aarch64/" + HWI_VERSION_DIR + "-mac-aarch64-signed.tar.bz2");
@ -425,7 +425,7 @@ public class Hwi {
} else { } else {
InputStream inputStream; InputStream inputStream;
Path tempExecPath; Path tempExecPath;
if(platform == Platform.WINDOWS) { if(osType == OsType.WINDOWS) {
Files.createDirectories(getHwiHomeDir().toPath()); Files.createDirectories(getHwiHomeDir().toPath());
inputStream = Hwi.class.getResourceAsStream("/native/windows/x64/hwi.exe"); inputStream = Hwi.class.getResourceAsStream("/native/windows/x64/hwi.exe");
tempExecPath = Files.createTempFile(getHwiHomeDir().toPath(), HWI_VERSION_DIR, null); tempExecPath = Files.createTempFile(getHwiHomeDir().toPath(), HWI_VERSION_DIR, null);
@ -462,7 +462,7 @@ public class Hwi {
} }
private File getHwiHomeDir() { private File getHwiHomeDir() {
if(Platform.getCurrent() == Platform.OSX || Platform.getCurrent() == Platform.WINDOWS) { if(OsType.getCurrent() == OsType.MACOS || OsType.getCurrent() == OsType.WINDOWS) {
return new File(Storage.getSparrowDir(), HWI_HOME_DIR); return new File(Storage.getSparrowDir(), HWI_HOME_DIR);
} }
@ -534,7 +534,7 @@ public class Hwi {
private void deleteExtractionOnFailure(Process process, long after) { private void deleteExtractionOnFailure(Process process, long after) {
try { try {
if(Platform.getCurrent() != Platform.OSX && process != null && process.waitFor(100, TimeUnit.MILLISECONDS) && process.exitValue() != 0) { if(OsType.getCurrent() != OsType.MACOS && process != null && process.waitFor(100, TimeUnit.MILLISECONDS) && process.exitValue() != 0) {
File extraction = getTemporaryExtraction(after); File extraction = getTemporaryExtraction(after);
if(extraction != null) { if(extraction != null) {
IOUtils.deleteDirectory(extraction); IOUtils.deleteDirectory(extraction);
@ -616,8 +616,8 @@ public class Hwi {
} }
private String escape(String passphrase) { private String escape(String passphrase) {
Platform platform = Platform.getCurrent(); OsType osType = OsType.getCurrent();
if(platform == Platform.WINDOWS) { if(osType == OsType.WINDOWS) {
return passphrase.replace("\"", "\\\""); return passphrase.replace("\"", "\\\"");
} }

View file

@ -12,7 +12,6 @@ import javafx.concurrent.ScheduledService;
import javafx.concurrent.Service; import javafx.concurrent.Service;
import javafx.concurrent.Task; import javafx.concurrent.Task;
import org.apache.commons.lang3.concurrent.BasicThreadFactory; import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.controlsfx.tools.Platform;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -646,7 +645,7 @@ public class Storage {
} }
private static boolean isWindows() { private static boolean isWindows() {
return Platform.getCurrent() == Platform.WINDOWS; return OsType.getCurrent() == OsType.WINDOWS;
} }
public static class LoadWalletService extends Service<WalletAndKey> { public static class LoadWalletService extends Service<WalletAndKey> {

View file

@ -5,6 +5,7 @@ import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import com.sparrowwallet.drongo.KeyPurpose; import com.sparrowwallet.drongo.KeyPurpose;
import com.sparrowwallet.drongo.Network; import com.sparrowwallet.drongo.Network;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.drongo.OutputDescriptor; import com.sparrowwallet.drongo.OutputDescriptor;
import com.sparrowwallet.drongo.protocol.ScriptType; import com.sparrowwallet.drongo.protocol.ScriptType;
import com.sparrowwallet.drongo.wallet.BlockTransactionHash; import com.sparrowwallet.drongo.wallet.BlockTransactionHash;
@ -42,13 +43,13 @@ public class Bwt {
public synchronized static void initialize() { public synchronized static void initialize() {
if(!initialized) { if(!initialized) {
try { try {
org.controlsfx.tools.Platform platform = org.controlsfx.tools.Platform.getCurrent(); OsType osType = OsType.getCurrent();
String osArch = System.getProperty("os.arch"); String osArch = System.getProperty("os.arch");
if(platform == org.controlsfx.tools.Platform.OSX && osArch.equals("aarch64")) { if(osType == OsType.MACOS && osArch.equals("aarch64")) {
NativeUtils.loadLibraryFromJar("/native/osx/aarch64/libbwt_jni.dylib"); NativeUtils.loadLibraryFromJar("/native/osx/aarch64/libbwt_jni.dylib");
} else if(platform == org.controlsfx.tools.Platform.OSX) { } else if(osType == OsType.MACOS) {
NativeUtils.loadLibraryFromJar("/native/osx/x64/libbwt_jni.dylib"); NativeUtils.loadLibraryFromJar("/native/osx/x64/libbwt_jni.dylib");
} else if(platform == org.controlsfx.tools.Platform.WINDOWS) { } else if(osType == OsType.WINDOWS) {
NativeUtils.loadLibraryFromJar("/native/windows/x64/bwt_jni.dll"); NativeUtils.loadLibraryFromJar("/native/windows/x64/bwt_jni.dll");
} else if(osArch.equals("aarch64")) { } else if(osArch.equals("aarch64")) {
NativeUtils.loadLibraryFromJar("/native/linux/aarch64/libbwt_jni.so"); NativeUtils.loadLibraryFromJar("/native/linux/aarch64/libbwt_jni.so");

View file

@ -1,6 +1,7 @@
package com.sparrowwallet.sparrow.net; package com.sparrowwallet.sparrow.net;
import com.google.common.net.HostAndPort; import com.google.common.net.HostAndPort;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.sparrow.EventManager; import com.sparrowwallet.sparrow.EventManager;
import com.sparrowwallet.sparrow.event.TorStatusEvent; import com.sparrowwallet.sparrow.event.TorStatusEvent;
import com.sparrowwallet.sparrow.io.Storage; import com.sparrowwallet.sparrow.io.Storage;
@ -16,7 +17,6 @@ import io.matthewnelson.kmp.tor.ext.callback.manager.CallbackTorManager;
import io.matthewnelson.kmp.tor.manager.TorManager; import io.matthewnelson.kmp.tor.manager.TorManager;
import io.matthewnelson.kmp.tor.manager.common.event.TorManagerEvent; import io.matthewnelson.kmp.tor.manager.common.event.TorManagerEvent;
import io.matthewnelson.kmp.tor.manager.util.PortUtil; import io.matthewnelson.kmp.tor.manager.util.PortUtil;
import org.controlsfx.tools.Platform;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -38,20 +38,20 @@ public class Tor {
private ProxyAddress socksAddress; private ProxyAddress socksAddress;
public Tor() { public Tor() {
Platform platform = Platform.getCurrent(); OsType osType = OsType.getCurrent();
String arch = System.getProperty("os.arch"); String arch = System.getProperty("os.arch");
PlatformInstaller installer; PlatformInstaller installer;
PlatformInstaller.InstallOption installOption = PlatformInstaller.InstallOption.CleanInstallIfMissing; PlatformInstaller.InstallOption installOption = PlatformInstaller.InstallOption.CleanInstallIfMissing;
if(platform == Platform.OSX) { if(osType == OsType.MACOS) {
if(arch.equals("aarch64")) { if(arch.equals("aarch64")) {
installer = PlatformInstaller.macosArm64(installOption); installer = PlatformInstaller.macosArm64(installOption);
} else { } else {
installer = PlatformInstaller.macosX64(installOption); installer = PlatformInstaller.macosX64(installOption);
} }
} else if(platform == Platform.WINDOWS) { } else if(osType == OsType.WINDOWS) {
installer = PlatformInstaller.mingwX64(installOption); installer = PlatformInstaller.mingwX64(installOption);
} else if(platform == Platform.UNIX) { } else if(osType == OsType.UNIX) {
if(arch.equals("aarch64")) { if(arch.equals("aarch64")) {
TorBinaryResource linuxArm64 = TorBinaryResource.from(TorBinaryResource.OS.Linux, "arm64", TorBinaryResource linuxArm64 = TorBinaryResource.from(TorBinaryResource.OS.Linux, "arm64",
"588496f3164d52b91f17e4db3372d8dfefa6366a8df265eebd4a28d4128992aa", "588496f3164d52b91f17e4db3372d8dfefa6366a8df265eebd4a28d4128992aa",
@ -61,7 +61,7 @@ public class Tor {
installer = PlatformInstaller.linuxX64(installOption); installer = PlatformInstaller.linuxX64(installOption);
} }
} else { } else {
throw new UnsupportedOperationException("Sparrow's bundled Tor is not supported on " + platform + " " + arch); throw new UnsupportedOperationException("Sparrow's bundled Tor is not supported on " + osType + " " + arch);
} }
TorConfigProviderJvm torConfigProviderJvm = new TorConfigProviderJvm() { TorConfigProviderJvm torConfigProviderJvm = new TorConfigProviderJvm() {

View file

@ -5,6 +5,7 @@ import com.google.common.base.Throwables;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
import com.google.common.net.HostAndPort; import com.google.common.net.HostAndPort;
import com.sparrowwallet.drongo.Network; import com.sparrowwallet.drongo.Network;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.sparrow.AppServices; import com.sparrowwallet.sparrow.AppServices;
import com.sparrowwallet.sparrow.EventManager; import com.sparrowwallet.sparrow.EventManager;
import com.sparrowwallet.sparrow.Mode; import com.sparrowwallet.sparrow.Mode;
@ -344,7 +345,7 @@ public class ServerPreferencesController extends PreferencesDetailController {
FileChooser fileChooser = new FileChooser(); FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Select Electrum Server certificate"); fileChooser.setTitle("Select Electrum Server certificate");
fileChooser.getExtensionFilters().addAll( fileChooser.getExtensionFilters().addAll(
new FileChooser.ExtensionFilter("All Files", org.controlsfx.tools.Platform.getCurrent().equals(org.controlsfx.tools.Platform.UNIX) ? "*" : "*.*"), new FileChooser.ExtensionFilter("All Files", OsType.getCurrent().equals(OsType.UNIX) ? "*" : "*.*"),
new FileChooser.ExtensionFilter("CRT", "*.crt") new FileChooser.ExtensionFilter("CRT", "*.crt")
); );
@ -866,10 +867,10 @@ public class ServerPreferencesController extends PreferencesDetailController {
} }
private File getDefaultCoreDataDir() { private File getDefaultCoreDataDir() {
org.controlsfx.tools.Platform platform = org.controlsfx.tools.Platform.getCurrent(); OsType osType = OsType.getCurrent();
if(platform == org.controlsfx.tools.Platform.OSX) { if(osType == OsType.MACOS) {
return new File(System.getProperty("user.home") + "/Library/Application Support/Bitcoin"); return new File(System.getProperty("user.home") + "/Library/Application Support/Bitcoin");
} else if(platform == org.controlsfx.tools.Platform.WINDOWS) { } else if(osType == OsType.WINDOWS) {
return new File(System.getenv("APPDATA") + "/Bitcoin"); return new File(System.getenv("APPDATA") + "/Bitcoin");
} else { } else {
return new File(System.getProperty("user.home") + "/.bitcoin"); return new File(System.getProperty("user.home") + "/.bitcoin");
@ -877,10 +878,10 @@ public class ServerPreferencesController extends PreferencesDetailController {
} }
private void setTestResultsFont() { private void setTestResultsFont() {
org.controlsfx.tools.Platform platform = org.controlsfx.tools.Platform.getCurrent(); OsType osType = OsType.getCurrent();
if(platform == org.controlsfx.tools.Platform.OSX) { if(osType == OsType.MACOS) {
testResults.setFont(Font.font("Monaco", 11)); testResults.setFont(Font.font("Monaco", 11));
} else if(platform == org.controlsfx.tools.Platform.WINDOWS) { } else if(osType == OsType.WINDOWS) {
testResults.setFont(Font.font("Lucida Console", 11)); testResults.setFont(Font.font("Lucida Console", 11));
} else { } else {
testResults.setFont(Font.font("monospace", 11)); testResults.setFont(Font.font("monospace", 11));

View file

@ -3,6 +3,7 @@ package com.sparrowwallet.sparrow.wallet;
import com.csvreader.CsvWriter; import com.csvreader.CsvWriter;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
import com.sparrowwallet.drongo.BitcoinUnit; import com.sparrowwallet.drongo.BitcoinUnit;
import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.drongo.wallet.*; import com.sparrowwallet.drongo.wallet.*;
import com.sparrowwallet.sparrow.UnitFormat; import com.sparrowwallet.sparrow.UnitFormat;
import com.sparrowwallet.sparrow.AppServices; import com.sparrowwallet.sparrow.AppServices;
@ -89,7 +90,7 @@ public class UtxosController extends WalletFormController implements Initializab
clear.setDisable(true); clear.setDisable(true);
sendSelected.setDisable(true); sendSelected.setDisable(true);
sendSelected.setTooltip(new Tooltip("Send selected UTXOs. Use " + (org.controlsfx.tools.Platform.getCurrent() == org.controlsfx.tools.Platform.OSX ? "Cmd" : "Ctrl") + "+click to select multiple." )); sendSelected.setTooltip(new Tooltip("Send selected UTXOs. Use " + (OsType.getCurrent() == OsType.MACOS ? "Cmd" : "Ctrl") + "+click to select multiple." ));
utxosTable.getSelectionModel().getSelectedIndices().addListener((ListChangeListener<Integer>) c -> { utxosTable.getSelectionModel().getSelectedIndices().addListener((ListChangeListener<Integer>) c -> {
List<Entry> selectedEntries = utxosTable.getSelectionModel().getSelectedCells().stream().filter(tp -> tp.getTreeItem() != null).map(tp -> tp.getTreeItem().getValue()).collect(Collectors.toList()); List<Entry> selectedEntries = utxosTable.getSelectionModel().getSelectedCells().stream().filter(tp -> tp.getTreeItem() != null).map(tp -> tp.getTreeItem().getValue()).collect(Collectors.toList());