mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-23 19:16:09 +00:00
warning fix pt.2
This commit is contained in:
parent
f4465db453
commit
e1a76949dd
3 changed files with 104 additions and 73 deletions
|
@ -44,7 +44,8 @@ class MainActions {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewModel.isTorEnabled) {
|
if (viewModel.isTorEnabled && viewModel.settingsStore.shouldShowTorBuyWarning) {
|
||||||
|
viewModel.settingsStore.shouldShowTorBuyWarning = false;
|
||||||
await _showErrorDialog(context, S.of(context).warning, S.of(context).tor_enabled_warning);
|
await _showErrorDialog(context, S.of(context).warning, S.of(context).tor_enabled_warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +77,7 @@ class MainActions {
|
||||||
if (!viewModel.isEnabledExchangeAction) {
|
if (!viewModel.isEnabledExchangeAction) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await Navigator.of(context).pushNamed(Routes.exchange);
|
await Navigator.of(context).pushNamed(Routes.exchange);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -104,7 +105,8 @@ class MainActions {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewModel.isTorEnabled) {
|
if (viewModel.isTorEnabled && viewModel.settingsStore.shouldShowTorSellWarning) {
|
||||||
|
viewModel.settingsStore.shouldShowTorSellWarning = false;
|
||||||
await _showErrorDialog(context, S.of(context).warning, S.of(context).tor_enabled_warning);
|
await _showErrorDialog(context, S.of(context).warning, S.of(context).tor_enabled_warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,8 @@ class PreferencesKey {
|
||||||
static const lookupsUnstoppableDomains = 'looks_up_mastodon';
|
static const lookupsUnstoppableDomains = 'looks_up_mastodon';
|
||||||
static const lookupsOpenAlias = 'looks_up_mastodon';
|
static const lookupsOpenAlias = 'looks_up_mastodon';
|
||||||
static const lookupsENS = 'looks_up_ens';
|
static const lookupsENS = 'looks_up_ens';
|
||||||
static const shownTorSellWarning = 'shown_tor_sell_warning';
|
static const shouldShowTorSellWarning = 'shown_tor_sell_warning';
|
||||||
static const shownTorBuyWarning = 'shown_tor_buy_warning';
|
static const shouldShowTorBuyWarning = 'shown_tor_buy_warning';
|
||||||
|
|
||||||
|
|
||||||
static String moneroWalletUpdateV1Key(String name) =>
|
static String moneroWalletUpdateV1Key(String name) =>
|
||||||
|
|
|
@ -80,6 +80,8 @@ abstract class SettingsStoreBase with Store {
|
||||||
required Map<WalletType, Node> nodes,
|
required Map<WalletType, Node> nodes,
|
||||||
required Map<WalletType, Node> powNodes,
|
required Map<WalletType, Node> powNodes,
|
||||||
required this.shouldShowYatPopup,
|
required this.shouldShowYatPopup,
|
||||||
|
required this.shouldShowTorBuyWarning,
|
||||||
|
required this.shouldShowTorSellWarning,
|
||||||
required this.isBitcoinBuyEnabled,
|
required this.isBitcoinBuyEnabled,
|
||||||
required this.actionlistDisplayMode,
|
required this.actionlistDisplayMode,
|
||||||
required this.pinTimeOutDuration,
|
required this.pinTimeOutDuration,
|
||||||
|
@ -225,6 +227,16 @@ abstract class SettingsStoreBase with Store {
|
||||||
(bool shouldShowYatPopup) =>
|
(bool shouldShowYatPopup) =>
|
||||||
sharedPreferences.setBool(PreferencesKey.shouldShowYatPopup, shouldShowYatPopup));
|
sharedPreferences.setBool(PreferencesKey.shouldShowYatPopup, shouldShowYatPopup));
|
||||||
|
|
||||||
|
reaction(
|
||||||
|
(_) => shouldShowTorBuyWarning,
|
||||||
|
(bool shouldShowTorBuyWarning) => sharedPreferences.setBool(
|
||||||
|
PreferencesKey.shouldShowTorBuyWarning, shouldShowTorBuyWarning));
|
||||||
|
|
||||||
|
reaction(
|
||||||
|
(_) => shouldShowTorSellWarning,
|
||||||
|
(bool shouldShowTorSellWarning) => sharedPreferences.setBool(
|
||||||
|
PreferencesKey.shouldShowTorSellWarning, shouldShowTorSellWarning));
|
||||||
|
|
||||||
defaultBuyProviders.observe((change) {
|
defaultBuyProviders.observe((change) {
|
||||||
final String key = 'buyProvider_${change.key.toString()}';
|
final String key = 'buyProvider_${change.key.toString()}';
|
||||||
if (change.newValue != null) {
|
if (change.newValue != null) {
|
||||||
|
@ -530,6 +542,12 @@ abstract class SettingsStoreBase with Store {
|
||||||
@observable
|
@observable
|
||||||
bool shouldShowYatPopup;
|
bool shouldShowYatPopup;
|
||||||
|
|
||||||
|
@observable
|
||||||
|
bool shouldShowTorBuyWarning;
|
||||||
|
|
||||||
|
@observable
|
||||||
|
bool shouldShowTorSellWarning;
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
bool shouldShowMarketPlaceInDashboard;
|
bool shouldShowMarketPlaceInDashboard;
|
||||||
|
|
||||||
|
@ -870,6 +888,10 @@ abstract class SettingsStoreBase with Store {
|
||||||
final packageInfo = await PackageInfo.fromPlatform();
|
final packageInfo = await PackageInfo.fromPlatform();
|
||||||
final deviceName = await _getDeviceName() ?? '';
|
final deviceName = await _getDeviceName() ?? '';
|
||||||
final shouldShowYatPopup = sharedPreferences.getBool(PreferencesKey.shouldShowYatPopup) ?? true;
|
final shouldShowYatPopup = sharedPreferences.getBool(PreferencesKey.shouldShowYatPopup) ?? true;
|
||||||
|
final shouldShowTorBuyWarning =
|
||||||
|
sharedPreferences.getBool(PreferencesKey.shouldShowTorBuyWarning) ?? true;
|
||||||
|
final shouldShowTorSellWarning =
|
||||||
|
sharedPreferences.getBool(PreferencesKey.shouldShowTorSellWarning) ?? true;
|
||||||
|
|
||||||
final generateSubaddresses =
|
final generateSubaddresses =
|
||||||
sharedPreferences.getInt(PreferencesKey.autoGenerateSubaddressStatusKey);
|
sharedPreferences.getInt(PreferencesKey.autoGenerateSubaddressStatusKey);
|
||||||
|
@ -1026,74 +1048,77 @@ abstract class SettingsStoreBase with Store {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
return SettingsStore(
|
return SettingsStore(
|
||||||
secureStorage: secureStorage,
|
secureStorage: secureStorage,
|
||||||
sharedPreferences: sharedPreferences,
|
sharedPreferences: sharedPreferences,
|
||||||
initialShouldShowMarketPlaceInDashboard: shouldShowMarketPlaceInDashboard,
|
initialShouldShowMarketPlaceInDashboard: shouldShowMarketPlaceInDashboard,
|
||||||
nodes: nodes,
|
nodes: nodes,
|
||||||
powNodes: powNodes,
|
powNodes: powNodes,
|
||||||
appVersion: packageInfo.version,
|
appVersion: packageInfo.version,
|
||||||
deviceName: deviceName,
|
deviceName: deviceName,
|
||||||
isBitcoinBuyEnabled: isBitcoinBuyEnabled,
|
isBitcoinBuyEnabled: isBitcoinBuyEnabled,
|
||||||
initialFiatCurrency: currentFiatCurrency,
|
initialFiatCurrency: currentFiatCurrency,
|
||||||
initialBalanceDisplayMode: currentBalanceDisplayMode,
|
initialBalanceDisplayMode: currentBalanceDisplayMode,
|
||||||
initialSaveRecipientAddress: shouldSaveRecipientAddress,
|
initialSaveRecipientAddress: shouldSaveRecipientAddress,
|
||||||
initialAutoGenerateSubaddressStatus: autoGenerateSubaddressStatus,
|
initialAutoGenerateSubaddressStatus: autoGenerateSubaddressStatus,
|
||||||
initialMoneroSeedType: moneroSeedType,
|
initialMoneroSeedType: moneroSeedType,
|
||||||
initialAppSecure: isAppSecure,
|
initialAppSecure: isAppSecure,
|
||||||
initialDisableBuy: disableBuy,
|
initialDisableBuy: disableBuy,
|
||||||
initialDisableSell: disableSell,
|
initialDisableSell: disableSell,
|
||||||
initialWalletListOrder: walletListOrder,
|
initialWalletListOrder: walletListOrder,
|
||||||
initialWalletListAscending: walletListAscending,
|
initialWalletListAscending: walletListAscending,
|
||||||
initialFiatMode: currentFiatApiMode,
|
initialFiatMode: currentFiatApiMode,
|
||||||
initialTorConnectionMode: currentTorConnectionMode,
|
initialTorConnectionMode: currentTorConnectionMode,
|
||||||
initialAllowBiometricalAuthentication: allowBiometricalAuthentication,
|
initialAllowBiometricalAuthentication: allowBiometricalAuthentication,
|
||||||
initialCake2FAPresetOptions: selectedCake2FAPreset,
|
initialCake2FAPresetOptions: selectedCake2FAPreset,
|
||||||
initialUseTOTP2FA: useTOTP2FA,
|
initialUseTOTP2FA: useTOTP2FA,
|
||||||
initialTotpSecretKey: totpSecretKey,
|
initialTotpSecretKey: totpSecretKey,
|
||||||
initialFailedTokenTrial: tokenTrialNumber,
|
initialFailedTokenTrial: tokenTrialNumber,
|
||||||
initialExchangeStatus: exchangeStatus,
|
initialExchangeStatus: exchangeStatus,
|
||||||
initialTheme: savedTheme,
|
initialTheme: savedTheme,
|
||||||
actionlistDisplayMode: actionListDisplayMode,
|
actionlistDisplayMode: actionListDisplayMode,
|
||||||
initialPinLength: pinLength,
|
initialPinLength: pinLength,
|
||||||
pinTimeOutDuration: pinCodeTimeOutDuration,
|
pinTimeOutDuration: pinCodeTimeOutDuration,
|
||||||
seedPhraseLength: seedPhraseWordCount,
|
seedPhraseLength: seedPhraseWordCount,
|
||||||
initialLanguageCode: savedLanguageCode,
|
initialLanguageCode: savedLanguageCode,
|
||||||
sortBalanceBy: sortBalanceBy,
|
sortBalanceBy: sortBalanceBy,
|
||||||
pinNativeTokenAtTop: pinNativeTokenAtTop,
|
pinNativeTokenAtTop: pinNativeTokenAtTop,
|
||||||
useEtherscan: useEtherscan,
|
useEtherscan: useEtherscan,
|
||||||
usePolygonScan: usePolygonScan,
|
usePolygonScan: usePolygonScan,
|
||||||
defaultNanoRep: defaultNanoRep,
|
defaultNanoRep: defaultNanoRep,
|
||||||
defaultBananoRep: defaultBananoRep,
|
defaultBananoRep: defaultBananoRep,
|
||||||
lookupsTwitter: lookupsTwitter,
|
lookupsTwitter: lookupsTwitter,
|
||||||
lookupsMastodon: lookupsMastodon,
|
lookupsMastodon: lookupsMastodon,
|
||||||
lookupsYatService: lookupsYatService,
|
lookupsYatService: lookupsYatService,
|
||||||
lookupsUnstoppableDomains: lookupsUnstoppableDomains,
|
lookupsUnstoppableDomains: lookupsUnstoppableDomains,
|
||||||
lookupsOpenAlias: lookupsOpenAlias,
|
lookupsOpenAlias: lookupsOpenAlias,
|
||||||
lookupsENS: lookupsENS,
|
lookupsENS: lookupsENS,
|
||||||
initialMoneroTransactionPriority: moneroTransactionPriority,
|
initialMoneroTransactionPriority: moneroTransactionPriority,
|
||||||
initialBitcoinTransactionPriority: bitcoinTransactionPriority,
|
initialBitcoinTransactionPriority: bitcoinTransactionPriority,
|
||||||
initialHavenTransactionPriority: havenTransactionPriority,
|
initialHavenTransactionPriority: havenTransactionPriority,
|
||||||
initialLitecoinTransactionPriority: litecoinTransactionPriority,
|
initialLitecoinTransactionPriority: litecoinTransactionPriority,
|
||||||
initialBitcoinCashTransactionPriority: bitcoinCashTransactionPriority,
|
initialBitcoinCashTransactionPriority: bitcoinCashTransactionPriority,
|
||||||
initialShouldRequireTOTP2FAForAccessingWallet: shouldRequireTOTP2FAForAccessingWallet,
|
initialShouldRequireTOTP2FAForAccessingWallet: shouldRequireTOTP2FAForAccessingWallet,
|
||||||
initialShouldRequireTOTP2FAForSendsToContact: shouldRequireTOTP2FAForSendsToContact,
|
initialShouldRequireTOTP2FAForSendsToContact: shouldRequireTOTP2FAForSendsToContact,
|
||||||
initialShouldRequireTOTP2FAForSendsToNonContact: shouldRequireTOTP2FAForSendsToNonContact,
|
initialShouldRequireTOTP2FAForSendsToNonContact: shouldRequireTOTP2FAForSendsToNonContact,
|
||||||
initialShouldRequireTOTP2FAForSendsToInternalWallets:
|
initialShouldRequireTOTP2FAForSendsToInternalWallets:
|
||||||
shouldRequireTOTP2FAForSendsToInternalWallets,
|
shouldRequireTOTP2FAForSendsToInternalWallets,
|
||||||
initialShouldRequireTOTP2FAForExchangesToInternalWallets:
|
initialShouldRequireTOTP2FAForExchangesToInternalWallets:
|
||||||
shouldRequireTOTP2FAForExchangesToInternalWallets,
|
shouldRequireTOTP2FAForExchangesToInternalWallets,
|
||||||
initialShouldRequireTOTP2FAForExchangesToExternalWallets:
|
initialShouldRequireTOTP2FAForExchangesToExternalWallets:
|
||||||
shouldRequireTOTP2FAForExchangesToExternalWallets,
|
shouldRequireTOTP2FAForExchangesToExternalWallets,
|
||||||
initialShouldRequireTOTP2FAForAddingContacts: shouldRequireTOTP2FAForAddingContacts,
|
initialShouldRequireTOTP2FAForAddingContacts: shouldRequireTOTP2FAForAddingContacts,
|
||||||
initialShouldRequireTOTP2FAForCreatingNewWallets: shouldRequireTOTP2FAForCreatingNewWallets,
|
initialShouldRequireTOTP2FAForCreatingNewWallets: shouldRequireTOTP2FAForCreatingNewWallets,
|
||||||
initialShouldRequireTOTP2FAForAllSecurityAndBackupSettings:
|
initialShouldRequireTOTP2FAForAllSecurityAndBackupSettings:
|
||||||
shouldRequireTOTP2FAForAllSecurityAndBackupSettings,
|
shouldRequireTOTP2FAForAllSecurityAndBackupSettings,
|
||||||
initialEthereumTransactionPriority: ethereumTransactionPriority,
|
initialEthereumTransactionPriority: ethereumTransactionPriority,
|
||||||
initialPolygonTransactionPriority: polygonTransactionPriority,
|
initialPolygonTransactionPriority: polygonTransactionPriority,
|
||||||
backgroundTasks: backgroundTasks,
|
backgroundTasks: backgroundTasks,
|
||||||
initialSyncMode: savedSyncMode,
|
initialSyncMode: savedSyncMode,
|
||||||
initialSyncAll: savedSyncAll,
|
initialSyncAll: savedSyncAll,
|
||||||
shouldShowYatPopup: shouldShowYatPopup);
|
shouldShowYatPopup: shouldShowYatPopup,
|
||||||
|
shouldShowTorBuyWarning: shouldShowTorBuyWarning,
|
||||||
|
shouldShowTorSellWarning: shouldShowTorSellWarning,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> reload({required Box<Node> nodeSource}) async {
|
Future<void> reload({required Box<Node> nodeSource}) async {
|
||||||
|
@ -1187,6 +1212,10 @@ abstract class SettingsStoreBase with Store {
|
||||||
languageCode = sharedPreferences.getString(PreferencesKey.currentLanguageCode) ?? languageCode;
|
languageCode = sharedPreferences.getString(PreferencesKey.currentLanguageCode) ?? languageCode;
|
||||||
shouldShowYatPopup =
|
shouldShowYatPopup =
|
||||||
sharedPreferences.getBool(PreferencesKey.shouldShowYatPopup) ?? shouldShowYatPopup;
|
sharedPreferences.getBool(PreferencesKey.shouldShowYatPopup) ?? shouldShowYatPopup;
|
||||||
|
shouldShowTorBuyWarning =
|
||||||
|
sharedPreferences.getBool(PreferencesKey.shouldShowTorBuyWarning) ?? shouldShowTorBuyWarning;
|
||||||
|
shouldShowTorSellWarning =
|
||||||
|
sharedPreferences.getBool(PreferencesKey.shouldShowTorSellWarning) ?? shouldShowTorSellWarning;
|
||||||
sortBalanceBy = SortBalanceBy
|
sortBalanceBy = SortBalanceBy
|
||||||
.values[sharedPreferences.getInt(PreferencesKey.sortBalanceBy) ?? sortBalanceBy.index];
|
.values[sharedPreferences.getInt(PreferencesKey.sortBalanceBy) ?? sortBalanceBy.index];
|
||||||
pinNativeTokenAtTop = sharedPreferences.getBool(PreferencesKey.pinNativeTokenAtTop) ?? true;
|
pinNativeTokenAtTop = sharedPreferences.getBool(PreferencesKey.pinNativeTokenAtTop) ?? true;
|
||||||
|
|
Loading…
Reference in a new issue