mirror of
https://codeberg.org/anoncontributorxmr/mysu.git
synced 2024-11-25 00:42:32 +00:00
fix upgrade code
This commit is contained in:
parent
90e556abff
commit
95eb106a40
2 changed files with 13 additions and 11 deletions
|
@ -109,7 +109,7 @@ public class MainActivity extends AppCompatActivity implements MoneroHandlerThre
|
|||
}
|
||||
|
||||
private void upgradeOldNodePrefs() {
|
||||
PrefService.getInstance().getNode();
|
||||
PrefService.getInstance().upgradeNodePrefs();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,6 +26,17 @@ public class PrefService extends ServiceBase {
|
|||
}
|
||||
|
||||
public Node getNode() {
|
||||
boolean usesProxy = getBoolean(Constants.PREF_USES_TOR, false);
|
||||
DefaultNodes defaultNode = usesProxy ? DefaultNodes.SAMOURAI_ONION : DefaultNodes.SAMOURAI;
|
||||
String nodeString = getString(Constants.PREF_NODE_2, defaultNode.getUri());
|
||||
if(!nodeString.isEmpty()) {
|
||||
return Node.fromString(nodeString);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void upgradeNodePrefs() {
|
||||
String oldNodeString = getString("pref_node", "");
|
||||
if(!oldNodeString.isEmpty()) {
|
||||
//upgrade old node pref to new node pref
|
||||
|
@ -41,14 +52,6 @@ public class PrefService extends ServiceBase {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
boolean usesProxy = getBoolean(Constants.PREF_USES_TOR, false);
|
||||
DefaultNodes defaultNode = usesProxy ? DefaultNodes.SAMOURAI_ONION : DefaultNodes.SAMOURAI;
|
||||
String nodeString = getString(Constants.PREF_NODE_2, defaultNode.getUri());
|
||||
if(!nodeString.isEmpty()) {
|
||||
return Node.fromString(nodeString);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Node getNode(String oldNodeString) throws JSONException {
|
||||
|
@ -79,8 +82,7 @@ public class PrefService extends ServiceBase {
|
|||
if(nodeString.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
Node oldNode = Node.fromString(nodeString);
|
||||
return oldNode;
|
||||
return Node.fromString(nodeString);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue