diff --git a/app/src/main/java/net/mynero/wallet/adapter/NodeSelectionAdapter.java b/app/src/main/java/net/mynero/wallet/adapter/NodeSelectionAdapter.java index dc0c0a1..e34081d 100644 --- a/app/src/main/java/net/mynero/wallet/adapter/NodeSelectionAdapter.java +++ b/app/src/main/java/net/mynero/wallet/adapter/NodeSelectionAdapter.java @@ -96,7 +96,7 @@ public class NodeSelectionAdapter extends RecyclerView.Adapter { NodeSelectionBottomSheetDialog dialog = new NodeSelectionBottomSheetDialog(); @@ -220,7 +221,7 @@ public class SettingsFragment extends Fragment implements PasswordBottomSheetDia @Override public void onNodeSelected() { - Node node = Node.fromString(PrefService.getInstance().getString(Constants.PREF_NODE, "")); + Node node = Node.fromString(PrefService.getInstance().getString(Constants.PREF_NODE_2, "")); selectNodeButton.setText(getString(R.string.node_button_text, node.getAddress())); mViewModel.updateProxy(((MoneroApplication)getActivity().getApplication())); ((MoneroApplication)getActivity().getApplication()).getExecutor().execute(() -> { diff --git a/app/src/main/java/net/mynero/wallet/fragment/settings/SettingsViewModel.java b/app/src/main/java/net/mynero/wallet/fragment/settings/SettingsViewModel.java index e44313d..e02585b 100644 --- a/app/src/main/java/net/mynero/wallet/fragment/settings/SettingsViewModel.java +++ b/app/src/main/java/net/mynero/wallet/fragment/settings/SettingsViewModel.java @@ -5,14 +5,10 @@ import android.util.Patterns; import androidx.lifecycle.ViewModel; import net.mynero.wallet.MoneroApplication; -import net.mynero.wallet.data.DefaultNodes; import net.mynero.wallet.model.WalletManager; import net.mynero.wallet.service.PrefService; import net.mynero.wallet.util.Constants; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - public class SettingsViewModel extends ViewModel { private String proxyAddress = ""; @@ -21,7 +17,7 @@ public class SettingsViewModel extends ViewModel { public void updateProxy(MoneroApplication application) { application.getExecutor().execute(() -> { boolean usesProxy = PrefService.getInstance().getBoolean(Constants.PREF_USES_TOR, false); - String currentNodeString = PrefService.getInstance().getString(Constants.PREF_NODE, ""); + String currentNodeString = PrefService.getInstance().getString(Constants.PREF_NODE_2, ""); boolean isNodeLocalIp = currentNodeString.startsWith("10.") || currentNodeString.startsWith("192.168.") || currentNodeString.equals("localhost") || currentNodeString.equals("127.0.0.1"); if (!usesProxy || isNodeLocalIp) { diff --git a/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.java b/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.java index 40c737a..a988bd1 100644 --- a/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.java +++ b/app/src/main/java/net/mynero/wallet/service/MoneroHandlerThread.java @@ -57,11 +57,8 @@ public class MoneroHandlerThread extends Thread implements WalletListener { @Override public void run() { boolean usesTor = PrefService.getInstance().getBoolean(Constants.PREF_USES_TOR, false); - DefaultNodes defaultNode = DefaultNodes.SAMOURAI; - if(usesTor) { - defaultNode = DefaultNodes.SAMOURAI_ONION; - } - String currentNodeString = PrefService.getInstance().getString(Constants.PREF_NODE, defaultNode.getAddress()); + DefaultNodes defaultNode = usesTor ? DefaultNodes.SAMOURAI_ONION : DefaultNodes.SAMOURAI; + String currentNodeString = PrefService.getInstance().getString(Constants.PREF_NODE_2, defaultNode.getUri()); Node selectedNode = Node.fromString(currentNodeString); boolean isLocalIp = currentNodeString.startsWith("10.") || currentNodeString.startsWith("192.168.") || currentNodeString.equals("localhost") || currentNodeString.equals("127.0.0.1"); if (usesTor && !isLocalIp) { diff --git a/app/src/main/java/net/mynero/wallet/util/Constants.java b/app/src/main/java/net/mynero/wallet/util/Constants.java index 5ed4662..d93a815 100644 --- a/app/src/main/java/net/mynero/wallet/util/Constants.java +++ b/app/src/main/java/net/mynero/wallet/util/Constants.java @@ -7,7 +7,7 @@ public class Constants { public static final String PREF_USES_TOR = "pref_uses_tor"; public static final String PREF_NIGHT_MODE = "pref_night_mode"; public static final String PREF_PROXY = "pref_proxy"; - public static final String PREF_NODE = "pref_node"; + public static final String PREF_NODE_2 = "pref_node_2"; public static final String PREF_CUSTOM_NODES = "pref_custom_nodes"; public static final String URI_PREFIX = "monero:";