diff --git a/lib/entities/default_settings_migration.dart b/lib/entities/default_settings_migration.dart index 8ce38e4c4..944d91cd3 100644 --- a/lib/entities/default_settings_migration.dart +++ b/lib/entities/default_settings_migration.dart @@ -1,6 +1,7 @@ import 'dart:io' show Directory, File, Platform; import 'package:cake_wallet/bitcoin/bitcoin.dart'; import 'package:cake_wallet/entities/exchange_api_mode.dart'; +import 'package:cake_wallet/entities/fiat_api_mode.dart'; import 'package:cw_core/pathForWallet.dart'; import 'package:cake_wallet/entities/secret_store_key.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart'; @@ -211,6 +212,10 @@ Future defaultSettingsMigration( await changeDefaultBitcoinNode(nodes, sharedPreferences); break; + case 30: + await disableServiceStatusFiatDisabled(sharedPreferences); + break; + default: break; } @@ -225,6 +230,18 @@ Future defaultSettingsMigration( await sharedPreferences.setInt(PreferencesKey.currentDefaultSettingsMigrationVersion, version); } +Future disableServiceStatusFiatDisabled(SharedPreferences sharedPreferences) async { + final currentFiat = + await sharedPreferences.getInt(PreferencesKey.currentFiatApiModeKey) ?? -1; + if (currentFiat == -1 || currentFiat == FiatApiMode.enabled.raw) { + return; + } + + if (currentFiat == FiatApiMode.disabled.raw) { + await sharedPreferences.setBool(PreferencesKey.disableBulletinKey, true); + } +} + Future _updateMoneroPriority(SharedPreferences sharedPreferences) async { final currentPriority = await sharedPreferences.getInt(PreferencesKey.moneroTransactionPriority) ?? diff --git a/lib/main.dart b/lib/main.dart index db505f15a..6868348f6 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -149,25 +149,26 @@ Future initializeAppConfigs() async { final unspentCoinsInfoSource = await CakeHive.openBox(UnspentCoinsInfo.boxName); await initialSetup( - sharedPreferences: await SharedPreferences.getInstance(), - nodes: nodes, - powNodes: powNodes, - walletInfoSource: walletInfoSource, - contactSource: contacts, - tradesSource: trades, - ordersSource: orders, - unspentCoinsInfoSource: unspentCoinsInfoSource, - // fiatConvertationService: fiatConvertationService, - templates: templates, - exchangeTemplates: exchangeTemplates, - transactionDescriptions: transactionDescriptions, - secureStorage: secureStorage, - anonpayInvoiceInfo: anonpayInvoiceInfo, - initialMigrationVersion: 29); + sharedPreferences: await SharedPreferences.getInstance(), + nodes: nodes, + powNodes: powNodes, + walletInfoSource: walletInfoSource, + contactSource: contacts, + tradesSource: trades, + ordersSource: orders, + unspentCoinsInfoSource: unspentCoinsInfoSource, + // fiatConvertationService: fiatConvertationService, + templates: templates, + exchangeTemplates: exchangeTemplates, + transactionDescriptions: transactionDescriptions, + secureStorage: secureStorage, + anonpayInvoiceInfo: anonpayInvoiceInfo, + initialMigrationVersion: 30, + ); } Future initialSetup( - {required SharedPreferences sharedPreferences, + {required SharedPreferences sharedPreferences, required Box nodes, required Box powNodes, required Box walletInfoSource,