mirror of
https://codeberg.org/anoncontributorxmr/mysu.git
synced 2024-12-22 21:17:47 +00:00
upgrade old node prefs if valid node
This commit is contained in:
parent
c1b4f8400d
commit
6d0ddad674
1 changed files with 12 additions and 0 deletions
|
@ -13,6 +13,7 @@ import androidx.fragment.app.FragmentManager;
|
|||
import androidx.navigation.fragment.NavHostFragment;
|
||||
|
||||
import net.mynero.wallet.data.DefaultNodes;
|
||||
import net.mynero.wallet.data.Node;
|
||||
import net.mynero.wallet.fragment.dialog.PasswordBottomSheetDialog;
|
||||
import net.mynero.wallet.fragment.dialog.SendBottomSheetDialog;
|
||||
import net.mynero.wallet.livedata.SingleLiveEvent;
|
||||
|
@ -92,6 +93,7 @@ public class MainActivity extends AppCompatActivity implements MoneroHandlerThre
|
|||
}
|
||||
|
||||
public void init(File walletFile, String password) {
|
||||
upgradeOldNodePrefs();
|
||||
Wallet wallet = WalletManager.getInstance().openWallet(walletFile.getAbsolutePath(), password);
|
||||
thread = new MoneroHandlerThread("WalletService", this, wallet);
|
||||
new TxService(thread);
|
||||
|
@ -103,6 +105,16 @@ public class MainActivity extends AppCompatActivity implements MoneroHandlerThre
|
|||
thread.start();
|
||||
}
|
||||
|
||||
private void upgradeOldNodePrefs() {
|
||||
String oldNodeString = PrefService.getInstance().getString("pref_node", "");
|
||||
if(!oldNodeString.isEmpty()) {
|
||||
Node oldNode = Node.fromString(oldNodeString);
|
||||
if(oldNode != null) {
|
||||
PrefService.getInstance().edit().putString(Constants.PREF_NODE_2, oldNode.toNodeString()).apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
this.historyService.refreshHistory();
|
||||
|
|
Loading…
Reference in a new issue