diff --git a/lib/core/backup_service.dart b/lib/core/backup_service.dart index d439969f5..520447dd4 100644 --- a/lib/core/backup_service.dart +++ b/lib/core/backup_service.dart @@ -246,6 +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 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?; @@ -373,6 +379,24 @@ class BackupService { if (useEtherscan != null) await _sharedPreferences.setBool(PreferencesKey.useEtherscan, useEtherscan); + if (lookupsTwitter != null) + await _sharedPreferences.setBool(PreferencesKey.lookupsTwitter, lookupsTwitter); + + if (lookupsMastodon != null) + await _sharedPreferences.setBool(PreferencesKey.lookupsMastodon, lookupsMastodon); + + if (lookupsYatService != null) + await _sharedPreferences.setBool(PreferencesKey.lookupsYatService, lookupsYatService); + + if (lookupsUnstoppableDomains != null) + await _sharedPreferences.setBool(PreferencesKey.lookupsUnstoppableDomains, lookupsUnstoppableDomains); + + if (lookupsOpenAlias != null) + await _sharedPreferences.setBool(PreferencesKey.lookupsOpenAlias, lookupsOpenAlias); + + if (lookupsENS != null) + await _sharedPreferences.setBool(PreferencesKey.lookupsENS, lookupsENS); + if (syncAll != null) await _sharedPreferences.setBool(PreferencesKey.syncAllKey, syncAll); @@ -529,6 +553,18 @@ class BackupService { _sharedPreferences.getBool(PreferencesKey.pinNativeTokenAtTop), PreferencesKey.useEtherscan: _sharedPreferences.getBool(PreferencesKey.useEtherscan), + 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: diff --git a/lib/di.dart b/lib/di.dart index 53620d3e8..10662d816 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -36,6 +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_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'; @@ -751,6 +752,8 @@ Future setup({ getIt.registerFactory(() => PrivacyPage(getIt.get())); + getIt.registerFactory(() => DomainLookupsPage(getIt.get())); + getIt.registerFactory(() => DisplaySettingsPage(getIt.get())); getIt.registerFactory(() => OtherSettingsPage(getIt.get())); @@ -981,7 +984,10 @@ Future setup({ getIt.registerFactory(() => YatService()); getIt.registerFactory(() => - AddressResolver(yatService: getIt.get(), wallet: getIt.get().wallet!)); + AddressResolver( + yatService: getIt.get(), + wallet: getIt.get().wallet!, + settingsStore: getIt.get())); getIt.registerFactoryParam( (QrViewData viewData, _) => FullscreenQRPage(qrViewData: viewData)); diff --git a/lib/entities/parse_address_from_domain.dart b/lib/entities/parse_address_from_domain.dart index 6e52a93c7..e184f5649 100644 --- a/lib/entities/parse_address_from_domain.dart +++ b/lib/entities/parse_address_from_domain.dart @@ -6,6 +6,7 @@ import 'package:cake_wallet/entities/parsed_address.dart'; import 'package:cake_wallet/entities/unstoppable_domain_address.dart'; import 'package:cake_wallet/entities/emoji_string_extension.dart'; import 'package:cake_wallet/mastodon/mastodon_api.dart'; +import 'package:cake_wallet/store/settings_store.dart'; import 'package:cake_wallet/twitter/twitter_api.dart'; import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/wallet_base.dart'; @@ -13,11 +14,13 @@ import 'package:cw_core/wallet_type.dart'; import 'package:cake_wallet/entities/fio_address_provider.dart'; class AddressResolver { - AddressResolver({required this.yatService, required this.wallet}) : walletType = wallet.type; + AddressResolver({required this.yatService, required this.wallet, required this.settingsStore}) + : walletType = wallet.type; final YatService yatService; final WalletType walletType; final WalletBase wallet; + final SettingsStore settingsStore; static const unstoppableDomains = [ 'crypto', @@ -58,51 +61,55 @@ class AddressResolver { Future resolve(String text, String ticker) async { try { if (text.startsWith('@') && !text.substring(1).contains('@')) { - final formattedName = text.substring(1); - final twitterUser = await TwitterApi.lookupUserByName(userName: formattedName); - final addressFromBio = extractAddressByType( - raw: twitterUser.description, type: CryptoCurrency.fromString(ticker)); - if (addressFromBio != null) { - return ParsedAddress.fetchTwitterAddress(address: addressFromBio, name: text); - } + if(settingsStore.lookupsTwitter) { + final formattedName = text.substring(1); + final twitterUser = await TwitterApi.lookupUserByName(userName: formattedName); + final addressFromBio = extractAddressByType( + raw: twitterUser.description, type: CryptoCurrency.fromString(ticker)); + if (addressFromBio != null) { + return ParsedAddress.fetchTwitterAddress(address: addressFromBio, name: text); + } - final pinnedTweet = twitterUser.pinnedTweet?.text; - if (pinnedTweet != null) { - final addressFromPinnedTweet = - extractAddressByType(raw: pinnedTweet, type: CryptoCurrency.fromString(ticker)); - if (addressFromPinnedTweet != null) { - return ParsedAddress.fetchTwitterAddress(address: addressFromPinnedTweet, name: text); + final pinnedTweet = twitterUser.pinnedTweet?.text; + if (pinnedTweet != null) { + final addressFromPinnedTweet = + extractAddressByType(raw: pinnedTweet, type: CryptoCurrency.fromString(ticker)); + if (addressFromPinnedTweet != null) { + return ParsedAddress.fetchTwitterAddress(address: addressFromPinnedTweet, name: text); + } } } } if (text.startsWith('@') && text.contains('@', 1) && text.contains('.', 1)) { - final subText = text.substring(1); - final hostNameIndex = subText.indexOf('@'); - final hostName = subText.substring(hostNameIndex + 1); - final userName = subText.substring(0, hostNameIndex); + if (settingsStore.lookupsMastodon) { + final subText = text.substring(1); + final hostNameIndex = subText.indexOf('@'); + final hostName = subText.substring(hostNameIndex + 1); + final userName = subText.substring(0, hostNameIndex); - final mastodonUser = - await MastodonAPI.lookupUserByUserName(userName: userName, apiHost: hostName); + final mastodonUser = + await MastodonAPI.lookupUserByUserName(userName: userName, apiHost: hostName); - if (mastodonUser != null) { - String? addressFromBio = - extractAddressByType(raw: mastodonUser.note, type: CryptoCurrency.fromString(ticker)); + if (mastodonUser != null) { + String? addressFromBio = + extractAddressByType(raw: mastodonUser.note, type: CryptoCurrency.fromString(ticker)); - if (addressFromBio != null) { - return ParsedAddress.fetchMastodonAddress(address: addressFromBio, name: text); - } else { - final pinnedPosts = - await MastodonAPI.getPinnedPosts(userId: mastodonUser.id, apiHost: hostName); + if (addressFromBio != null) { + return ParsedAddress.fetchMastodonAddress(address: addressFromBio, name: text); + } else { + final pinnedPosts = + await MastodonAPI.getPinnedPosts(userId: mastodonUser.id, apiHost: hostName); - if (pinnedPosts.isNotEmpty) { - final userPinnedPostsText = pinnedPosts.map((item) => item.content).join('\n'); - String? addressFromPinnedPost = extractAddressByType( - raw: userPinnedPostsText, type: CryptoCurrency.fromString(ticker)); + if (pinnedPosts.isNotEmpty) { + final userPinnedPostsText = pinnedPosts.map((item) => item.content).join('\n'); + String? addressFromPinnedPost = extractAddressByType( + raw: userPinnedPostsText, type: CryptoCurrency.fromString(ticker)); - if (addressFromPinnedPost != null) { - return ParsedAddress.fetchMastodonAddress( - address: addressFromPinnedPost, name: text); + if (addressFromPinnedPost != null) { + return ParsedAddress.fetchMastodonAddress( + address: addressFromPinnedPost, name: text); + } } } } @@ -117,9 +124,11 @@ class AddressResolver { } } if (text.hasOnlyEmojis) { - if (walletType != WalletType.haven) { - final addresses = await yatService.fetchYatAddress(text, ticker); - return ParsedAddress.fetchEmojiAddress(addresses: addresses, name: text); + if(settingsStore.lookupsYatService) { + if (walletType != WalletType.haven) { + final addresses = await yatService.fetchYatAddress(text, ticker); + return ParsedAddress.fetchEmojiAddress(addresses: addresses, name: text); + } } } final formattedName = OpenaliasRecord.formatDomainName(text); @@ -131,23 +140,29 @@ class AddressResolver { } if (unstoppableDomains.any((domain) => name.trim() == domain)) { - final address = await fetchUnstoppableDomainAddress(text, ticker); - return ParsedAddress.fetchUnstoppableDomainAddress(address: address, name: text); + if(settingsStore.lookupsUnstoppableDomains) { + final address = await fetchUnstoppableDomainAddress(text, ticker); + return ParsedAddress.fetchUnstoppableDomainAddress(address: address, name: text); + } } if (text.endsWith(".eth")) { - final address = await EnsRecord.fetchEnsAddress(text, wallet: wallet); - if (address.isNotEmpty && address != "0x0000000000000000000000000000000000000000") { - return ParsedAddress.fetchEnsAddress(name: text, address: address); + if (settingsStore.lookupsENS) { + final address = await EnsRecord.fetchEnsAddress(text, wallet: wallet); + if (address.isNotEmpty && address != "0x0000000000000000000000000000000000000000") { + return ParsedAddress.fetchEnsAddress(name: text, address: address); + } } } if (formattedName.contains(".")) { - final txtRecord = await OpenaliasRecord.lookupOpenAliasRecord(formattedName); - if (txtRecord != null) { - final record = await OpenaliasRecord.fetchAddressAndName( - formattedName: formattedName, ticker: ticker, txtRecord: txtRecord); - return ParsedAddress.fetchOpenAliasAddress(record: record, name: text); + if(settingsStore.lookupsOpenAlias) { + final txtRecord = await OpenaliasRecord.lookupOpenAliasRecord(formattedName); + if (txtRecord != null) { + final record = await OpenaliasRecord.fetchAddressAndName( + formattedName: formattedName, ticker: ticker, txtRecord: txtRecord); + return ParsedAddress.fetchOpenAliasAddress(record: record, name: text); + } } } } catch (e) { diff --git a/lib/entities/preferences_key.dart b/lib/entities/preferences_key.dart index fe9182e97..5ecd1bcc7 100644 --- a/lib/entities/preferences_key.dart +++ b/lib/entities/preferences_key.dart @@ -50,6 +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 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}'; diff --git a/lib/router.dart b/lib/router.dart index 90f0355a6..1211bbcb6 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -24,6 +24,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_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'; @@ -322,6 +323,10 @@ Route createRoute(RouteSettings settings) { return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); + case Routes.domainLookupsPage: + return CupertinoPageRoute( + fullscreenDialog: true, builder: (_) => getIt.get()); + case Routes.displaySettingsPage: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); diff --git a/lib/routes.dart b/lib/routes.dart index 832795a2b..0b4e8817d 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -81,6 +81,7 @@ class Routes { static const connectionSync = '/connection_sync_page'; static const securityBackupPage = '/security_and_backup_page'; static const privacyPage = '/privacy_page'; + static const domainLookupsPage = '/domain_lookups_page'; static const displaySettingsPage = '/display_settings_page'; static const otherSettingsPage = '/other_settings_page'; static const advancedPrivacySettings = '/advanced_privacy_settings'; diff --git a/lib/src/screens/settings/domain_lookups_page.dart b/lib/src/screens/settings/domain_lookups_page.dart new file mode 100644 index 000000000..80849b8ea --- /dev/null +++ b/lib/src/screens/settings/domain_lookups_page.dart @@ -0,0 +1,56 @@ +import 'package:cake_wallet/generated/i18n.dart'; +import 'package:cake_wallet/src/screens/base_page.dart'; +import 'package:cake_wallet/src/screens/settings/widgets/settings_switcher_cell.dart'; +import 'package:cake_wallet/view_model/settings/privacy_settings_view_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_mobx/flutter_mobx.dart'; + +class DomainLookupsPage extends BasePage { + DomainLookupsPage(this._privacySettingsViewModel); + + @override + String get title => S.current.domain_looks_up; + + final PrivacySettingsViewModel _privacySettingsViewModel; + + @override + Widget body(BuildContext context) { + return SingleChildScrollView( + child: Observer(builder: (_) { + return Container( + padding: EdgeInsets.only(top: 10), + child: Column( + children: [ + SettingsSwitcherCell( + title: 'Twitter', + value: _privacySettingsViewModel.lookupTwitter, + onValueChange: (_, bool value) => _privacySettingsViewModel.setLookupsTwitter(value)), + SettingsSwitcherCell( + title: 'Mastodon', + value: _privacySettingsViewModel.looksUpMastodon, + onValueChange: (_, bool value) => _privacySettingsViewModel.setLookupsMastodon(value)), + SettingsSwitcherCell( + title: 'Yat service', + value: _privacySettingsViewModel.looksUpYatService, + onValueChange: (_, bool value) => _privacySettingsViewModel.setLookupsYatService(value)), + SettingsSwitcherCell( + title: 'Unstoppable Domains', + value: _privacySettingsViewModel.looksUpUnstoppableDomains, + onValueChange: (_, bool value) => _privacySettingsViewModel.setLookupsUnstoppableDomains(value)), + SettingsSwitcherCell( + title: 'OpenAlias,', + value: _privacySettingsViewModel.looksUpOpenAlias, + onValueChange: (_, bool value) => _privacySettingsViewModel.setLookupsOpenAlias(value)), + SettingsSwitcherCell( + title: 'Ethereum Name Service', + value: _privacySettingsViewModel.looksUpENS, + onValueChange: (_, bool value) => _privacySettingsViewModel.setLookupsENS(value)), + + //if (!isHaven) it does not work correctly + ], + ), + ); + }), + ); + } +} diff --git a/lib/src/screens/settings/privacy_page.dart b/lib/src/screens/settings/privacy_page.dart index e953fd4ee..8e71b6020 100644 --- a/lib/src/screens/settings/privacy_page.dart +++ b/lib/src/screens/settings/privacy_page.dart @@ -1,7 +1,9 @@ import 'package:cake_wallet/entities/exchange_api_mode.dart'; import 'package:cake_wallet/entities/fiat_api_mode.dart'; import 'package:cake_wallet/generated/i18n.dart'; +import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; +import 'package:cake_wallet/src/screens/settings/widgets/settings_cell_with_arrow.dart'; import 'package:cake_wallet/src/screens/settings/widgets/settings_choices_cell.dart'; import 'package:cake_wallet/src/screens/settings/widgets/settings_switcher_cell.dart'; import 'package:cake_wallet/utils/device_info.dart'; @@ -84,6 +86,10 @@ class PrivacyPage extends BasePage { onValueChange: (BuildContext _, bool value) { _privacySettingsViewModel.setUseEtherscan(value); }), + SettingsCellWithArrow( + title: S.current.domain_looks_up, + handler: (context) => Navigator.of(context).pushNamed(Routes.domainLookupsPage), + ), ], ); }), diff --git a/lib/store/settings_store.dart b/lib/store/settings_store.dart index ad4b8fd1e..cb9df3d1d 100644 --- a/lib/store/settings_store.dart +++ b/lib/store/settings_store.dart @@ -83,6 +83,12 @@ abstract class SettingsStoreBase with Store { required this.sortBalanceBy, required this.pinNativeTokenAtTop, required this.useEtherscan, + required this.lookupsTwitter, + required this.lookupsMastodon, + required this.lookupsYatService, + required this.lookupsUnstoppableDomains, + required this.lookupsOpenAlias, + required this.lookupsENS, TransactionPriority? initialBitcoinTransactionPriority, TransactionPriority? initialMoneroTransactionPriority, TransactionPriority? initialHavenTransactionPriority, @@ -362,6 +368,36 @@ abstract class SettingsStoreBase with Store { (bool useEtherscan) => _sharedPreferences.setBool(PreferencesKey.useEtherscan, useEtherscan)); + reaction( + (_) => lookupsTwitter, + (bool looksUpTwitter) => + _sharedPreferences.setBool(PreferencesKey.lookupsTwitter, looksUpTwitter)); + + reaction( + (_) => lookupsMastodon, + (bool looksUpMastodon) => + _sharedPreferences.setBool(PreferencesKey.lookupsMastodon, looksUpMastodon)); + + reaction( + (_) => lookupsYatService, + (bool looksUpYatService) => + _sharedPreferences.setBool(PreferencesKey.lookupsYatService, looksUpYatService)); + + reaction( + (_) => lookupsUnstoppableDomains, + (bool looksUpUnstoppableDomains) => + _sharedPreferences.setBool(PreferencesKey.lookupsUnstoppableDomains, looksUpUnstoppableDomains)); + + reaction( + (_) => lookupsOpenAlias, + (bool looksUpOpenAlias) => + _sharedPreferences.setBool(PreferencesKey.lookupsOpenAlias, looksUpOpenAlias)); + + reaction( + (_) => lookupsENS, + (bool looksUpENS) => + _sharedPreferences.setBool(PreferencesKey.lookupsENS, looksUpENS)); + this.nodes.observe((change) { if (change.newValue != null && change.key != null) { _saveCurrentNode(change.newValue!, change.key!); @@ -488,6 +524,24 @@ abstract class SettingsStoreBase with Store { @observable bool useEtherscan; + @observable + bool lookupsTwitter; + + @observable + bool lookupsMastodon; + + @observable + bool lookupsYatService; + + @observable + bool lookupsUnstoppableDomains; + + @observable + bool lookupsOpenAlias; + + @observable + bool lookupsENS; + @observable SyncMode currentSyncMode; @@ -647,6 +701,12 @@ abstract class SettingsStoreBase with Store { final pinNativeTokenAtTop = sharedPreferences.getBool(PreferencesKey.pinNativeTokenAtTop) ?? true; final useEtherscan = sharedPreferences.getBool(PreferencesKey.useEtherscan) ?? 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) { @@ -754,6 +814,12 @@ abstract class SettingsStoreBase with Store { sortBalanceBy: sortBalanceBy, pinNativeTokenAtTop: pinNativeTokenAtTop, useEtherscan: useEtherscan, + lookupsTwitter: lookupsTwitter, + lookupsMastodon: lookupsMastodon, + lookupsYatService: lookupsYatService, + lookupsUnstoppableDomains: lookupsUnstoppableDomains, + lookupsOpenAlias: lookupsOpenAlias, + lookupsENS: lookupsENS, initialMoneroTransactionPriority: moneroTransactionPriority, initialBitcoinTransactionPriority: bitcoinTransactionPriority, initialHavenTransactionPriority: havenTransactionPriority, @@ -894,6 +960,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; + 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 = diff --git a/lib/view_model/settings/privacy_settings_view_model.dart b/lib/view_model/settings/privacy_settings_view_model.dart index 27ce919df..b3ffeb353 100644 --- a/lib/view_model/settings/privacy_settings_view_model.dart +++ b/lib/view_model/settings/privacy_settings_view_model.dart @@ -12,7 +12,8 @@ import 'package:cake_wallet/entities/fiat_api_mode.dart'; part 'privacy_settings_view_model.g.dart'; -class PrivacySettingsViewModel = PrivacySettingsViewModelBase with _$PrivacySettingsViewModel; +class +PrivacySettingsViewModel = PrivacySettingsViewModelBase with _$PrivacySettingsViewModel; abstract class PrivacySettingsViewModelBase with Store { PrivacySettingsViewModelBase(this._settingsStore, this._wallet); @@ -57,6 +58,24 @@ abstract class PrivacySettingsViewModelBase with Store { @computed bool get useEtherscan => _settingsStore.useEtherscan; + @computed + bool get lookupTwitter => _settingsStore.lookupsTwitter; + + @computed + bool get looksUpMastodon => _settingsStore.lookupsMastodon; + + @computed + bool get looksUpYatService => _settingsStore.lookupsYatService; + + @computed + bool get looksUpUnstoppableDomains => _settingsStore.lookupsUnstoppableDomains; + + @computed + bool get looksUpOpenAlias => _settingsStore.lookupsOpenAlias; + + @computed + bool get looksUpENS => _settingsStore.lookupsENS; + bool get canUseEtherscan => _wallet.type == WalletType.ethereum; @action @@ -78,6 +97,24 @@ abstract class PrivacySettingsViewModelBase with Store { @action void setDisableSell(bool value) => _settingsStore.disableSell = value; + @action + void setLookupsTwitter(bool value) => _settingsStore.lookupsTwitter = value; + + @action + void setLookupsMastodon(bool value) => _settingsStore.lookupsMastodon = value; + + @action + void setLookupsENS(bool value) => _settingsStore.lookupsENS = value; + + @action + void setLookupsYatService(bool value) => _settingsStore.lookupsYatService = value; + + @action + void setLookupsUnstoppableDomains(bool value) => _settingsStore.lookupsUnstoppableDomains = value; + + @action + void setLookupsOpenAlias(bool value) => _settingsStore.lookupsOpenAlias = value; + @action void setUseEtherscan(bool value) { _settingsStore.useEtherscan = value; diff --git a/res/values/strings_ar.arb b/res/values/strings_ar.arb index a803ef687..4100bdeb8 100644 --- a/res/values/strings_ar.arb +++ b/res/values/strings_ar.arb @@ -723,6 +723,7 @@ "enter_seed_phrase": "أدخل عبارة البذور الخاصة بك", "add_contact": "ﻝﺎﺼﺗﺍ ﺔﻬﺟ ﺔﻓﺎﺿﺇ", "exchange_provider_unsupported": "${providerName} لم يعد مدعومًا!", + "domain_looks_up": "ﻝﺎﺠﻤﻟﺍ ﺚﺤﺑ ﺕﺎﻴﻠﻤﻋ", "require_for_exchanges_to_external_wallets": "ﺔﻴﺟﺭﺎﺧ ﻆﻓﺎﺤﻣ ﻰﻟﺇ ﺕﻻﺩﺎﺒﺘﻟﺍ ﺐﻠﻄﺘﺗ", "camera_permission_is_required": ".ﺍﺮﻴﻣﺎﻜﻟﺍ ﻥﺫﺇ ﺏﻮﻠﻄﻣ", "switchToETHWallet": "ﻯﺮﺧﺃ ﺓﺮﻣ ﺔﻟﻭﺎﺤﻤﻟﺍﻭ Ethereum ﺔﻈﻔﺤﻣ ﻰﻟﺇ ﻞﻳﺪﺒﺘﻟﺍ ﻰﺟﺮﻳ" diff --git a/res/values/strings_bg.arb b/res/values/strings_bg.arb index 85d19d8c4..e12a24119 100644 --- a/res/values/strings_bg.arb +++ b/res/values/strings_bg.arb @@ -719,6 +719,7 @@ "enter_seed_phrase": "Въведете вашата фраза за семена", "add_contact": "Добави контакт", "exchange_provider_unsupported": "${providerName} вече не се поддържа!", + "domain_looks_up": "Търсене на домейни", "require_for_exchanges_to_external_wallets": "Изискване за обмен към външни портфейли", "camera_permission_is_required": "Изисква се разрешение за камерата.\nМоля, активирайте го от настройките на приложението.", "switchToETHWallet": "Моля, преминете към портфейл Ethereum и опитайте отново" diff --git a/res/values/strings_cs.arb b/res/values/strings_cs.arb index b6a59979d..52087ef60 100644 --- a/res/values/strings_cs.arb +++ b/res/values/strings_cs.arb @@ -719,6 +719,7 @@ "enter_seed_phrase": "Zadejte svou frázi semen", "add_contact": "Přidat kontakt", "exchange_provider_unsupported": "${providerName} již není podporováno!", + "domain_looks_up": "Vyhledávání domén", "require_for_exchanges_to_external_wallets": "Vyžadovat pro výměny do externích peněženek", "camera_permission_is_required": "Vyžaduje se povolení fotoaparátu.\nPovolte jej v nastavení aplikace.", "switchToETHWallet": "Přejděte na peněženku Ethereum a zkuste to znovu" diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index 9b7e0f6ef..733b645c9 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -727,6 +727,7 @@ "enter_seed_phrase": "Geben Sie Ihre Seed-Phrase ein", "add_contact": "Kontakt hinzufügen", "exchange_provider_unsupported": "${providerName} wird nicht mehr unterstützt!", + "domain_looks_up": "Domain-Suchen", "require_for_exchanges_to_external_wallets": "Erforderlich für den Umtausch in externe Wallets", "camera_permission_is_required": "Eine Kameraerlaubnis ist erforderlich.\nBitte aktivieren Sie es in den App-Einstellungen.", "switchToETHWallet": "Bitte wechseln Sie zu einem Ethereum-Wallet und versuchen Sie es erneut" diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index e7ca7a850..4264d6b37 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -728,6 +728,7 @@ "enter_seed_phrase": "Enter your seed phrase", "add_contact": "Add contact", "exchange_provider_unsupported": "${providerName} is no longer supported!", + "domain_looks_up": "Domain lookups", "require_for_exchanges_to_external_wallets": "Require for exchanges to external wallets", "camera_permission_is_required": "Camera permission is required. \nPlease enable it from app settings.", "switchToETHWallet": "Please switch to an Ethereum wallet and try again" diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index a05ebd09b..728d15afb 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -727,6 +727,7 @@ "enter_seed_phrase": "Ingrese su frase de semillas", "add_contact": "Agregar contacto", "exchange_provider_unsupported": "¡${providerName} ya no es compatible!", + "domain_looks_up": "Búsquedas de dominio", "require_for_exchanges_to_external_wallets": "Requerido para intercambios a billeteras externas", "camera_permission_is_required": "Se requiere permiso de la cámara.\nHabilítelo desde la configuración de la aplicación.", "switchToETHWallet": "Cambie a una billetera Ethereum e inténtelo nuevamente." diff --git a/res/values/strings_fr.arb b/res/values/strings_fr.arb index 4997ca37d..a65442850 100644 --- a/res/values/strings_fr.arb +++ b/res/values/strings_fr.arb @@ -727,6 +727,7 @@ "enter_seed_phrase": "Entrez votre phrase de semence", "add_contact": "Ajouter le contact", "exchange_provider_unsupported": "${providerName} n'est plus pris en charge!", + "domain_looks_up": "Recherches de domaine", "require_for_exchanges_to_external_wallets": "Exiger des échanges vers des portefeuilles externes", "camera_permission_is_required": "L'autorisation de la caméra est requise.\nVeuillez l'activer à partir des paramètres de l'application.", "switchToETHWallet": "Veuillez passer à un portefeuille Ethereum et réessayer" diff --git a/res/values/strings_ha.arb b/res/values/strings_ha.arb index c07f5c86b..57199fa47 100644 --- a/res/values/strings_ha.arb +++ b/res/values/strings_ha.arb @@ -705,6 +705,7 @@ "enter_seed_phrase": "Shigar da Sert Sentarku", "add_contact": "Ƙara lamba", "exchange_provider_unsupported": "${providerName}", + "domain_looks_up": "Binciken yanki", "require_for_exchanges_to_external_wallets": "Bukatar musanya zuwa wallet na waje", "camera_permission_is_required": "Ana buƙatar izinin kyamara.\nDa fatan za a kunna shi daga saitunan app.", "switchToETHWallet": "Da fatan za a canza zuwa walat ɗin Ethereum kuma a sake gwadawa" diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index c949c9938..536731c94 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -727,6 +727,7 @@ "enter_seed_phrase": "अपना बीज वाक्यांश दर्ज करें", "add_contact": "संपर्क जोड़ें", "exchange_provider_unsupported": "${providerName} अब समर्थित नहीं है!", + "domain_looks_up": "डोमेन लुकअप", "require_for_exchanges_to_external_wallets": "बाहरी वॉलेट में एक्सचेंज की आवश्यकता है", "camera_permission_is_required": "कैमरे की अनुमति आवश्यक है.\nकृपया इसे ऐप सेटिंग से सक्षम करें।", "switchToETHWallet": "कृपया एथेरियम वॉलेट पर स्विच करें और पुनः प्रयास करें" diff --git a/res/values/strings_hr.arb b/res/values/strings_hr.arb index 923547f49..936e41338 100644 --- a/res/values/strings_hr.arb +++ b/res/values/strings_hr.arb @@ -725,6 +725,7 @@ "enter_seed_phrase": "Unesite svoju sjemensku frazu", "add_contact": "Dodaj kontakt", "exchange_provider_unsupported": "${providerName} više nije podržan!", + "domain_looks_up": "Pretraga domena", "require_for_exchanges_to_external_wallets": "Zahtijeva razmjene na vanjske novčanike", "camera_permission_is_required": "Potrebno je dopuštenje kamere.\nOmogućite ga u postavkama aplikacije.", "switchToETHWallet": "Prijeđite na Ethereum novčanik i pokušajte ponovno" diff --git a/res/values/strings_id.arb b/res/values/strings_id.arb index c6537f1b1..036e3e96d 100644 --- a/res/values/strings_id.arb +++ b/res/values/strings_id.arb @@ -715,6 +715,7 @@ "enter_seed_phrase": "Masukkan frasa benih Anda", "add_contact": "Tambah kontak", "exchange_provider_unsupported": "${providerName} tidak lagi didukung!", + "domain_looks_up": "Pencarian domain", "require_for_exchanges_to_external_wallets": "Memerlukan pertukaran ke dompet eksternal", "camera_permission_is_required": "Izin kamera diperlukan.\nSilakan aktifkan dari pengaturan aplikasi.", "switchToETHWallet": "Silakan beralih ke dompet Ethereum dan coba lagi" diff --git a/res/values/strings_it.arb b/res/values/strings_it.arb index 82955798f..5138b1a59 100644 --- a/res/values/strings_it.arb +++ b/res/values/strings_it.arb @@ -727,6 +727,7 @@ "enter_seed_phrase": "Inserisci la tua frase di semi", "add_contact": "Aggiungi contatto", "exchange_provider_unsupported": "${providerName} non è più supportato!", + "domain_looks_up": "Ricerche di domini", "require_for_exchanges_to_external_wallets": "Richiede scambi con portafogli esterni", "camera_permission_is_required": "È richiesta l'autorizzazione della fotocamera.\nAbilitalo dalle impostazioni dell'app.", "switchToETHWallet": "Passa a un portafoglio Ethereum e riprova" diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index e69b55cc6..cc6dad9a8 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -727,6 +727,7 @@ "enter_seed_phrase": "シードフレーズを入力してください", "add_contact": "連絡先を追加", "exchange_provider_unsupported": "${providerName}はサポートされなくなりました!", + "domain_looks_up": "ドメイン検索", "require_for_exchanges_to_external_wallets": "外部ウォレットへの交換に必要", "camera_permission_is_required": "カメラの許可が必要です。\nアプリの設定から有効にしてください。", "switchToETHWallet": "イーサリアムウォレットに切り替えてもう一度お試しください" diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index ce65b820f..9ce833b08 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -725,6 +725,7 @@ "enter_seed_phrase": "시드 문구를 입력하십시오", "add_contact": "주소록에 추가", "exchange_provider_unsupported": "${providerName}은 더 이상 지원되지 않습니다!", + "domain_looks_up": "도메인 조회", "require_for_exchanges_to_external_wallets": "외부 지갑으로의 교환을 위해 필요", "camera_permission_is_required": "카메라 권한이 필요합니다.\n앱 설정에서 활성화해 주세요.", "switchToETHWallet": "이더리움 지갑으로 전환한 후 다시 시도해 주세요." diff --git a/res/values/strings_my.arb b/res/values/strings_my.arb index 5d015475f..c92871c5f 100644 --- a/res/values/strings_my.arb +++ b/res/values/strings_my.arb @@ -725,6 +725,7 @@ "enter_seed_phrase": "သင့်ရဲ့မျိုးစေ့စကားစုကိုရိုက်ထည့်ပါ", "add_contact": "အဆက်အသွယ်ထည့်ပါ။", "exchange_provider_unsupported": "${providerName} မရှိတော့ပါ!", + "domain_looks_up": "ဒိုမိန်းရှာဖွေမှုများ", "require_for_exchanges_to_external_wallets": "ပြင်ပပိုက်ဆံအိတ်များသို့ လဲလှယ်ရန် လိုအပ်သည်။", "camera_permission_is_required": "ကင်မရာခွင့်ပြုချက် လိုအပ်ပါသည်။\nအက်ပ်ဆက်တင်များမှ ၎င်းကိုဖွင့်ပါ။", "switchToETHWallet": "ကျေးဇူးပြု၍ Ethereum ပိုက်ဆံအိတ်သို့ ပြောင်းပြီး ထပ်စမ်းကြည့်ပါ။" diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index c05dab90a..c93861b2b 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -727,6 +727,7 @@ "enter_seed_phrase": "Voer uw zaadzin in", "add_contact": "Contactpersoon toevoegen", "exchange_provider_unsupported": "${providerName} wordt niet langer ondersteund!", + "domain_looks_up": "Domein opzoeken", "require_for_exchanges_to_external_wallets": "Vereist voor uitwisselingen naar externe portemonnees", "camera_permission_is_required": "Cameratoestemming is vereist.\nSchakel dit in via de app-instellingen.", "switchToETHWallet": "Schakel over naar een Ethereum-portemonnee en probeer het opnieuw" diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index 16bf88418..5d32aaa74 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -727,6 +727,7 @@ "enter_seed_phrase": "Wprowadź swoją frazę nasienną", "add_contact": "Dodaj kontakt", "exchange_provider_unsupported": "${providerName} nie jest już obsługiwany!", + "domain_looks_up": "Wyszukiwanie domen", "require_for_exchanges_to_external_wallets": "Wymagaj wymiany na portfele zewnętrzne", "camera_permission_is_required": "Wymagane jest pozwolenie na korzystanie z aparatu.\nWłącz tę funkcję w ustawieniach aplikacji.", "switchToETHWallet": "Przejdź na portfel Ethereum i spróbuj ponownie" diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index 18337cfdb..aa1f7459f 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -726,6 +726,7 @@ "enter_seed_phrase": "Digite sua frase de semente", "add_contact": "Adicionar contato", "exchange_provider_unsupported": "${providerName} não é mais suportado!", + "domain_looks_up": "Pesquisas de domínio", "require_for_exchanges_to_external_wallets": "Exigir trocas para carteiras externas", "camera_permission_is_required": "É necessária permissão da câmera.\nAtive-o nas configurações do aplicativo.", "switchToETHWallet": "Mude para uma carteira Ethereum e tente novamente" diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index 40deb5fb9..31fc00bca 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -727,6 +727,7 @@ "enter_seed_phrase": "Введите свою семенную фразу", "add_contact": "Добавить контакт", "exchange_provider_unsupported": "${providerName} больше не поддерживается!", + "domain_looks_up": "Поиск доменов", "require_for_exchanges_to_external_wallets": "Требовать обмена на внешние кошельки", "camera_permission_is_required": "Требуется разрешение камеры.\nПожалуйста, включите его в настройках приложения.", "switchToETHWallet": "Пожалуйста, переключитесь на кошелек Ethereum и повторите попытку." diff --git a/res/values/strings_th.arb b/res/values/strings_th.arb index 2da16ffcd..b9757a08d 100644 --- a/res/values/strings_th.arb +++ b/res/values/strings_th.arb @@ -725,6 +725,7 @@ "enter_seed_phrase": "ป้อนวลีเมล็ดพันธุ์ของคุณ", "add_contact": "เพิ่มผู้ติดต่อ", "exchange_provider_unsupported": "${providerName} ไม่ได้รับการสนับสนุนอีกต่อไป!", + "domain_looks_up": "การค้นหาโดเมน", "require_for_exchanges_to_external_wallets": "จำเป็นต้องแลกเปลี่ยนกับกระเป๋าเงินภายนอก", "camera_permission_is_required": "ต้องได้รับอนุญาตจากกล้อง\nโปรดเปิดใช้งานจากการตั้งค่าแอป", "switchToETHWallet": "โปรดเปลี่ยนไปใช้กระเป๋าเงิน Ethereum แล้วลองอีกครั้ง" diff --git a/res/values/strings_tl.arb b/res/values/strings_tl.arb index 231dd2db3..6157d9eb3 100644 --- a/res/values/strings_tl.arb +++ b/res/values/strings_tl.arb @@ -722,6 +722,7 @@ "enter_seed_phrase": "Ipasok ang iyong pariralang binhi", "add_contact": "Magdagdag ng contact", "exchange_provider_unsupported": "Ang ${providerName} ay hindi na suportado!", + "domain_looks_up": "Mga paghahanap ng domain", "require_for_exchanges_to_external_wallets": "Kinakailangan para sa mga palitan sa mga panlabas na wallet", "camera_permission_is_required": "Kinakailangan ang pahintulot sa camera.\nMangyaring paganahin ito mula sa mga setting ng app.", "switchToETHWallet": "Mangyaring lumipat sa isang Ethereum wallet at subukang muli" diff --git a/res/values/strings_tr.arb b/res/values/strings_tr.arb index 54062b723..ddc669221 100644 --- a/res/values/strings_tr.arb +++ b/res/values/strings_tr.arb @@ -725,6 +725,7 @@ "enter_seed_phrase": "Tohum ifadenizi girin", "add_contact": "Kişi ekle", "exchange_provider_unsupported": "${providerName} artık desteklenmiyor!", + "domain_looks_up": "Etki alanı aramaları", "require_for_exchanges_to_external_wallets": "Harici cüzdanlara geçiş yapılmasını zorunlu kılın", "camera_permission_is_required": "Kamera izni gereklidir.\nLütfen uygulama ayarlarından etkinleştirin.", "switchToETHWallet": "Lütfen bir Ethereum cüzdanına geçin ve tekrar deneyin" diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index 0c5aaee59..9fb39b6cf 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -727,6 +727,7 @@ "enter_seed_phrase": "Введіть свою насіннєву фразу", "add_contact": "Додати контакт", "exchange_provider_unsupported": "${providerName} більше не підтримується!", + "domain_looks_up": "Пошук доменів", "require_for_exchanges_to_external_wallets": "Потрібен для обміну на зовнішні гаманці", "camera_permission_is_required": "Потрібен дозвіл камери.\nУвімкніть його в налаштуваннях програми.", "switchToETHWallet": "Перейдіть на гаманець Ethereum і повторіть спробу" diff --git a/res/values/strings_ur.arb b/res/values/strings_ur.arb index ec4ccb5b8..e3f934891 100644 --- a/res/values/strings_ur.arb +++ b/res/values/strings_ur.arb @@ -719,6 +719,7 @@ "enter_seed_phrase": "اپنے بیج کا جملہ درج کریں", "add_contact": "۔ﮟﯾﺮﮐ ﻞﻣﺎﺷ ﮧﻄﺑﺍﺭ", "exchange_provider_unsupported": "${providerName} اب تعاون نہیں کیا جاتا ہے!", + "domain_looks_up": "ڈومین تلاش کرنا", "require_for_exchanges_to_external_wallets": "۔ﮯﮨ ﺕﺭﻭﺮﺿ ﯽﮐ ﮯﻟﺩﺎﺒﺗ ﮟﯿﻣ ﮮﻮﭩﺑ ﯽﻧﻭﺮﯿﺑ", "camera_permission_is_required": "۔ﮯﮨ ﺭﺎﮐﺭﺩ ﺕﺯﺎﺟﺍ ﯽﮐ ﮮﺮﻤﯿﮐ", "switchToETHWallet": "۔ﮟﯾﺮﮐ ﺶﺷﻮﮐ ﮦﺭﺎﺑﻭﺩ ﺭﻭﺍ ﮟﯾﺮﮐ ﭻﺋﻮﺳ ﺮﭘ ﭧﯿﻟﺍﻭ Ethereum ﻡﺮﮐ ﮦﺍﺮﺑ" diff --git a/res/values/strings_yo.arb b/res/values/strings_yo.arb index d30d36cb7..aafb70803 100644 --- a/res/values/strings_yo.arb +++ b/res/values/strings_yo.arb @@ -721,6 +721,7 @@ "enter_seed_phrase": "Tẹ ọrọ-iru irugbin rẹ", "add_contact": "Fi olubasọrọ kun", "exchange_provider_unsupported": "${providerName} ko ni atilẹyin mọ!", + "domain_looks_up": "Awọn wiwa agbegbe", "require_for_exchanges_to_external_wallets": "Beere fun awọn paṣipaarọ si awọn apamọwọ ita", "camera_permission_is_required": "A nilo igbanilaaye kamẹra.\nJọwọ jeki o lati app eto.", "switchToETHWallet": "Jọwọ yipada si apamọwọ Ethereum ki o tun gbiyanju lẹẹkansi" diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index b68ffcc0e..67a852bcb 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -726,6 +726,7 @@ "enter_seed_phrase": "输入您的种子短语", "add_contact": "增加联系人", "exchange_provider_unsupported": "${providerName}不再支持!", + "domain_looks_up": "域名查找", "require_for_exchanges_to_external_wallets": "需要兑换到外部钱包", "camera_permission_is_required": "需要相机许可。\n请从应用程序设置中启用它。", "switchToETHWallet": "请切换到以太坊钱包并重试"