disable mweb on desktop
OmarHatem committed
Mar 24, 2026 at 15:00 UTC
d5ee2abe50ebacab6b58349e559f7734962bdb69
3 files changed
+48
-44
lib/src/screens/settings/privacy_page.dart
+1
-1
@@ -82,7 +82,7 @@ class PrivacyPage extends BasePage {
82
label: S.of(context).silent_payments,
83
onTap: () =>
84
Navigator.of(context).pushNamed(Routes.silentPaymentsSettings)),
85
- if (_privacySettingsViewModel.isLitecoin)
85
+ if (_privacySettingsViewModel.hasMWEB)
86
ListItemRegularRow(
87
iconPath: "assets/new-ui/settings_row_icons/mweb.svg",
88
keyValue: "mweb",
lib/view_model/dashboard/dashboard_view_model.dart
+44
-42
@@ -191,12 +191,12 @@ abstract class DashboardViewModelBase with Store {
191
value: () => tradeFilterStore.displaySwapXyz,
192
caption: ExchangeProviderDescription.swapsXyz.title,
193
onChanged: () =>
194
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.swapsXyz)),
194
+ tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.swapsXyz)),
195
FilterItem(
196
value: () => tradeFilterStore.displayNearIntents,
197
caption: ExchangeProviderDescription.nearIntents.title,
198
- onChanged: () =>
199
- tradeFilterStore.toggleDisplayExchange(ExchangeProviderDescription.nearIntents)),
198
+ onChanged: () => tradeFilterStore
199
+ .toggleDisplayExchange(ExchangeProviderDescription.nearIntents)),
200
]
201
},
202
subname = '',
@@ -371,7 +371,13 @@ abstract class DashboardViewModelBase with Store {
371
372
@computed
373
bool get isSyncHeavy {
374
- if ([WalletType.monero, WalletType.wownero, WalletType.decred, WalletType.zcash, WalletType.zano].contains(wallet.type)) {
374
+ if ([
375
+ WalletType.monero,
376
+ WalletType.wownero,
377
+ WalletType.decred,
378
+ WalletType.zcash,
379
+ WalletType.zano
380
+ ].contains(wallet.type)) {
381
return true;
382
}
383
@@ -391,47 +397,42 @@ abstract class DashboardViewModelBase with Store {
397
final accountStyleSettings =
398
await BalanceCardStyleSettings.getAll(wallet.walletInfo.internalId);
399
394
- late final int numAccounts;
395
- if (wallet.type == WalletType.monero) {
396
- numAccounts = monero!.getAccountList(wallet).accounts.length;
397
- } else if (wallet.type == WalletType.wownero) {
398
- numAccounts = wow.wownero!.getAccountList(wallet).accounts.length;
399
- } else if (wallet.type == WalletType.bitcoin) {
400
- // bitcoin and lightning
401
- numAccounts = 2;
402
- } else {
403
- numAccounts = 1;
404
- }
400
+ late final int numAccounts;
401
+ if (wallet.type == WalletType.monero) {
402
+ numAccounts = monero!.getAccountList(wallet).accounts.length;
403
+ } else if (wallet.type == WalletType.wownero) {
404
+ numAccounts = wow.wownero!.getAccountList(wallet).accounts.length;
405
+ } else if (wallet.type == WalletType.bitcoin) {
406
+ // bitcoin and lightning
407
+ numAccounts = 2;
408
+ } else {
409
+ numAccounts = 1;
410
+ }
411
cardDesigns.clear();
406
- Map<int, int> newOrder = {};
412
+ Map<int, int> newOrder = {};
413
414
for (int i = 0; i < numAccounts; i++) {
415
late final int index;
410
- if(balanceViewModel.hasAccounts) {
416
+ if (balanceViewModel.hasAccounts) {
417
index = i;
412
- } else if(wallet.type == WalletType.bitcoin && i == 1) {
418
+ } else if (wallet.type == WalletType.bitcoin && i == 1) {
419
index = 0;
420
} else {
421
index = -1;
422
}
423
418
-
419
- final setting = accountStyleSettings
420
- .where((e) => e.accountIndex == index)
421
- .firstOrNull;
422
-
424
+ final setting = accountStyleSettings.where((e) => e.accountIndex == index).firstOrNull;
425
426
late final CryptoCurrency curr;
425
- if(wallet.type == WalletType.bitcoin && i == 1) {
427
+ if (wallet.type == WalletType.bitcoin && i == 1) {
428
curr = CryptoCurrency.btcln;
429
} else {
430
curr = wallet.currency;
431
}
432
431
-
433
cardDesigns.add(CardDesign.fromStyleSettings(setting, curr));
433
- if(setting?.cardOrder != null) {
434
- newOrder[setting!.cardOrder] = i;
434
+ if (setting?.cardOrder != null) {
435
+ newOrder[setting!.cardOrder] = i;
436
}
437
}
438
@@ -442,12 +443,11 @@ abstract class DashboardViewModelBase with Store {
443
while (newOrder.containsValue(free)) {
444
free++;
445
}
445
- if(wallet.type == WalletType.bitcoin) {
446
+ if (wallet.type == WalletType.bitcoin) {
447
newOrder[free] = 0;
448
} else {
449
newOrder[free] = i;
450
}
450
-
451
}
452
}
453
cardOrder = newOrder.asObservable();
@@ -490,9 +490,9 @@ abstract class DashboardViewModelBase with Store {
490
))
491
.where((item) => !transactions.contains(item));
492
493
- transactions.removeWhere((item) =>
494
- newTransactions.any((tx) => tx.transaction.txHash == item.transaction.txHash && tx.transaction.direction == item.transaction.direction)
495
- );
493
+ transactions.removeWhere((item) => newTransactions.any((tx) =>
494
+ tx.transaction.txHash == item.transaction.txHash &&
495
+ tx.transaction.direction == item.transaction.direction));
496
497
transactions.addAll(newTransactions);
498
// transactions.clear();
@@ -555,18 +555,18 @@ abstract class DashboardViewModelBase with Store {
555
556
@computed
557
bool get shouldShowMwebAd {
558
- if(wallet.type != WalletType.litecoin) return false;
558
+ if (wallet.type != WalletType.litecoin) return false;
559
560
- if(mwebEnabled) return false;
560
+ if (mwebEnabled) return false;
561
562
- if(settingsStore.mwebAdDismissed) return false;
562
+ if (settingsStore.mwebAdDismissed) return false;
563
564
- return true;
564
+ return Platform.isAndroid || Platform.isIOS;
565
}
566
567
@action
568
void dismissMwebAd(bool enableMweb) {
569
- if(enableMweb) setMwebEnabled();
569
+ if (enableMweb) setMwebEnabled();
570
571
settingsStore.mwebAdDismissed = true;
572
}
@@ -600,7 +600,7 @@ abstract class DashboardViewModelBase with Store {
600
continue;
601
}
602
603
- if(transaction.transaction.confirmations >= transaction.neededConfirmations) {
603
+ if (transaction.transaction.confirmations >= transaction.neededConfirmations) {
604
continue;
605
}
606
@@ -625,9 +625,10 @@ abstract class DashboardViewModelBase with Store {
625
bool get showApps => appStore.settingsStore.shouldShowMarketPlaceInDashboard;
626
627
@computed
628
- List<TradeListItem> get trades =>
629
- tradesStore.trades.where((trade) {
630
- 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
628
+ List<TradeListItem> get trades => tradesStore.trades.where((trade) {
629
+ final isSameChain = trade.trade.chainId != null
630
+ ? trade.trade.chainId == wallet.chainId
631
+ : true; // returning default as true here so it falls back to the default checks if there's no chainId
632
return trade.trade.walletId == wallet.id && isSameChain;
633
}).toList();
634
@@ -843,7 +844,8 @@ abstract class DashboardViewModelBase with Store {
844
845
@action
846
void toggleSwitchStatusDisplayMode() {
846
- if (status is SyncingSyncStatus && !((status as SyncingSyncStatus).shouldShowBlocksRemaining())) {
847
+ if (status is SyncingSyncStatus &&
848
+ !((status as SyncingSyncStatus).shouldShowBlocksRemaining())) {
849
if (settingsStore.syncStatusDisplayMode == SyncStatusDisplayMode.eta) {
850
settingsStore.syncStatusDisplayMode = SyncStatusDisplayMode.blocksRemaining;
851
} else {
lib/view_model/settings/privacy_settings_view_model.dart
+3
-1
@@ -1,3 +1,5 @@
1
+import 'dart:io';
2
+
3
import 'package:cake_wallet/bitcoin/bitcoin.dart';
4
import 'package:cake_wallet/entities/auto_generate_subaddress_status.dart';
5
import 'package:cake_wallet/store/settings_store.dart';
@@ -23,7 +25,7 @@ abstract class PrivacySettingsViewModelBase with Store {
25
bool get isBitcoin => _wallet.type == WalletType.bitcoin;
26
27
@computed
26
- bool get isLitecoin => _wallet.type == WalletType.litecoin;
28
+ bool get hasMWEB => _wallet.type == WalletType.litecoin && (Platform.isIOS || Platform.isAndroid);
29
30
@computed
31
bool get isAutoGenerateSubaddressesEnabled =>