await settings migration

This commit is contained in:
OmarHatem 2025-01-08 05:09:45 +02:00
parent d1c45a5326
commit 55005f8b39
5 changed files with 24 additions and 14 deletions

View file

@ -70,8 +70,13 @@ Future<void> defaultSettingsMigration(
await sharedPreferences.setBool(PreferencesKey.isNewInstall, isNewInstall);
final currentVersion =
int currentVersion =
sharedPreferences.getInt(PreferencesKey.currentDefaultSettingsMigrationVersion) ?? 0;
// TODO: remove after v4.22.1 is live
/// for beta testers who didn't correctly get the 46 step configured
if (currentVersion == 46) {
currentVersion--;
}
if (currentVersion >= version) {
return;
@ -334,20 +339,20 @@ Future<void> defaultSettingsMigration(
);
break;
case 46:
_fixNodesUseSSLFlag(nodes);
updateWalletTypeNodesWithNewNode(
await _fixNodesUseSSLFlag(nodes);
await updateWalletTypeNodesWithNewNode(
newNodeUri: 'litecoin.stackwallet.com:20063',
nodes: nodes,
type: WalletType.litecoin,
useSSL: true,
);
updateWalletTypeNodesWithNewNode(
await updateWalletTypeNodesWithNewNode(
newNodeUri: 'electrum-ltc.bysh.me:50002',
nodes: nodes,
type: WalletType.litecoin,
useSSL: true,
);
_changeDefaultNode(
await _changeDefaultNode(
nodes: nodes,
sharedPreferences: sharedPreferences,
type: WalletType.solana,
@ -360,13 +365,13 @@ Future<void> defaultSettingsMigration(
'solana-rpc.publicnode.com:443',
],
);
_updateNode(
await _updateNode(
nodes: nodes,
currentUri: "ethereum.publicnode.com",
newUri: "ethereum-rpc.publicnode.com",
useSSL: true,
);
_updateNode(
await _updateNode(
nodes: nodes,
currentUri: "polygon-bor.publicnode.com",
newUri: "polygon-bor-rpc.publicnode.com",
@ -387,13 +392,16 @@ Future<void> defaultSettingsMigration(
await sharedPreferences.setInt(PreferencesKey.currentDefaultSettingsMigrationVersion, version);
}
void _updateNode({
Future<void> _updateNode({
required Box<Node> nodes,
required String currentUri,
String? newUri,
bool? useSSL,
}) {
}) async {
for (Node node in nodes.values) {
print("@@@@@@@@@@@@@");
print(node.uriRaw);
print(node.uri);
if (node.uriRaw == currentUri) {
if (newUri != null) {
node.uriRaw = newUri;
@ -401,6 +409,7 @@ void _updateNode({
if (useSSL != null) {
node.useSSL = useSSL;
}
await node.save();
}
}
}
@ -481,7 +490,7 @@ void _deselectExchangeProvider(SharedPreferences sharedPreferences, String provi
);
}
void _fixNodesUseSSLFlag(Box<Node> nodes) {
Future<void> _fixNodesUseSSLFlag(Box<Node> nodes) async {
for (Node node in nodes.values) {
switch (node.uriRaw) {
case cakeWalletLitecoinElectrumUri:
@ -490,6 +499,7 @@ void _fixNodesUseSSLFlag(Box<Node> nodes) {
case newCakeWalletMoneroUri:
node.useSSL = true;
node.trusted = true;
await node.save();
}
}
}

View file

@ -23,7 +23,7 @@ MONERO_COM_SCHEME="monero.com"
CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="4.22.1"
CAKEWALLET_BUILD_NUMBER=241
CAKEWALLET_BUILD_NUMBER=242
CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet"
CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet"
CAKEWALLET_SCHEME="cakewallet"

View file

@ -19,7 +19,7 @@ MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="4.22.1"
CAKEWALLET_BUILD_NUMBER=288
CAKEWALLET_BUILD_NUMBER=289
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
HAVEN_NAME="Haven"

View file

@ -15,7 +15,7 @@ fi
CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="1.12.1"
CAKEWALLET_BUILD_NUMBER=42
CAKEWALLET_BUILD_NUMBER=43
if ! [[ " ${TYPES[*]} " =~ " ${APP_LINUX_TYPE} " ]]; then
echo "Wrong app type."

View file

@ -22,7 +22,7 @@ MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="1.15.1"
CAKEWALLET_BUILD_NUMBER=100
CAKEWALLET_BUILD_NUMBER=101
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
if ! [[ " ${TYPES[*]} " =~ " ${APP_MACOS_TYPE} " ]]; then