More bug fixes

This commit is contained in:
pokkst 2023-05-24 22:08:29 -05:00
parent db3c4c424b
commit 9e70f64e39
No known key found for this signature in database
GPG Key ID: 90C2ED85E67A50FF
3 changed files with 5 additions and 4 deletions

View File

@ -78,7 +78,7 @@ public class NodeSelectionBottomSheetDialog extends BottomSheetDialogFragment im
Node node = Node.fromString(nodeString); Node node = Node.fromString(nodeString);
if (node != null) { if (node != null) {
nodes.add(node); nodes.add(node);
jsonArray.put(i, node.toJson().toString()); jsonArray.put(i, node.toJson());
} else { } else {
jsonArray.remove(i); jsonArray.remove(i);
} }

View File

@ -300,7 +300,7 @@ public class SettingsFragment extends Fragment implements PasswordBottomSheetDia
JSONObject nodeJsonObject = jsonArray.getJSONObject(i); JSONObject nodeJsonObject = jsonArray.getJSONObject(i);
Node savedNode = Node.fromJson(nodeJsonObject); Node savedNode = Node.fromJson(nodeJsonObject);
if (savedNode.toNodeString().equals(oldNode.toNodeString())) if (savedNode.toNodeString().equals(oldNode.toNodeString()))
jsonArray.put(i, newNode.toNodeString()); jsonArray.put(i, newNode.toJson());
} }
saveNodesAndReopen(jsonArray); saveNodesAndReopen(jsonArray);
} catch (Exception e) { } catch (Exception e) {

View File

@ -6,6 +6,7 @@ import androidx.lifecycle.ViewModel;
import net.mynero.wallet.MoneroApplication; import net.mynero.wallet.MoneroApplication;
import net.mynero.wallet.data.DefaultNodes; import net.mynero.wallet.data.DefaultNodes;
import net.mynero.wallet.data.Node;
import net.mynero.wallet.model.WalletManager; import net.mynero.wallet.model.WalletManager;
import net.mynero.wallet.service.PrefService; import net.mynero.wallet.service.PrefService;
import net.mynero.wallet.util.Constants; import net.mynero.wallet.util.Constants;
@ -18,8 +19,8 @@ public class SettingsViewModel extends ViewModel {
public void updateProxy(MoneroApplication application) { public void updateProxy(MoneroApplication application) {
application.getExecutor().execute(() -> { application.getExecutor().execute(() -> {
boolean usesProxy = PrefService.getInstance().getBoolean(Constants.PREF_USES_TOR, false); boolean usesProxy = PrefService.getInstance().getBoolean(Constants.PREF_USES_TOR, false);
String currentNodeString = PrefService.getInstance().getNode().toNodeString(); Node curretNode = PrefService.getInstance().getNode();
boolean isNodeLocalIp = currentNodeString.startsWith("10.") || currentNodeString.startsWith("192.168.") || currentNodeString.equals("localhost") || currentNodeString.equals("127.0.0.1"); boolean isNodeLocalIp = curretNode.getAddress().startsWith("10.") || curretNode.getAddress().startsWith("192.168.") || curretNode.getAddress().equals("localhost") || curretNode.getAddress().equals("127.0.0.1");
if (!usesProxy || isNodeLocalIp) { if (!usesProxy || isNodeLocalIp) {
WalletManager.getInstance().setProxy(""); WalletManager.getInstance().setProxy("");