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