diff --git a/assets/images/mweb_logo.png b/assets/images/mweb_logo.png new file mode 100644 index 000000000..92317203e Binary files /dev/null and b/assets/images/mweb_logo.png differ diff --git a/cw_bitcoin/lib/litecoin_wallet.dart b/cw_bitcoin/lib/litecoin_wallet.dart index 3ed027f24..4d0beae45 100644 --- a/cw_bitcoin/lib/litecoin_wallet.dart +++ b/cw_bitcoin/lib/litecoin_wallet.dart @@ -52,6 +52,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store { Map? initialRegularAddressIndex, Map? initialChangeAddressIndex, int? initialMwebHeight, + bool? alwaysScan, }) : mwebHd = bitcoin.HDWallet.fromSeed(seedBytes, network: litecoinNetwork).derivePath("m/1000'"), super( @@ -65,6 +66,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store { seedBytes: seedBytes, currency: CryptoCurrency.ltc, ) { + mwebEnabled = alwaysScan ?? false; walletAddresses = LitecoinWalletAddresses( walletInfo, initialAddresses: initialAddresses, @@ -89,7 +91,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store { StreamSubscription? _utxoStream; int mwebUtxosHeight = 0; late RpcClient _stub; - late bool mwebEnabled = true; + late bool mwebEnabled; static Future create( {required String mnemonic, @@ -135,6 +137,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store { required WalletInfo walletInfo, required Box unspentCoinsInfo, required String password, + required bool alwaysScan, }) async { final snp = await ElectrumWalletSnapshot.load(name, walletInfo.type, password, LitecoinNetwork.mainnet); @@ -149,6 +152,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store { initialRegularAddressIndex: snp.regularAddressIndex, initialChangeAddressIndex: snp.changeAddressIndex, addressPageType: snp.addressPageType, + alwaysScan: alwaysScan, ); } @@ -757,5 +761,4 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store { mwebEnabled = enabled; } - bool get isMwebEnabled => mwebEnabled; } diff --git a/cw_bitcoin/lib/litecoin_wallet_service.dart b/cw_bitcoin/lib/litecoin_wallet_service.dart index a41920dcd..12013fb63 100644 --- a/cw_bitcoin/lib/litecoin_wallet_service.dart +++ b/cw_bitcoin/lib/litecoin_wallet_service.dart @@ -19,10 +19,11 @@ class LitecoinWalletService extends WalletService< BitcoinRestoreWalletFromSeedCredentials, BitcoinRestoreWalletFromWIFCredentials, BitcoinNewWalletCredentials> { - LitecoinWalletService(this.walletInfoSource, this.unspentCoinsInfoSource); + LitecoinWalletService(this.walletInfoSource, this.unspentCoinsInfoSource, this.alwaysScan); final Box walletInfoSource; final Box unspentCoinsInfoSource; + final bool alwaysScan; @override WalletType getType() => WalletType.litecoin; @@ -30,11 +31,12 @@ class LitecoinWalletService extends WalletService< @override Future create(BitcoinNewWalletCredentials credentials, {bool? isTestnet}) async { final wallet = await LitecoinWalletBase.create( - mnemonic: await generateElectrumMnemonic(), - password: credentials.password!, - passphrase: credentials.passphrase, - walletInfo: credentials.walletInfo!, - unspentCoinsInfo: unspentCoinsInfoSource); + mnemonic: await generateElectrumMnemonic(), + password: credentials.password!, + passphrase: credentials.passphrase, + walletInfo: credentials.walletInfo!, + unspentCoinsInfo: unspentCoinsInfoSource, + ); await wallet.save(); await wallet.init(); @@ -52,20 +54,24 @@ class LitecoinWalletService extends WalletService< try { final wallet = await LitecoinWalletBase.open( - password: password, - name: name, - walletInfo: walletInfo, - unspentCoinsInfo: unspentCoinsInfoSource); + password: password, + name: name, + walletInfo: walletInfo, + unspentCoinsInfo: unspentCoinsInfoSource, + alwaysScan: alwaysScan, + ); await wallet.init(); saveBackup(name); return wallet; } catch (_) { await restoreWalletFilesFromBackup(name); final wallet = await LitecoinWalletBase.open( - password: password, - name: name, - walletInfo: walletInfo, - unspentCoinsInfo: unspentCoinsInfoSource); + password: password, + name: name, + walletInfo: walletInfo, + unspentCoinsInfo: unspentCoinsInfoSource, + alwaysScan: alwaysScan, + ); await wallet.init(); return wallet; } @@ -93,10 +99,12 @@ class LitecoinWalletService extends WalletService< final currentWalletInfo = walletInfoSource.values .firstWhereOrNull((info) => info.id == WalletBase.idFor(currentName, getType()))!; final currentWallet = await LitecoinWalletBase.open( - password: password, - name: currentName, - walletInfo: currentWalletInfo, - unspentCoinsInfo: unspentCoinsInfoSource); + password: password, + name: currentName, + walletInfo: currentWalletInfo, + unspentCoinsInfo: unspentCoinsInfoSource, + alwaysScan: alwaysScan, + ); await currentWallet.renameWalletFiles(newName); await saveBackup(newName); diff --git a/lib/bitcoin/cw_bitcoin.dart b/lib/bitcoin/cw_bitcoin.dart index 167a585c4..210120ba0 100644 --- a/lib/bitcoin/cw_bitcoin.dart +++ b/lib/bitcoin/cw_bitcoin.dart @@ -208,8 +208,8 @@ class CWBitcoin extends Bitcoin { } WalletService createLitecoinWalletService( - Box walletInfoSource, Box unspentCoinSource) { - return LitecoinWalletService(walletInfoSource, unspentCoinSource); + Box walletInfoSource, Box unspentCoinSource, bool alwaysScan) { + return LitecoinWalletService(walletInfoSource, unspentCoinSource, alwaysScan); } @override @@ -592,6 +592,6 @@ class CWBitcoin extends Bitcoin { @override bool getMwebEnabled(Object wallet) { final litecoinWallet = wallet as LitecoinWallet; - return litecoinWallet.isMwebEnabled; + return litecoinWallet.mwebEnabled; } } diff --git a/lib/di.dart b/lib/di.dart index 1462370fc..8f617fe41 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -93,6 +93,7 @@ import 'package:cake_wallet/src/screens/settings/desktop_settings/desktop_settin 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/mweb_settings.dart'; import 'package:cake_wallet/src/screens/settings/other_settings_page.dart'; import 'package:cake_wallet/src/screens/settings/privacy_page.dart'; import 'package:cake_wallet/src/screens/settings/security_backup_page.dart'; @@ -139,6 +140,7 @@ import 'package:cake_wallet/view_model/seed_type_view_model.dart'; import 'package:cake_wallet/view_model/set_up_2fa_viewmodel.dart'; import 'package:cake_wallet/view_model/restore/restore_from_qr_vm.dart'; import 'package:cake_wallet/view_model/settings/display_settings_view_model.dart'; +import 'package:cake_wallet/view_model/settings/mweb_settings_view_model.dart'; import 'package:cake_wallet/view_model/settings/other_settings_view_model.dart'; import 'package:cake_wallet/view_model/settings/privacy_settings_view_model.dart'; import 'package:cake_wallet/view_model/settings/security_settings_view_model.dart'; @@ -559,7 +561,8 @@ Future setup({ getIt.registerFactory( () => Modify2FAPage(setup2FAViewModel: getIt.get())); - getIt.registerFactory(() => DesktopSettingsPage(getIt.get())); + getIt.registerFactory( + () => DesktopSettingsPage(getIt.get())); getIt.registerFactoryParam( (pageOption, _) => ReceiveOptionViewModel(getIt.get().wallet!, pageOption)); @@ -678,7 +681,9 @@ Future setup({ getIt.registerFactory(() { final wallet = getIt.get().wallet!; - if (wallet.type == WalletType.monero || wallet.type == WalletType.wownero || wallet.type == WalletType.haven) { + if (wallet.type == WalletType.monero || + wallet.type == WalletType.wownero || + wallet.type == WalletType.haven) { return MoneroAccountListViewModel(wallet); } throw Exception( @@ -738,6 +743,9 @@ Future setup({ getIt.registerFactory(() => SilentPaymentsSettingsViewModel(getIt.get(), getIt.get().wallet!)); + getIt.registerFactory( + () => MwebSettingsViewModel(getIt.get(), getIt.get().wallet!)); + getIt.registerFactory(() { return PrivacySettingsViewModel(getIt.get(), getIt.get().wallet!); }); @@ -802,6 +810,8 @@ Future setup({ getIt.registerFactory( () => SilentPaymentsSettingsPage(getIt.get())); + getIt.registerFactory(() => MwebSettingsPage(getIt.get())); + getIt.registerFactory(() => OtherSettingsPage(getIt.get())); getIt.registerFactory(() => NanoChangeRepPage( @@ -895,7 +905,11 @@ Future setup({ getIt.get().silentPaymentsAlwaysScan, ); case WalletType.litecoin: - return bitcoin!.createLitecoinWalletService(_walletInfoSource, _unspentCoinsInfoSource); + return bitcoin!.createLitecoinWalletService( + _walletInfoSource, + _unspentCoinsInfoSource, + getIt.get().mwebAlwaysScan, + ); case WalletType.ethereum: return ethereum!.createEthereumWalletService(_walletInfoSource); case WalletType.bitcoinCash: @@ -1089,7 +1103,8 @@ Future setup({ getIt.registerFactory( () => CakePayService(getIt.get(), getIt.get())); - getIt.registerFactory(() => CakePayCardsListViewModel(cakePayService: getIt.get())); + getIt.registerFactory( + () => CakePayCardsListViewModel(cakePayService: getIt.get())); getIt.registerFactory(() => CakePayAuthViewModel(cakePayService: getIt.get())); @@ -1121,12 +1136,12 @@ Future setup({ getIt.registerFactoryParam, void>((List args, _) { final vendor = args.first as CakePayVendor; - return CakePayBuyCardPage(getIt.get(param1: vendor), - getIt.get()); + return CakePayBuyCardPage( + getIt.get(param1: vendor), getIt.get()); }); - getIt.registerFactoryParam, void>( - (List args, _) { + getIt + .registerFactoryParam, void>((List args, _) { final paymentCredential = args.first as PaymentCredential; final card = args[1] as CakePayCard; return CakePayBuyCardDetailPage( diff --git a/lib/entities/preferences_key.dart b/lib/entities/preferences_key.dart index 2c669c3bd..5511ba84a 100644 --- a/lib/entities/preferences_key.dart +++ b/lib/entities/preferences_key.dart @@ -50,6 +50,7 @@ class PreferencesKey { static const silentPaymentsAlwaysScan = 'silentPaymentsAlwaysScan'; static const mwebCardDisplay = 'mwebCardDisplay'; static const mwebEnabled = 'mwebEnabled'; + static const mwebAlwaysScan = 'mwebAlwaysScan'; static const shouldShowReceiveWarning = 'should_show_receive_warning'; static const shouldShowYatPopup = 'should_show_yat_popup'; static const shouldShowRepWarning = 'should_show_rep_warning'; diff --git a/lib/router.dart b/lib/router.dart index c09664cef..4094b4d56 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -63,6 +63,7 @@ import 'package:cake_wallet/src/screens/settings/desktop_settings/desktop_settin 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/mweb_settings.dart'; import 'package:cake_wallet/src/screens/settings/other_settings_page.dart'; import 'package:cake_wallet/src/screens/settings/privacy_page.dart'; import 'package:cake_wallet/src/screens/settings/security_backup_page.dart'; @@ -363,6 +364,10 @@ Route createRoute(RouteSettings settings) { return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); + case Routes.mwebSettings: + return CupertinoPageRoute( + fullscreenDialog: true, builder: (_) => getIt.get()); + case Routes.connectionSync: return CupertinoPageRoute( fullscreenDialog: true, builder: (_) => getIt.get()); diff --git a/lib/routes.dart b/lib/routes.dart index 78a93bee7..ec8a8f338 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -73,6 +73,7 @@ class Routes { static const cakePayAccountPage = '/cake_pay_account_page'; static const webViewPage = '/web_view_page'; static const silentPaymentsSettings = '/silent_payments_settings'; + static const mwebSettings = '/mweb_settings'; static const connectionSync = '/connection_sync_page'; static const securityBackupPage = '/security_and_backup_page'; static const privacyPage = '/privacy_page'; diff --git a/lib/src/screens/dashboard/pages/balance_page.dart b/lib/src/screens/dashboard/pages/balance_page.dart index c190a3bde..3c516e02d 100644 --- a/lib/src/screens/dashboard/pages/balance_page.dart +++ b/lib/src/screens/dashboard/pages/balance_page.dart @@ -333,7 +333,7 @@ class CryptoBalanceWidget extends StatelessWidget { behavior: HitTestBehavior.opaque, onTap: () => launchUrl( Uri.parse( - "https://guides.cakewallet.com/docs/cryptos/bitcoin/#silent-payments"), + "https://guides.cakewallet.com/docs/cryptos/litecoin/#mweb"), mode: LaunchMode.externalApplication, ), child: Row( @@ -373,8 +373,8 @@ class CryptoBalanceWidget extends StatelessWidget { ], ), onTap: () => _toggleMweb(context), - icon: Icon( - Icons.lock, + icon: ImageIcon( + AssetImage('assets/images/mweb_logo.png'), color: Theme.of(context).extension()!.pageTitleTextColor, size: 50, @@ -422,11 +422,8 @@ class CryptoBalanceWidget extends StatelessWidget { return dashboardViewModel.setSilentPaymentsScanning(newValue); } - Future _toggleMweb(BuildContext context) async { - final isMwebEnabled = dashboardViewModel.mwebEnabled; - final newValue = !isMwebEnabled; - return dashboardViewModel.setMwebEnabled(newValue); + return dashboardViewModel.setMwebEnabled(!dashboardViewModel.mwebEnabled); } } diff --git a/lib/src/screens/dashboard/widgets/menu_widget.dart b/lib/src/screens/dashboard/widgets/menu_widget.dart index 78d8abc95..2ebbab978 100644 --- a/lib/src/screens/dashboard/widgets/menu_widget.dart +++ b/lib/src/screens/dashboard/widgets/menu_widget.dart @@ -188,6 +188,11 @@ class MenuWidgetState extends State { return Container(); } + if (!widget.dashboardViewModel.hasMweb && + item.name(context) == S.current.litecoin_mweb_settings) { + return const SizedBox(); + } + final isLastTile = index == itemCount - 1; return SettingActionButton( diff --git a/lib/src/screens/settings/desktop_settings/desktop_settings_page.dart b/lib/src/screens/settings/desktop_settings/desktop_settings_page.dart index 611b2acb7..90729d4c7 100644 --- a/lib/src/screens/settings/desktop_settings/desktop_settings_page.dart +++ b/lib/src/screens/settings/desktop_settings/desktop_settings_page.dart @@ -60,6 +60,11 @@ class _DesktopSettingsPageState extends State { return Container(); } + if (!widget.dashboardViewModel.hasMweb && + item.name(context) == S.of(context).litecoin_mweb_settings) { + return const SizedBox(); + } + final isLastTile = index == itemCount - 1; return SettingActionButton( isLastTile: isLastTile, diff --git a/lib/src/screens/settings/mweb_settings.dart b/lib/src/screens/settings/mweb_settings.dart new file mode 100644 index 000000000..88dc00f7c --- /dev/null +++ b/lib/src/screens/settings/mweb_settings.dart @@ -0,0 +1,51 @@ +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_switcher_cell.dart'; +import 'package:cake_wallet/view_model/settings/mweb_settings_view_model.dart'; +import 'package:cake_wallet/view_model/settings/silent_payments_settings_view_model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_mobx/flutter_mobx.dart'; + +class MwebSettingsPage extends BasePage { + MwebSettingsPage(this._mwebSettingsViewModel); + + @override + String get title => S.current.litecoin_mweb_settings; + + final MwebSettingsViewModel _mwebSettingsViewModel; + + @override + Widget body(BuildContext context) { + return SingleChildScrollView( + child: Observer(builder: (_) { + return Container( + padding: EdgeInsets.only(top: 10), + child: Column( + children: [ + SettingsSwitcherCell( + title: S.current.litecoin_mweb_display_card, + value: _mwebSettingsViewModel.mwebCardDisplay, + onValueChange: (_, bool value) { + _mwebSettingsViewModel.setMwebCardDisplay(value); + }, + ), + SettingsSwitcherCell( + title: S.current.litecoin_mweb_always_scan, + value: _mwebSettingsViewModel.mwebAlwaysScan, + onValueChange: (_, bool value) { + _mwebSettingsViewModel.setMwebAlwaysScan(value); + }, + ), + SettingsCellWithArrow( + title: S.current.litecoin_mweb_scanning, + handler: (BuildContext context) => Navigator.of(context).pushNamed(Routes.rescan), + ), + ], + ), + ); + }), + ); + } +} diff --git a/lib/src/widgets/dashboard_card_widget.dart b/lib/src/widgets/dashboard_card_widget.dart index 5a8ca14a4..5bcd4b40c 100644 --- a/lib/src/widgets/dashboard_card_widget.dart +++ b/lib/src/widgets/dashboard_card_widget.dart @@ -22,7 +22,7 @@ class DashBoardRoundedCardWidget extends StatelessWidget { final String subTitle; final Widget? hint; final SvgPicture? svgPicture; - final Icon? icon; + final Widget? icon; final double? customBorder; @override diff --git a/lib/src/widgets/setting_actions.dart b/lib/src/widgets/setting_actions.dart index 272ed57c2..62c4685b3 100644 --- a/lib/src/widgets/setting_actions.dart +++ b/lib/src/widgets/setting_actions.dart @@ -18,6 +18,7 @@ class SettingActions { walletSettingAction, addressBookSettingAction, silentPaymentsSettingAction, + litecoinMwebSettingAction, securityBackupSettingAction, privacySettingAction, displaySettingAction, @@ -30,6 +31,7 @@ class SettingActions { walletSettingAction, addressBookSettingAction, silentPaymentsSettingAction, + litecoinMwebSettingAction, securityBackupSettingAction, privacySettingAction, displaySettingAction, @@ -46,6 +48,15 @@ class SettingActions { }, ); + static SettingActions litecoinMwebSettingAction = SettingActions._( + name: (context) => S.current.litecoin_mweb_settings, + image: 'assets/images/mweb_logo.png', + onTap: (BuildContext context) { + Navigator.pop(context); + Navigator.of(context).pushNamed(Routes.mwebSettings); + }, + ); + static SettingActions connectionSettingAction = SettingActions._( name: (context) => S.of(context).connection_sync, image: 'assets/images/nodes_menu.png', diff --git a/lib/store/settings_store.dart b/lib/store/settings_store.dart index 0992451be..404b47181 100644 --- a/lib/store/settings_store.dart +++ b/lib/store/settings_store.dart @@ -110,6 +110,7 @@ abstract class SettingsStoreBase with Store { required this.customBitcoinFeeRate, required this.silentPaymentsCardDisplay, required this.silentPaymentsAlwaysScan, + required this.mwebAlwaysScan, required this.mwebCardDisplay, required this.mwebEnabled, TransactionPriority? initialBitcoinTransactionPriority, @@ -538,6 +539,11 @@ abstract class SettingsStoreBase with Store { (bool silentPaymentsAlwaysScan) => _sharedPreferences.setBool( PreferencesKey.silentPaymentsAlwaysScan, silentPaymentsAlwaysScan)); + reaction( + (_) => mwebAlwaysScan, + (bool mwebAlwaysScan) => + _sharedPreferences.setBool(PreferencesKey.mwebAlwaysScan, mwebAlwaysScan)); + reaction( (_) => mwebCardDisplay, (bool mwebCardDisplay) => @@ -747,6 +753,9 @@ abstract class SettingsStoreBase with Store { @observable bool silentPaymentsAlwaysScan; + @observable + bool mwebAlwaysScan; + @observable bool mwebCardDisplay; @@ -909,6 +918,8 @@ abstract class SettingsStoreBase with Store { sharedPreferences.getBool(PreferencesKey.silentPaymentsCardDisplay) ?? true; final silentPaymentsAlwaysScan = sharedPreferences.getBool(PreferencesKey.silentPaymentsAlwaysScan) ?? false; + final mwebAlwaysScan = + sharedPreferences.getBool(PreferencesKey.mwebAlwaysScan) ?? false; final mwebCardDisplay = sharedPreferences.getBool(PreferencesKey.mwebCardDisplay) ?? true; final mwebEnabled = sharedPreferences.getBool(PreferencesKey.mwebEnabled) ?? false; @@ -1163,6 +1174,7 @@ abstract class SettingsStoreBase with Store { customBitcoinFeeRate: customBitcoinFeeRate, silentPaymentsCardDisplay: silentPaymentsCardDisplay, silentPaymentsAlwaysScan: silentPaymentsAlwaysScan, + mwebAlwaysScan: mwebAlwaysScan, mwebCardDisplay: mwebCardDisplay, mwebEnabled: mwebEnabled, initialMoneroTransactionPriority: moneroTransactionPriority, @@ -1315,6 +1327,7 @@ abstract class SettingsStoreBase with Store { sharedPreferences.getBool(PreferencesKey.silentPaymentsCardDisplay) ?? true; silentPaymentsAlwaysScan = sharedPreferences.getBool(PreferencesKey.silentPaymentsAlwaysScan) ?? false; + mwebAlwaysScan = sharedPreferences.getBool(PreferencesKey.mwebAlwaysScan) ?? false; mwebCardDisplay = sharedPreferences.getBool(PreferencesKey.mwebCardDisplay) ?? true; mwebEnabled = sharedPreferences.getBool(PreferencesKey.mwebEnabled) ?? false; final nodeId = sharedPreferences.getInt(PreferencesKey.currentNodeIdKey); diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart index 64e554b1d..b11213741 100644 --- a/lib/view_model/dashboard/dashboard_view_model.dart +++ b/lib/view_model/dashboard/dashboard_view_model.dart @@ -181,7 +181,8 @@ abstract class DashboardViewModelBase with Store { final _accountTransactions = _wallet.transactionHistory.transactions.values .where((tx) => - wow.wownero!.getTransactionInfoAccountId(tx) == wow.wownero!.getCurrentAccount(wallet).id) + wow.wownero!.getTransactionInfoAccountId(tx) == + wow.wownero!.getCurrentAccount(wallet).id) .toList(); final sortedTransactions = [..._accountTransactions]; @@ -239,6 +240,10 @@ abstract class DashboardViewModelBase with Store { silentPaymentsScanningActive = bitcoin!.getScanningActive(wallet); }); } + + if (hasMweb) { + mwebScanningActive = bitcoin!.getMwebEnabled(wallet); + } } @observable @@ -364,15 +369,15 @@ abstract class DashboardViewModelBase with Store { bool get showMwebCard => hasMweb && settingsStore.mwebCardDisplay; @observable - bool mwebEnabled = false; + bool mwebScanningActive = false; @action void setMwebEnabled(bool active) { - mwebEnabled = active; - - if (hasMweb) { - bitcoin!.setMwebEnabled(wallet, active); + if (!hasMweb) { + return; } + + bitcoin!.setMwebEnabled(wallet, active); } BalanceViewModel balanceViewModel; @@ -552,7 +557,8 @@ abstract class DashboardViewModelBase with Store { } if (wallet.type == WalletType.wownero) { - return wow.wownero!.getTransactionInfoAccountId(tx) == wow.wownero!.getCurrentAccount(wallet).id; + return wow.wownero!.getTransactionInfoAccountId(tx) == + wow.wownero!.getCurrentAccount(wallet).id; } return true; @@ -577,8 +583,8 @@ abstract class DashboardViewModelBase with Store { .getTransactionHistory(wallet) .transactions .values - .where( - (tx) => monero!.getTransactionInfoAccountId(tx) == monero!.getCurrentAccount(wallet).id) + .where((tx) => + monero!.getTransactionInfoAccountId(tx) == monero!.getCurrentAccount(wallet).id) .toList(); transactions.addAll(_accountTransactions.map((transaction) => TransactionListItem( @@ -590,8 +596,9 @@ abstract class DashboardViewModelBase with Store { .getTransactionHistory(wallet) .transactions .values - .where( - (tx) => wow.wownero!.getTransactionInfoAccountId(tx) == wow.wownero!.getCurrentAccount(wallet).id) + .where((tx) => + wow.wownero!.getTransactionInfoAccountId(tx) == + wow.wownero!.getCurrentAccount(wallet).id) .toList(); transactions.addAll(_accountTransactions.map((transaction) => TransactionListItem( diff --git a/lib/view_model/settings/mweb_settings_view_model.dart b/lib/view_model/settings/mweb_settings_view_model.dart new file mode 100644 index 000000000..343947d00 --- /dev/null +++ b/lib/view_model/settings/mweb_settings_view_model.dart @@ -0,0 +1,32 @@ +import 'package:cake_wallet/bitcoin/bitcoin.dart'; +import 'package:cake_wallet/store/settings_store.dart'; +import 'package:cw_core/wallet_base.dart'; +import 'package:mobx/mobx.dart'; + +part 'mweb_settings_view_model.g.dart'; + +class MwebSettingsViewModel = MwebSettingsViewModelBase with _$MwebSettingsViewModel; + +abstract class MwebSettingsViewModelBase with Store { + MwebSettingsViewModelBase(this._settingsStore, this._wallet); + + final SettingsStore _settingsStore; + final WalletBase _wallet; + + @computed + bool get mwebCardDisplay => _settingsStore.mwebCardDisplay; + + @computed + bool get mwebAlwaysScan => _settingsStore.mwebAlwaysScan; + + @action + void setMwebCardDisplay(bool value) { + _settingsStore.mwebCardDisplay = value; + } + + @action + void setMwebAlwaysScan(bool value) { + _settingsStore.mwebAlwaysScan = value; + bitcoin!.setMwebEnabled(_wallet, value); + } +} diff --git a/res/values/strings_ar.arb b/res/values/strings_ar.arb index b2b8f8d45..6114ce670 100644 --- a/res/values/strings_ar.arb +++ b/res/values/strings_ar.arb @@ -350,6 +350,10 @@ "light_theme": "فاتح", "litecoin_enable_mweb_sync": "تمكين MWEB المزامنة", "litecoin_mweb": "Litecoin mweb", + "litecoin_mweb_always_scan": "اضبط MWEB دائمًا على المسح الضوئي", + "litecoin_mweb_display_card": "عرض بطاقة mweb", + "litecoin_mweb_scanning": "MWEB المسح الضوئي", + "litecoin_mweb_settings": "إعدادات Litecoin MWEB", "litecoin_what_is_mweb": "ما هو MWEB؟", "load_more": "تحميل المزيد", "loading_your_wallet": "يتم تحميل محفظتك", diff --git a/res/values/strings_bg.arb b/res/values/strings_bg.arb index b5429dea0..e55fddbb2 100644 --- a/res/values/strings_bg.arb +++ b/res/values/strings_bg.arb @@ -350,6 +350,10 @@ "light_theme": "Светло", "litecoin_enable_mweb_sync": "Активиране на MWEB Sync", "litecoin_mweb": "Litecoin MWeb", + "litecoin_mweb_always_scan": "Задайте MWeb винаги сканиране", + "litecoin_mweb_display_card": "Показване на MWEB карта", + "litecoin_mweb_scanning": "Сканиране на MWEB", + "litecoin_mweb_settings": "Настройки на Litecoin MWeb", "litecoin_what_is_mweb": "Какво е MWEB?", "load_more": "Зареди още", "loading_your_wallet": "Зареждане на портфейл", diff --git a/res/values/strings_cs.arb b/res/values/strings_cs.arb index 7790bce73..f55ce02b5 100644 --- a/res/values/strings_cs.arb +++ b/res/values/strings_cs.arb @@ -350,6 +350,10 @@ "light_theme": "Světlý", "litecoin_enable_mweb_sync": "Povolit synchronizaci MWeb", "litecoin_mweb": "Litecoin mweb", + "litecoin_mweb_always_scan": "Nastavit MWeb vždy skenování", + "litecoin_mweb_display_card": "Zobrazit kartu MWeb", + "litecoin_mweb_scanning": "Skenování mWeb", + "litecoin_mweb_settings": "Nastavení litecoin mWeb", "litecoin_what_is_mweb": "Co je Mweb?", "load_more": "Načíst další", "loading_your_wallet": "Načítám peněženku", diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index ee6367eff..e9441bf72 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -350,6 +350,10 @@ "light_theme": "Hell", "litecoin_enable_mweb_sync": "Aktivieren Sie die MWEB -Synchronisierung", "litecoin_mweb": "Litecoin MWeb", + "litecoin_mweb_always_scan": "Setzen Sie MWeb immer scannen", + "litecoin_mweb_display_card": "MWEB -Karte anzeigen", + "litecoin_mweb_scanning": "MWEB Scanning", + "litecoin_mweb_settings": "Litecoin MWeb -Einstellungen", "litecoin_what_is_mweb": "Was ist MWeb?", "load_more": "Mehr laden", "loading_your_wallet": "Wallet wird geladen", diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index a1cb8f80a..9bb807645 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -350,6 +350,10 @@ "light_theme": "Light", "litecoin_enable_mweb_sync": "Enable MWEB sync", "litecoin_mweb": "Litecoin MWEB", + "litecoin_mweb_always_scan": "Set MWEB always scanning", + "litecoin_mweb_display_card": "Show MWEB card", + "litecoin_mweb_scanning": "MWEB Scanning", + "litecoin_mweb_settings": "MWEB settings", "litecoin_what_is_mweb": "What is MWEB?", "load_more": "Load more", "loading_your_wallet": "Loading your wallet", diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index 2843be33a..f3085677c 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -350,6 +350,10 @@ "light_theme": "Ligera", "litecoin_enable_mweb_sync": "Habilitar MWEB Sync", "litecoin_mweb": "Litecoin mweb", + "litecoin_mweb_always_scan": "Establecer mweb siempre escaneo", + "litecoin_mweb_display_card": "Mostrar tarjeta MWEB", + "litecoin_mweb_scanning": "Escaneo mweb", + "litecoin_mweb_settings": "Configuración de litecoin mweb", "litecoin_what_is_mweb": "¿Qué es mweb?", "load_more": "Carga más", "loading_your_wallet": "Cargando tu billetera", diff --git a/res/values/strings_fr.arb b/res/values/strings_fr.arb index bd0b1b6b0..48c1c9031 100644 --- a/res/values/strings_fr.arb +++ b/res/values/strings_fr.arb @@ -350,6 +350,10 @@ "light_theme": "Clair", "litecoin_enable_mweb_sync": "Activer la synchronisation MWEB", "litecoin_mweb": "Litecoin mweb", + "litecoin_mweb_always_scan": "Définir MWEB Score Scanning", + "litecoin_mweb_display_card": "Afficher la carte MWeb", + "litecoin_mweb_scanning": "Scann mweb", + "litecoin_mweb_settings": "Paramètres litecoin mweb", "litecoin_what_is_mweb": "Qu'est-ce que MWEB?", "load_more": "Charger plus", "loading_your_wallet": "Chargement de votre portefeuille (wallet)", diff --git a/res/values/strings_ha.arb b/res/values/strings_ha.arb index 9ea2404bc..1a228e84d 100644 --- a/res/values/strings_ha.arb +++ b/res/values/strings_ha.arb @@ -350,6 +350,10 @@ "light_theme": "Haske", "litecoin_enable_mweb_sync": "Kunna Mweb Sync", "litecoin_mweb": "Litcoin Mweb", + "litecoin_mweb_always_scan": "Saita Mweb koyaushe", + "litecoin_mweb_display_card": "Nuna katin Mweb", + "litecoin_mweb_scanning": "Mweb scanning", + "litecoin_mweb_settings": "Saitunan Litcoin Mweb", "litecoin_what_is_mweb": "Menene Mweb?", "load_more": "Like more", "loading_your_wallet": "Ana loda walat ɗin ku", diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index d8ae7530c..0cd16ff4b 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -350,6 +350,10 @@ "light_theme": "रोशनी", "litecoin_enable_mweb_sync": "MWEB सिंक सक्षम करें", "litecoin_mweb": "लिटकोइन मेवेब", + "litecoin_mweb_always_scan": "MWEB हमेशा स्कैनिंग सेट करें", + "litecoin_mweb_display_card": "MWEB कार्ड दिखाएं", + "litecoin_mweb_scanning": "MWEB स्कैनिंग", + "litecoin_mweb_settings": "Litecoin MWEB सेटिंग्स", "litecoin_what_is_mweb": "MWEB क्या है?", "load_more": "और लोड करें", "loading_your_wallet": "अपना बटुआ लोड कर रहा है", diff --git a/res/values/strings_hr.arb b/res/values/strings_hr.arb index 15d989657..f6770f6d6 100644 --- a/res/values/strings_hr.arb +++ b/res/values/strings_hr.arb @@ -350,6 +350,10 @@ "light_theme": "Svijetla", "litecoin_enable_mweb_sync": "Omogući MWEB sinkronizaciju", "litecoin_mweb": "Litecoin MWeb", + "litecoin_mweb_always_scan": "Postavite MWeb uvijek skeniranje", + "litecoin_mweb_display_card": "Prikaži MWeb karticu", + "litecoin_mweb_scanning": "MWEB skeniranje", + "litecoin_mweb_settings": "Litecoin MWeb postavke", "litecoin_what_is_mweb": "Što je MWEB?", "load_more": "Učitaj više", "loading_your_wallet": "Novčanik se učitava", diff --git a/res/values/strings_id.arb b/res/values/strings_id.arb index 6dcb89289..fa4e83276 100644 --- a/res/values/strings_id.arb +++ b/res/values/strings_id.arb @@ -350,6 +350,10 @@ "light_theme": "Terang", "litecoin_enable_mweb_sync": "Aktifkan Sinkronisasi MWEB", "litecoin_mweb": "Litecoin mweb", + "litecoin_mweb_always_scan": "Atur mWeb selalu memindai", + "litecoin_mweb_display_card": "Tunjukkan kartu mWeb", + "litecoin_mweb_scanning": "Pemindaian MWEB", + "litecoin_mweb_settings": "Pengaturan Litecoin MWEB", "litecoin_what_is_mweb": "Apa itu MWEB?", "load_more": "Muat lebih banyak", "loading_your_wallet": "Memuat dompet Anda", diff --git a/res/values/strings_it.arb b/res/values/strings_it.arb index 157582562..d79c50bea 100644 --- a/res/values/strings_it.arb +++ b/res/values/strings_it.arb @@ -351,6 +351,10 @@ "light_theme": "Bianco", "litecoin_enable_mweb_sync": "Abilita MWeb Sync", "litecoin_mweb": "Litecoin MWeb", + "litecoin_mweb_always_scan": "Imposta MWeb per scansionare sempre", + "litecoin_mweb_display_card": "Mostra la scheda MWeb", + "litecoin_mweb_scanning": "Scansione MWeb", + "litecoin_mweb_settings": "Impostazioni MWeb Litecoin", "litecoin_what_is_mweb": "Cos'è MWeb?", "load_more": "Carica di più", "loading_your_wallet": "Caricamento portafoglio", diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index fa6d48aa0..2a8f5c764 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -351,6 +351,10 @@ "light_theme": "光", "litecoin_enable_mweb_sync": "MWEB同期を有効にします", "litecoin_mweb": "litecoin mweb", + "litecoin_mweb_always_scan": "MWEBを常にスキャンします", + "litecoin_mweb_display_card": "MWEBカードを表示します", + "litecoin_mweb_scanning": "MWEBスキャン", + "litecoin_mweb_settings": "Litecoin MWEB設定", "litecoin_what_is_mweb": "MWEBとは何ですか?", "load_more": "もっと読み込む", "loading_your_wallet": "ウォレットをロードしています", diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index 7d8d44b0d..ee7f2f9c5 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -350,6 +350,10 @@ "light_theme": "빛", "litecoin_enable_mweb_sync": "mweb 동기화를 활성화합니다", "litecoin_mweb": "Litecoin mweb", + "litecoin_mweb_always_scan": "mweb는 항상 스캔을 설정합니다", + "litecoin_mweb_display_card": "mweb 카드를 보여주십시오", + "litecoin_mweb_scanning": "mweb 스캔", + "litecoin_mweb_settings": "Litecoin mweb 설정", "litecoin_what_is_mweb": "MWEB 란 무엇입니까?", "load_more": "더로드하십시오", "loading_your_wallet": "지갑 넣기", diff --git a/res/values/strings_my.arb b/res/values/strings_my.arb index e2e7b816a..6106b0557 100644 --- a/res/values/strings_my.arb +++ b/res/values/strings_my.arb @@ -350,6 +350,10 @@ "light_theme": "အလင်း", "litecoin_enable_mweb_sync": "mweb စည်းညှိမှုကို enable", "litecoin_mweb": "Litecoin Mweb", + "litecoin_mweb_always_scan": "Mweb အမြဲစကင်ဖတ်စစ်ဆေးပါ", + "litecoin_mweb_display_card": "MweB ကဒ်ကိုပြပါ", + "litecoin_mweb_scanning": "mweb scanning", + "litecoin_mweb_settings": "Litecoin Mweb ချိန်ညှိချက်များ", "litecoin_what_is_mweb": "MweB ဆိုတာဘာလဲ။", "load_more": "ပိုပြီး load", "loading_your_wallet": "သင့်ပိုက်ဆံအိတ်ကို ဖွင့်နေသည်။", diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index 2c5f4a0b0..74c6794f7 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -350,6 +350,10 @@ "light_theme": "Licht", "litecoin_enable_mweb_sync": "MWEB SYNC inschakelen", "litecoin_mweb": "Litecoin mweb", + "litecoin_mweb_always_scan": "Stel mweb altijd op scannen", + "litecoin_mweb_display_card": "Toon MWEB -kaart", + "litecoin_mweb_scanning": "MWEB -scanning", + "litecoin_mweb_settings": "Litecoin mweb -instellingen", "litecoin_what_is_mweb": "Wat is Mweb?", "load_more": "Meer laden", "loading_your_wallet": "Uw portemonnee laden", diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index 4a7698002..9f37d04a0 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -350,6 +350,10 @@ "light_theme": "Jasny", "litecoin_enable_mweb_sync": "Włącz synchronizację MWEB", "litecoin_mweb": "Litecoin MWEB", + "litecoin_mweb_always_scan": "Ustaw MWEB zawsze skanowanie", + "litecoin_mweb_display_card": "Pokaż kartę MWEB", + "litecoin_mweb_scanning": "Skanowanie MWEB", + "litecoin_mweb_settings": "Ustawienia MWEB Litecoin", "litecoin_what_is_mweb": "Co to jest MWEB?", "load_more": "Załaduj więcej", "loading_your_wallet": "Ładowanie portfela", diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index 2d41ea1d6..c3dd95bad 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -350,6 +350,10 @@ "light_theme": "Luz", "litecoin_enable_mweb_sync": "Habilite MWEB Sync", "litecoin_mweb": "Litecoin Mweb", + "litecoin_mweb_always_scan": "Definir mweb sempre digitalizando", + "litecoin_mweb_display_card": "Mostre o cartão MWEB", + "litecoin_mweb_scanning": "MWEB Scanning", + "litecoin_mweb_settings": "Configurações do Litecoin MWEB", "litecoin_what_is_mweb": "O que é MWeb?", "load_more": "Carregue mais", "loading_your_wallet": "Abrindo sua carteira", diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index 968140c18..d3a887b7f 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -350,6 +350,10 @@ "light_theme": "Светлая", "litecoin_enable_mweb_sync": "Включить MWEB Sync", "litecoin_mweb": "Litecoin mweb", + "litecoin_mweb_always_scan": "Установить MWEB всегда сканирование", + "litecoin_mweb_display_card": "Показать карту MWEB", + "litecoin_mweb_scanning": "MWEB сканирование", + "litecoin_mweb_settings": "Litecoin MWEB Settings", "litecoin_what_is_mweb": "Что такое MWEB?", "load_more": "Загрузи больше", "loading_your_wallet": "Загрузка кошелька", diff --git a/res/values/strings_th.arb b/res/values/strings_th.arb index 516c5484e..c615f1a07 100644 --- a/res/values/strings_th.arb +++ b/res/values/strings_th.arb @@ -350,6 +350,10 @@ "light_theme": "สว่าง", "litecoin_enable_mweb_sync": "เปิดใช้งานการซิงค์ MWEB", "litecoin_mweb": "Litecoin mweb", + "litecoin_mweb_always_scan": "ตั้งค่าการสแกน MWEB เสมอ", + "litecoin_mweb_display_card": "แสดงการ์ด mweb", + "litecoin_mweb_scanning": "การสแกน MWEB", + "litecoin_mweb_settings": "การตั้งค่า Litecoin Mweb", "litecoin_what_is_mweb": "MWEB คืออะไร?", "load_more": "โหลดมากขึ้น", "loading_your_wallet": "กำลังโหลดกระเป๋าของคุณ", diff --git a/res/values/strings_tl.arb b/res/values/strings_tl.arb index 9d05d4fd8..c4c6bb2c6 100644 --- a/res/values/strings_tl.arb +++ b/res/values/strings_tl.arb @@ -350,6 +350,10 @@ "light_theme": "Ilaw", "litecoin_enable_mweb_sync": "Paganahin ang MWEB Sync", "litecoin_mweb": "Litecoin Mweb", + "litecoin_mweb_always_scan": "Itakda ang MWeb na laging nag -scan", + "litecoin_mweb_display_card": "Ipakita ang MWEB Card", + "litecoin_mweb_scanning": "Pag -scan ng Mweb", + "litecoin_mweb_settings": "Mga Setting ng Litecoin MWeb", "litecoin_what_is_mweb": "Ano ang MWEB?", "load_more": "Mag -load pa", "loading_your_wallet": "Naglo -load ng iyong pitaka", diff --git a/res/values/strings_tr.arb b/res/values/strings_tr.arb index f87f2f6b3..60b51424d 100644 --- a/res/values/strings_tr.arb +++ b/res/values/strings_tr.arb @@ -350,6 +350,10 @@ "light_theme": "Aydınlık", "litecoin_enable_mweb_sync": "MWEB senkronizasyonunu etkinleştir", "litecoin_mweb": "Litecoin mweb", + "litecoin_mweb_always_scan": "MWEB'i her zaman taramayı ayarlayın", + "litecoin_mweb_display_card": "MWEB kartını göster", + "litecoin_mweb_scanning": "MWEB taraması", + "litecoin_mweb_settings": "Litecoin mweb ayarları", "litecoin_what_is_mweb": "MWEB nedir?", "load_more": "Daha fazla yükle", "loading_your_wallet": "Cüzdanın yükleniyor", diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index dfbc7b83c..7ae1c0da2 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -350,6 +350,10 @@ "light_theme": "Світла", "litecoin_enable_mweb_sync": "Увімкнути MWEB SYNC", "litecoin_mweb": "Litecoin mweb", + "litecoin_mweb_always_scan": "Встановити mweb завжди сканувати", + "litecoin_mweb_display_card": "Показати карту MWeb", + "litecoin_mweb_scanning": "Сканування Mweb", + "litecoin_mweb_settings": "Налаштування Litecoin MWEB", "litecoin_what_is_mweb": "Що таке mweb?", "load_more": "Завантажити ще", "loading_your_wallet": "Завантаження гаманця", diff --git a/res/values/strings_ur.arb b/res/values/strings_ur.arb index ca52cccc9..672f3a980 100644 --- a/res/values/strings_ur.arb +++ b/res/values/strings_ur.arb @@ -350,6 +350,10 @@ "light_theme": "روشنی", "litecoin_enable_mweb_sync": "MWEB مطابقت پذیری کو فعال کریں", "litecoin_mweb": "litcoin mweb", + "litecoin_mweb_always_scan": "MWEB ہمیشہ اسکیننگ سیٹ کریں", + "litecoin_mweb_display_card": "MWEB کارڈ دکھائیں", + "litecoin_mweb_scanning": "MWEB اسکیننگ", + "litecoin_mweb_settings": "litcoin mweb کی ترتیبات", "litecoin_what_is_mweb": "MWEB کیا ہے؟", "load_more": "مزید لوڈ کریں", "loading_your_wallet": "آپ کا بٹوہ لوڈ ہو رہا ہے۔", diff --git a/res/values/strings_yo.arb b/res/values/strings_yo.arb index 95384b1c3..d4fe70afd 100644 --- a/res/values/strings_yo.arb +++ b/res/values/strings_yo.arb @@ -351,6 +351,10 @@ "light_theme": "Funfun bí eérú", "litecoin_enable_mweb_sync": "Mu ṣiṣẹmu MweB", "litecoin_mweb": "Livecoin mweb", + "litecoin_mweb_always_scan": "Ṣeto mweb nigbagbogbo n ṣayẹwo", + "litecoin_mweb_display_card": "Fihan kaadi Mweb", + "litecoin_mweb_scanning": "Mweb scanning", + "litecoin_mweb_settings": "Awọn eto idile Mwein mweb", "litecoin_what_is_mweb": "Kini mweb?", "load_more": "Ẹru diẹ sii", "loading_your_wallet": "A ń ṣí àpamọ́wọ́ yín", diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index c1d559daa..c904d6cd3 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -350,6 +350,10 @@ "light_theme": "艳丽", "litecoin_enable_mweb_sync": "启用MWEB同步", "litecoin_mweb": "Litecoin Mweb", + "litecoin_mweb_always_scan": "设置MWEB总是扫描", + "litecoin_mweb_display_card": "显示MWEB卡", + "litecoin_mweb_scanning": "MWEB扫描", + "litecoin_mweb_settings": "Litecoin MWEB设置", "litecoin_what_is_mweb": "什么是MWEB?", "load_more": "装载更多", "loading_your_wallet": "加载您的钱包",