disable mweb on desktop

This commit is contained in:
OmarHatem
2026-03-24 15:00:47 +01:00
parent 079fb1a028
commit d5ee2abe50
3 changed files with 48 additions and 44 deletions
@@ -191,12 +191,12 @@ abstract class DashboardViewModelBase with Store {
value: () => tradeFilterStore.displaySwapXyz,
caption: ExchangeProviderDescription.swapsXyz.title,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.swapsXyz)),
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.swapsXyz)),
FilterItem(
value: () => tradeFilterStore.displayNearIntents,
caption: ExchangeProviderDescription.nearIntents.title,
onChanged: () =>
tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.nearIntents)),
onChanged: () => tradeFilterStore
.toggleDisplayExchange(ExchangeProviderDescription.nearIntents)),
]
},
subname = '',
@@ -371,7 +371,13 @@ abstract class DashboardViewModelBase with Store {
@computed
bool get isSyncHeavy {
if ([WalletType.monero, WalletType.wownero, WalletType.decred, WalletType.zcash, WalletType.zano].contains(wallet.type)) {
if ([
WalletType.monero,
WalletType.wownero,
WalletType.decred,
WalletType.zcash,
WalletType.zano
].contains(wallet.type)) {
return true;
}
@@ -391,47 +397,42 @@ abstract class DashboardViewModelBase with Store {
final accountStyleSettings =
await BalanceCardStyleSettings.getAll(wallet.walletInfo.internalId);
late final int numAccounts;
if (wallet.type == WalletType.monero) {
numAccounts = monero!.getAccountList(wallet).accounts.length;
} else if (wallet.type == WalletType.wownero) {
numAccounts = wow.wownero!.getAccountList(wallet).accounts.length;
} else if (wallet.type == WalletType.bitcoin) {
// bitcoin and lightning
numAccounts = 2;
} else {
numAccounts = 1;
}
late final int numAccounts;
if (wallet.type == WalletType.monero) {
numAccounts = monero!.getAccountList(wallet).accounts.length;
} else if (wallet.type == WalletType.wownero) {
numAccounts = wow.wownero!.getAccountList(wallet).accounts.length;
} else if (wallet.type == WalletType.bitcoin) {
// bitcoin and lightning
numAccounts = 2;
} else {
numAccounts = 1;
}
cardDesigns.clear();
Map<int, int> newOrder = {};
Map<int, int> newOrder = {};
for (int i = 0; i < numAccounts; i++) {
late final int index;
if(balanceViewModel.hasAccounts) {
if (balanceViewModel.hasAccounts) {
index = i;
} else if(wallet.type == WalletType.bitcoin && i == 1) {
} else if (wallet.type == WalletType.bitcoin && i == 1) {
index = 0;
} else {
index = -1;
}
final setting = accountStyleSettings
.where((e) => e.accountIndex == index)
.firstOrNull;
final setting = accountStyleSettings.where((e) => e.accountIndex == index).firstOrNull;
late final CryptoCurrency curr;
if(wallet.type == WalletType.bitcoin && i == 1) {
if (wallet.type == WalletType.bitcoin && i == 1) {
curr = CryptoCurrency.btcln;
} else {
curr = wallet.currency;
}
cardDesigns.add(CardDesign.fromStyleSettings(setting, curr));
if(setting?.cardOrder != null) {
newOrder[setting!.cardOrder] = i;
if (setting?.cardOrder != null) {
newOrder[setting!.cardOrder] = i;
}
}
@@ -442,12 +443,11 @@ abstract class DashboardViewModelBase with Store {
while (newOrder.containsValue(free)) {
free++;
}
if(wallet.type == WalletType.bitcoin) {
if (wallet.type == WalletType.bitcoin) {
newOrder[free] = 0;
} else {
newOrder[free] = i;
}
}
}
cardOrder = newOrder.asObservable();
@@ -490,9 +490,9 @@ abstract class DashboardViewModelBase with Store {
))
.where((item) => !transactions.contains(item));
transactions.removeWhere((item) =>
newTransactions.any((tx) => tx.transaction.txHash == item.transaction.txHash && tx.transaction.direction == item.transaction.direction)
);
transactions.removeWhere((item) => newTransactions.any((tx) =>
tx.transaction.txHash == item.transaction.txHash &&
tx.transaction.direction == item.transaction.direction));
transactions.addAll(newTransactions);
// transactions.clear();
@@ -555,18 +555,18 @@ abstract class DashboardViewModelBase with Store {
@computed
bool get shouldShowMwebAd {
if(wallet.type != WalletType.litecoin) return false;
if (wallet.type != WalletType.litecoin) return false;
if(mwebEnabled) return false;
if (mwebEnabled) return false;
if(settingsStore.mwebAdDismissed) return false;
if (settingsStore.mwebAdDismissed) return false;
return true;
return Platform.isAndroid || Platform.isIOS;
}
@action
void dismissMwebAd(bool enableMweb) {
if(enableMweb) setMwebEnabled();
if (enableMweb) setMwebEnabled();
settingsStore.mwebAdDismissed = true;
}
@@ -600,7 +600,7 @@ abstract class DashboardViewModelBase with Store {
continue;
}
if(transaction.transaction.confirmations >= transaction.neededConfirmations) {
if (transaction.transaction.confirmations >= transaction.neededConfirmations) {
continue;
}
@@ -625,9 +625,10 @@ abstract class DashboardViewModelBase with Store {
bool get showApps => appStore.settingsStore.shouldShowMarketPlaceInDashboard;
@computed
List<TradeListItem> get trades =>
tradesStore.trades.where((trade) {
final isSameChain = trade.trade.chainId != null ? trade.trade.chainId == wallet.chainId : true; // returning default as true here so it falls back to the default checks if there's no chainId
List<TradeListItem> get trades => tradesStore.trades.where((trade) {
final isSameChain = trade.trade.chainId != null
? trade.trade.chainId == wallet.chainId
: true; // returning default as true here so it falls back to the default checks if there's no chainId
return trade.trade.walletId == wallet.id && isSameChain;
}).toList();
@@ -843,7 +844,8 @@ abstract class DashboardViewModelBase with Store {
@action
void toggleSwitchStatusDisplayMode() {
if (status is SyncingSyncStatus && !((status as SyncingSyncStatus).shouldShowBlocksRemaining())) {
if (status is SyncingSyncStatus &&
!((status as SyncingSyncStatus).shouldShowBlocksRemaining())) {
if (settingsStore.syncStatusDisplayMode == SyncStatusDisplayMode.eta) {
settingsStore.syncStatusDisplayMode = SyncStatusDisplayMode.blocksRemaining;
} else {
@@ -1,3 +1,5 @@
import 'dart:io';
import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cake_wallet/entities/auto_generate_subaddress_status.dart';
import 'package:cake_wallet/store/settings_store.dart';
@@ -23,7 +25,7 @@ abstract class PrivacySettingsViewModelBase with Store {
bool get isBitcoin => _wallet.type == WalletType.bitcoin;
@computed
bool get isLitecoin => _wallet.type == WalletType.litecoin;
bool get hasMWEB => _wallet.type == WalletType.litecoin && (Platform.isIOS || Platform.isAndroid);
@computed
bool get isAutoGenerateSubaddressesEnabled =>