mirror of
https://codeberg.org/r4v3r23/mysu.git
synced 2024-11-14 01:21:54 +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 androidx.navigation.fragment.NavHostFragment;
|
||||||
|
|
||||||
import net.mynero.wallet.data.DefaultNodes;
|
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.PasswordBottomSheetDialog;
|
||||||
import net.mynero.wallet.fragment.dialog.SendBottomSheetDialog;
|
import net.mynero.wallet.fragment.dialog.SendBottomSheetDialog;
|
||||||
import net.mynero.wallet.livedata.SingleLiveEvent;
|
import net.mynero.wallet.livedata.SingleLiveEvent;
|
||||||
|
@ -92,6 +93,7 @@ public class MainActivity extends AppCompatActivity implements MoneroHandlerThre
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(File walletFile, String password) {
|
public void init(File walletFile, String password) {
|
||||||
|
upgradeOldNodePrefs();
|
||||||
Wallet wallet = WalletManager.getInstance().openWallet(walletFile.getAbsolutePath(), password);
|
Wallet wallet = WalletManager.getInstance().openWallet(walletFile.getAbsolutePath(), password);
|
||||||
thread = new MoneroHandlerThread("WalletService", this, wallet);
|
thread = new MoneroHandlerThread("WalletService", this, wallet);
|
||||||
new TxService(thread);
|
new TxService(thread);
|
||||||
|
@ -103,6 +105,16 @@ public class MainActivity extends AppCompatActivity implements MoneroHandlerThre
|
||||||
thread.start();
|
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
|
@Override
|
||||||
public void onRefresh() {
|
public void onRefresh() {
|
||||||
this.historyService.refreshHistory();
|
this.historyService.refreshHistory();
|
||||||
|
|
Loading…
Reference in a new issue