minor fixes

This commit is contained in:
Serhii 2023-10-27 14:39:25 +03:00
parent 3d9a014593
commit 5a2a203054
8 changed files with 104 additions and 104 deletions

View file

@ -246,12 +246,12 @@ class BackupService {
final sortBalanceTokensBy = data[PreferencesKey.sortBalanceBy] as int?;
final pinNativeTokenAtTop = data[PreferencesKey.pinNativeTokenAtTop] as bool?;
final useEtherscan = data[PreferencesKey.useEtherscan] as bool?;
final looksUpTwitter = data[PreferencesKey.looksUpTwitter] as bool?;
final looksUpMastodon = data[PreferencesKey.looksUpMastodon] as bool?;
final looksUpYatService = data[PreferencesKey.looksUpYatService] as bool?;
final looksUpUnstoppableDomains = data[PreferencesKey.looksUpUnstoppableDomains] as bool?;
final looksUpOpenAlias = data[PreferencesKey.looksUpOpenAlias] as bool?;
final looksUpENS = data[PreferencesKey.looksUpENS] as bool?;
final lookupsTwitter = data[PreferencesKey.lookupsTwitter] as bool?;
final lookupsMastodon = data[PreferencesKey.lookupsMastodon] as bool?;
final lookupsYatService = data[PreferencesKey.lookupsYatService] as bool?;
final lookupsUnstoppableDomains = data[PreferencesKey.lookupsUnstoppableDomains] as bool?;
final lookupsOpenAlias = data[PreferencesKey.lookupsOpenAlias] as bool?;
final lookupsENS = data[PreferencesKey.lookupsENS] as bool?;
final syncAll = data[PreferencesKey.syncAllKey] as bool?;
final syncMode = data[PreferencesKey.syncModeKey] as int?;
final autoGenerateSubaddressStatus = data[PreferencesKey.autoGenerateSubaddressStatusKey] as int?;
@ -379,23 +379,23 @@ class BackupService {
if (useEtherscan != null)
await _sharedPreferences.setBool(PreferencesKey.useEtherscan, useEtherscan);
if (looksUpTwitter != null)
await _sharedPreferences.setBool(PreferencesKey.looksUpTwitter, looksUpTwitter);
if (lookupsTwitter != null)
await _sharedPreferences.setBool(PreferencesKey.lookupsTwitter, lookupsTwitter);
if (looksUpMastodon != null)
await _sharedPreferences.setBool(PreferencesKey.looksUpMastodon, looksUpMastodon);
if (lookupsMastodon != null)
await _sharedPreferences.setBool(PreferencesKey.lookupsMastodon, lookupsMastodon);
if (looksUpYatService != null)
await _sharedPreferences.setBool(PreferencesKey.looksUpYatService, looksUpYatService);
if (lookupsYatService != null)
await _sharedPreferences.setBool(PreferencesKey.lookupsYatService, lookupsYatService);
if (looksUpUnstoppableDomains != null)
await _sharedPreferences.setBool(PreferencesKey.looksUpUnstoppableDomains, looksUpUnstoppableDomains);
if (lookupsUnstoppableDomains != null)
await _sharedPreferences.setBool(PreferencesKey.lookupsUnstoppableDomains, lookupsUnstoppableDomains);
if (looksUpOpenAlias != null)
await _sharedPreferences.setBool(PreferencesKey.looksUpOpenAlias, looksUpOpenAlias);
if (lookupsOpenAlias != null)
await _sharedPreferences.setBool(PreferencesKey.lookupsOpenAlias, lookupsOpenAlias);
if (looksUpENS != null)
await _sharedPreferences.setBool(PreferencesKey.looksUpENS, looksUpENS);
if (lookupsENS != null)
await _sharedPreferences.setBool(PreferencesKey.lookupsENS, lookupsENS);
if (syncAll != null)
await _sharedPreferences.setBool(PreferencesKey.syncAllKey, syncAll);
@ -553,18 +553,18 @@ class BackupService {
_sharedPreferences.getBool(PreferencesKey.pinNativeTokenAtTop),
PreferencesKey.useEtherscan:
_sharedPreferences.getBool(PreferencesKey.useEtherscan),
PreferencesKey.looksUpTwitter:
_sharedPreferences.getBool(PreferencesKey.looksUpTwitter),
PreferencesKey.looksUpMastodon:
_sharedPreferences.getBool(PreferencesKey.looksUpMastodon),
PreferencesKey.looksUpYatService:
_sharedPreferences.getBool(PreferencesKey.looksUpYatService),
PreferencesKey.looksUpUnstoppableDomains:
_sharedPreferences.getBool(PreferencesKey.looksUpUnstoppableDomains),
PreferencesKey.looksUpOpenAlias:
_sharedPreferences.getBool(PreferencesKey.looksUpOpenAlias),
PreferencesKey.looksUpENS:
_sharedPreferences.getBool(PreferencesKey.looksUpENS),
PreferencesKey.lookupsTwitter:
_sharedPreferences.getBool(PreferencesKey.lookupsTwitter),
PreferencesKey.lookupsMastodon:
_sharedPreferences.getBool(PreferencesKey.lookupsMastodon),
PreferencesKey.lookupsYatService:
_sharedPreferences.getBool(PreferencesKey.lookupsYatService),
PreferencesKey.lookupsUnstoppableDomains:
_sharedPreferences.getBool(PreferencesKey.lookupsUnstoppableDomains),
PreferencesKey.lookupsOpenAlias:
_sharedPreferences.getBool(PreferencesKey.lookupsOpenAlias),
PreferencesKey.lookupsENS:
_sharedPreferences.getBool(PreferencesKey.lookupsENS),
PreferencesKey.syncModeKey:
_sharedPreferences.getInt(PreferencesKey.syncModeKey),
PreferencesKey.syncAllKey:

View file

@ -36,7 +36,7 @@ import 'package:cake_wallet/src/screens/receive/anonpay_invoice_page.dart';
import 'package:cake_wallet/src/screens/receive/anonpay_receive_page.dart';
import 'package:cake_wallet/src/screens/restore/wallet_restore_choose_derivation.dart';
import 'package:cake_wallet/src/screens/settings/display_settings_page.dart';
import 'package:cake_wallet/src/screens/settings/domain_looksup_page.dart';
import 'package:cake_wallet/src/screens/settings/domain_lookups_page.dart';
import 'package:cake_wallet/src/screens/settings/manage_nodes_page.dart';
import 'package:cake_wallet/src/screens/settings/other_settings_page.dart';
import 'package:cake_wallet/src/screens/settings/privacy_page.dart';

View file

@ -61,7 +61,7 @@ class AddressResolver {
Future<ParsedAddress> resolve(String text, String ticker) async {
try {
if (text.startsWith('@') && !text.substring(1).contains('@')) {
if(settingsStore.looksUpTwitter) {
if(settingsStore.lookupsTwitter) {
final formattedName = text.substring(1);
final twitterUser = await TwitterApi.lookupUserByName(userName: formattedName);
final addressFromBio = extractAddressByType(
@ -82,7 +82,7 @@ class AddressResolver {
}
if (text.startsWith('@') && text.contains('@', 1) && text.contains('.', 1)) {
if (settingsStore.looksUpMastodon) {
if (settingsStore.lookupsMastodon) {
final subText = text.substring(1);
final hostNameIndex = subText.indexOf('@');
final hostName = subText.substring(hostNameIndex + 1);
@ -124,7 +124,7 @@ class AddressResolver {
}
}
if (text.hasOnlyEmojis) {
if(settingsStore.looksUpYatService) {
if(settingsStore.lookupsYatService) {
if (walletType != WalletType.haven) {
final addresses = await yatService.fetchYatAddress(text, ticker);
return ParsedAddress.fetchEmojiAddress(addresses: addresses, name: text);
@ -140,14 +140,14 @@ class AddressResolver {
}
if (unstoppableDomains.any((domain) => name.trim() == domain)) {
if(settingsStore.looksUpUnstoppableDomains) {
if(settingsStore.lookupsUnstoppableDomains) {
final address = await fetchUnstoppableDomainAddress(text, ticker);
return ParsedAddress.fetchUnstoppableDomainAddress(address: address, name: text);
}
}
if (text.endsWith(".eth")) {
if (settingsStore.looksUpENS) {
if (settingsStore.lookupsENS) {
final address = await EnsRecord.fetchEnsAddress(text, wallet: wallet);
if (address.isNotEmpty && address != "0x0000000000000000000000000000000000000000") {
return ParsedAddress.fetchEnsAddress(name: text, address: address);
@ -156,7 +156,7 @@ class AddressResolver {
}
if (formattedName.contains(".")) {
if(settingsStore.looksUpOpenAlias) {
if(settingsStore.lookupsOpenAlias) {
final txtRecord = await OpenaliasRecord.lookupOpenAliasRecord(formattedName);
if (txtRecord != null) {
final record = await OpenaliasRecord.fetchAddressAndName(

View file

@ -50,12 +50,12 @@ class PreferencesKey {
static const sortBalanceBy = 'sort_balance_by';
static const pinNativeTokenAtTop = 'pin_native_token_at_top';
static const useEtherscan = 'use_etherscan';
static const looksUpTwitter = 'looks_up_twitter';
static const looksUpMastodon = 'looks_up_mastodon';
static const looksUpYatService = 'looks_up_mastodon';
static const looksUpUnstoppableDomains = 'looks_up_mastodon';
static const looksUpOpenAlias = 'looks_up_mastodon';
static const looksUpENS = 'looks_up_ens';
static const lookupsTwitter = 'looks_up_twitter';
static const lookupsMastodon = 'looks_up_mastodon';
static const lookupsYatService = 'looks_up_mastodon';
static const lookupsUnstoppableDomains = 'looks_up_mastodon';
static const lookupsOpenAlias = 'looks_up_mastodon';
static const lookupsENS = 'looks_up_ens';
static String moneroWalletUpdateV1Key(String name) =>
'${PreferencesKey.moneroWalletPasswordUpdateV1Base}_${name}';

View file

@ -23,7 +23,7 @@ import 'package:cake_wallet/src/screens/dashboard/widgets/transactions_page.dart
import 'package:cake_wallet/src/screens/restore/wallet_restore_choose_derivation.dart';
import 'package:cake_wallet/src/screens/settings/desktop_settings/desktop_settings_page.dart';
import 'package:cake_wallet/src/screens/settings/display_settings_page.dart';
import 'package:cake_wallet/src/screens/settings/domain_looksup_page.dart';
import 'package:cake_wallet/src/screens/settings/domain_lookups_page.dart';
import 'package:cake_wallet/src/screens/settings/manage_nodes_page.dart';
import 'package:cake_wallet/src/screens/settings/other_settings_page.dart';
import 'package:cake_wallet/src/screens/settings/privacy_page.dart';

View file

@ -24,27 +24,27 @@ class DomainLookupsPage extends BasePage {
SettingsSwitcherCell(
title: 'Twitter',
value: _privacySettingsViewModel.lookupTwitter,
onValueChange: (_, bool value) => _privacySettingsViewModel.setLookupTwitter(value)),
onValueChange: (_, bool value) => _privacySettingsViewModel.setLookupsTwitter(value)),
SettingsSwitcherCell(
title: 'Mastodon',
value: _privacySettingsViewModel.looksUpMastodon,
onValueChange: (_, bool value) => _privacySettingsViewModel.setLooksUpMastodon(value)),
onValueChange: (_, bool value) => _privacySettingsViewModel.setLookupsMastodon(value)),
SettingsSwitcherCell(
title: 'Yat service',
value: _privacySettingsViewModel.looksUpYatService,
onValueChange: (_, bool value) => _privacySettingsViewModel.setLooksUpYatService(value)),
onValueChange: (_, bool value) => _privacySettingsViewModel.setLookupsYatService(value)),
SettingsSwitcherCell(
title: 'Unstoppable Domains',
value: _privacySettingsViewModel.looksUpUnstoppableDomains,
onValueChange: (_, bool value) => _privacySettingsViewModel.setLooksUpUnstoppableDomains(value)),
onValueChange: (_, bool value) => _privacySettingsViewModel.setLookupsUnstoppableDomains(value)),
SettingsSwitcherCell(
title: 'OpenAlias,',
value: _privacySettingsViewModel.looksUpOpenAlias,
onValueChange: (_, bool value) => _privacySettingsViewModel.setLooksUpOpenAlias(value)),
onValueChange: (_, bool value) => _privacySettingsViewModel.setLookupsOpenAlias(value)),
SettingsSwitcherCell(
title: 'Ethereum Name Service',
value: _privacySettingsViewModel.looksUpENS,
onValueChange: (_, bool value) => _privacySettingsViewModel.setLooksUpENS(value)),
onValueChange: (_, bool value) => _privacySettingsViewModel.setLookupsENS(value)),
//if (!isHaven) it does not work correctly
],

View file

@ -82,12 +82,12 @@ abstract class SettingsStoreBase with Store {
required this.sortBalanceBy,
required this.pinNativeTokenAtTop,
required this.useEtherscan,
required this.looksUpTwitter,
required this.looksUpMastodon,
required this.looksUpYatService,
required this.looksUpUnstoppableDomains,
required this.looksUpOpenAlias,
required this.looksUpENS,
required this.lookupsTwitter,
required this.lookupsMastodon,
required this.lookupsYatService,
required this.lookupsUnstoppableDomains,
required this.lookupsOpenAlias,
required this.lookupsENS,
TransactionPriority? initialBitcoinTransactionPriority,
TransactionPriority? initialMoneroTransactionPriority,
TransactionPriority? initialHavenTransactionPriority,
@ -360,34 +360,34 @@ abstract class SettingsStoreBase with Store {
_sharedPreferences.setBool(PreferencesKey.useEtherscan, useEtherscan));
reaction(
(_) => looksUpTwitter,
(_) => lookupsTwitter,
(bool looksUpTwitter) =>
_sharedPreferences.setBool(PreferencesKey.looksUpTwitter, looksUpTwitter));
_sharedPreferences.setBool(PreferencesKey.lookupsTwitter, looksUpTwitter));
reaction(
(_) => looksUpMastodon,
(_) => lookupsMastodon,
(bool looksUpMastodon) =>
_sharedPreferences.setBool(PreferencesKey.looksUpMastodon, looksUpMastodon));
_sharedPreferences.setBool(PreferencesKey.lookupsMastodon, looksUpMastodon));
reaction(
(_) => looksUpYatService,
(_) => lookupsYatService,
(bool looksUpYatService) =>
_sharedPreferences.setBool(PreferencesKey.looksUpYatService, looksUpYatService));
_sharedPreferences.setBool(PreferencesKey.lookupsYatService, looksUpYatService));
reaction(
(_) => looksUpUnstoppableDomains,
(_) => lookupsUnstoppableDomains,
(bool looksUpUnstoppableDomains) =>
_sharedPreferences.setBool(PreferencesKey.looksUpUnstoppableDomains, looksUpUnstoppableDomains));
_sharedPreferences.setBool(PreferencesKey.lookupsUnstoppableDomains, looksUpUnstoppableDomains));
reaction(
(_) => looksUpOpenAlias,
(_) => lookupsOpenAlias,
(bool looksUpOpenAlias) =>
_sharedPreferences.setBool(PreferencesKey.looksUpOpenAlias, looksUpOpenAlias));
_sharedPreferences.setBool(PreferencesKey.lookupsOpenAlias, looksUpOpenAlias));
reaction(
(_) => looksUpENS,
(_) => lookupsENS,
(bool looksUpENS) =>
_sharedPreferences.setBool(PreferencesKey.looksUpENS, looksUpENS));
_sharedPreferences.setBool(PreferencesKey.lookupsENS, looksUpENS));
this.nodes.observe((change) {
if (change.newValue != null && change.key != null) {
@ -513,22 +513,22 @@ abstract class SettingsStoreBase with Store {
bool useEtherscan;
@observable
bool looksUpTwitter;
bool lookupsTwitter;
@observable
bool looksUpMastodon;
bool lookupsMastodon;
@observable
bool looksUpYatService;
bool lookupsYatService;
@observable
bool looksUpUnstoppableDomains;
bool lookupsUnstoppableDomains;
@observable
bool looksUpOpenAlias;
bool lookupsOpenAlias;
@observable
bool looksUpENS;
bool lookupsENS;
@observable
SyncMode currentSyncMode;
@ -686,12 +686,12 @@ abstract class SettingsStoreBase with Store {
final pinNativeTokenAtTop =
sharedPreferences.getBool(PreferencesKey.pinNativeTokenAtTop) ?? true;
final useEtherscan = sharedPreferences.getBool(PreferencesKey.useEtherscan) ?? true;
final looksUpTwitter = sharedPreferences.getBool(PreferencesKey.looksUpTwitter) ?? true;
final looksUpMastodon = sharedPreferences.getBool(PreferencesKey.looksUpMastodon) ?? true;
final looksUpYatService = sharedPreferences.getBool(PreferencesKey.looksUpYatService) ?? true;
final looksUpUnstoppableDomains = sharedPreferences.getBool(PreferencesKey.looksUpUnstoppableDomains) ?? true;
final looksUpOpenAlias = sharedPreferences.getBool(PreferencesKey.looksUpOpenAlias) ?? true;
final looksUpENS = sharedPreferences.getBool(PreferencesKey.looksUpENS) ?? true;
final lookupsTwitter = sharedPreferences.getBool(PreferencesKey.lookupsTwitter) ?? true;
final lookupsMastodon = sharedPreferences.getBool(PreferencesKey.lookupsMastodon) ?? true;
final lookupsYatService = sharedPreferences.getBool(PreferencesKey.lookupsYatService) ?? true;
final lookupsUnstoppableDomains = sharedPreferences.getBool(PreferencesKey.lookupsUnstoppableDomains) ?? true;
final lookupsOpenAlias = sharedPreferences.getBool(PreferencesKey.lookupsOpenAlias) ?? true;
final lookupsENS = sharedPreferences.getBool(PreferencesKey.lookupsENS) ?? true;
// If no value
if (pinLength == null || pinLength == 0) {
@ -799,12 +799,12 @@ abstract class SettingsStoreBase with Store {
sortBalanceBy: sortBalanceBy,
pinNativeTokenAtTop: pinNativeTokenAtTop,
useEtherscan: useEtherscan,
looksUpTwitter: looksUpTwitter,
looksUpMastodon: looksUpMastodon,
looksUpYatService: looksUpYatService,
looksUpUnstoppableDomains: looksUpUnstoppableDomains,
looksUpOpenAlias: looksUpOpenAlias,
looksUpENS: looksUpENS,
lookupsTwitter: lookupsTwitter,
lookupsMastodon: lookupsMastodon,
lookupsYatService: lookupsYatService,
lookupsUnstoppableDomains: lookupsUnstoppableDomains,
lookupsOpenAlias: lookupsOpenAlias,
lookupsENS: lookupsENS,
initialMoneroTransactionPriority: moneroTransactionPriority,
initialBitcoinTransactionPriority: bitcoinTransactionPriority,
initialHavenTransactionPriority: havenTransactionPriority,
@ -940,12 +940,12 @@ abstract class SettingsStoreBase with Store {
.values[sharedPreferences.getInt(PreferencesKey.sortBalanceBy) ?? sortBalanceBy.index];
pinNativeTokenAtTop = sharedPreferences.getBool(PreferencesKey.pinNativeTokenAtTop) ?? true;
useEtherscan = sharedPreferences.getBool(PreferencesKey.useEtherscan) ?? true;
looksUpTwitter = sharedPreferences.getBool(PreferencesKey.looksUpTwitter) ?? true;
looksUpMastodon = sharedPreferences.getBool(PreferencesKey.looksUpMastodon) ?? true;
looksUpYatService = sharedPreferences.getBool(PreferencesKey.looksUpYatService) ?? true;
looksUpUnstoppableDomains = sharedPreferences.getBool(PreferencesKey.looksUpUnstoppableDomains) ?? true;
looksUpOpenAlias = sharedPreferences.getBool(PreferencesKey.looksUpOpenAlias) ?? true;
looksUpENS = sharedPreferences.getBool(PreferencesKey.looksUpENS) ?? true;
lookupsTwitter = sharedPreferences.getBool(PreferencesKey.lookupsTwitter) ?? true;
lookupsMastodon = sharedPreferences.getBool(PreferencesKey.lookupsMastodon) ?? true;
lookupsYatService = sharedPreferences.getBool(PreferencesKey.lookupsYatService) ?? true;
lookupsUnstoppableDomains = sharedPreferences.getBool(PreferencesKey.lookupsUnstoppableDomains) ?? true;
lookupsOpenAlias = sharedPreferences.getBool(PreferencesKey.lookupsOpenAlias) ?? true;
lookupsENS = sharedPreferences.getBool(PreferencesKey.lookupsENS) ?? true;
final nodeId = sharedPreferences.getInt(PreferencesKey.currentNodeIdKey);
final bitcoinElectrumServerId =

View file

@ -59,22 +59,22 @@ abstract class PrivacySettingsViewModelBase with Store {
bool get useEtherscan => _settingsStore.useEtherscan;
@computed
bool get lookupTwitter => _settingsStore.looksUpTwitter;
bool get lookupTwitter => _settingsStore.lookupsTwitter;
@computed
bool get looksUpMastodon => _settingsStore.looksUpMastodon;
bool get looksUpMastodon => _settingsStore.lookupsMastodon;
@computed
bool get looksUpYatService => _settingsStore.looksUpYatService;
bool get looksUpYatService => _settingsStore.lookupsYatService;
@computed
bool get looksUpUnstoppableDomains => _settingsStore.looksUpUnstoppableDomains;
bool get looksUpUnstoppableDomains => _settingsStore.lookupsUnstoppableDomains;
@computed
bool get looksUpOpenAlias => _settingsStore.looksUpOpenAlias;
bool get looksUpOpenAlias => _settingsStore.lookupsOpenAlias;
@computed
bool get looksUpENS => _settingsStore.looksUpENS;
bool get looksUpENS => _settingsStore.lookupsENS;
bool get canUseEtherscan => _wallet.type == WalletType.ethereum;
@ -98,22 +98,22 @@ abstract class PrivacySettingsViewModelBase with Store {
void setDisableSell(bool value) => _settingsStore.disableSell = value;
@action
void setLookupTwitter(bool value) => _settingsStore.looksUpTwitter = value;
void setLookupsTwitter(bool value) => _settingsStore.lookupsTwitter = value;
@action
void setLooksUpMastodon(bool value) => _settingsStore.looksUpMastodon = value;
void setLookupsMastodon(bool value) => _settingsStore.lookupsMastodon = value;
@action
void setLooksUpENS(bool value) => _settingsStore.looksUpENS = value;
void setLookupsENS(bool value) => _settingsStore.lookupsENS = value;
@action
void setLooksUpYatService(bool value) => _settingsStore.looksUpYatService = value;
void setLookupsYatService(bool value) => _settingsStore.lookupsYatService = value;
@action
void setLooksUpUnstoppableDomains(bool value) => _settingsStore.looksUpUnstoppableDomains = value;
void setLookupsUnstoppableDomains(bool value) => _settingsStore.lookupsUnstoppableDomains = value;
@action
void setLooksUpOpenAlias(bool value) => _settingsStore.looksUpOpenAlias = value;
void setLookupsOpenAlias(bool value) => _settingsStore.lookupsOpenAlias = value;
@action
void setUseEtherscan(bool value) {