safeguard calls to coin integration classes (#3534)

This commit is contained in:
malik1004x
2026-08-20 23:14:12 +02:00
committed by GitHub
parent e9dec67522
commit 517612095b
2 changed files with 28 additions and 12 deletions
+19 -7
View File
@@ -95,8 +95,12 @@ Future<void> defaultSettingsMigration(
case 1:
await sharedPreferences.setString(
PreferencesKey.currentFiatCurrencyKey, FiatCurrency.usd.toString());
await sharedPreferences.setInt(PreferencesKey.currentTransactionPriorityKeyLegacy,
monero!.getDefaultTransactionPriority().raw);
if (monero != null) {
await sharedPreferences.setInt(
PreferencesKey.currentTransactionPriorityKeyLegacy,
monero!.getDefaultTransactionPriority().raw);
}
await sharedPreferences.setInt(
PreferencesKey.currentBalanceDisplayModeKey, BalanceDisplayMode.availableBalance.raw);
await sharedPreferences.setBool('save_recipient_address', true);
@@ -791,6 +795,10 @@ Future<void> _backupWowneroSeeds(Box<HavenSeedStore> havenSeedStore) async {
}
Future<void> _updateMoneroPriority(SharedPreferences sharedPreferences) async {
if (monero == null) {
return;
}
final currentPriority =
await sharedPreferences.getInt(PreferencesKey.moneroTransactionPriority) ??
monero!.getDefaultTransactionPriority().serialize();
@@ -1071,11 +1079,15 @@ Future<void> generateBackupPassword(SecureStorage secureStorage) async {
Future<void> changeTransactionPriorityAndFeeRateKeys(SharedPreferences sharedPreferences) async {
final legacyTransactionPriority =
sharedPreferences.getInt(PreferencesKey.currentTransactionPriorityKeyLegacy)!;
await sharedPreferences.setInt(
PreferencesKey.moneroTransactionPriority, legacyTransactionPriority);
await sharedPreferences.setInt(PreferencesKey.bitcoinTransactionPriority,
bitcoin!.getMediumTransactionPriority().serialize());
sharedPreferences.getInt(PreferencesKey.currentTransactionPriorityKeyLegacy);
if (legacyTransactionPriority != null) {
await sharedPreferences.setInt(
PreferencesKey.moneroTransactionPriority, legacyTransactionPriority);
}
if (bitcoin != null) {
await sharedPreferences.setInt(PreferencesKey.bitcoinTransactionPriority,
bitcoin!.getMediumTransactionPriority().serialize());
}
}
Future<void> fixBtcDerivationPaths() async {
+9 -5
View File
@@ -1777,12 +1777,16 @@ abstract class SettingsStoreBase with Store {
Future<void> reload() async {
final sharedPreferences = await getIt.getAsync<SharedPreferences>();
fiatCurrency = FiatCurrency.deserialize(
raw: sharedPreferences.getString(PreferencesKey.currentFiatCurrencyKey)!);
final savedFiatCurrency = sharedPreferences.getString(PreferencesKey.currentFiatCurrencyKey);
if (savedFiatCurrency != null) {
fiatCurrency = FiatCurrency.deserialize(raw: savedFiatCurrency);
}
priority[WalletType.monero] = monero?.deserializeMoneroTransactionPriority(
raw: sharedPreferences.getInt(PreferencesKey.moneroTransactionPriority)!) ??
priority[WalletType.monero]!;
if (monero != null &&
sharedPreferences.getInt(PreferencesKey.moneroTransactionPriority) != null) {
priority[WalletType.monero] = monero!.deserializeMoneroTransactionPriority(
raw: sharedPreferences.getInt(PreferencesKey.moneroTransactionPriority)!);
}
if (wownero != null &&
sharedPreferences.getInt(PreferencesKey.wowneroTransactionPriority) != null) {