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);
if (node != null) {
nodes.add(node);
jsonArray.put(i, node.toJson().toString());
jsonArray.put(i, node.toJson());
} else {
jsonArray.remove(i);
}

View file

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

View file

@ -6,6 +6,7 @@ import androidx.lifecycle.ViewModel;
import net.mynero.wallet.MoneroApplication;
import net.mynero.wallet.data.DefaultNodes;
import net.mynero.wallet.data.Node;
import net.mynero.wallet.model.WalletManager;
import net.mynero.wallet.service.PrefService;
import net.mynero.wallet.util.Constants;
@ -18,8 +19,8 @@ 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().getNode().toNodeString();
boolean isNodeLocalIp = currentNodeString.startsWith("10.") || currentNodeString.startsWith("192.168.") || currentNodeString.equals("localhost") || currentNodeString.equals("127.0.0.1");
Node curretNode = PrefService.getInstance().getNode();
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) {
WalletManager.getInstance().setProxy("");