From 78adf4a5ceaca102191c7ce1e402ac556f62c855 Mon Sep 17 00:00:00 2001 From: OmarHatem <omarh.ismail1@gmail.com> Date: Thu, 1 Jun 2023 16:26:16 +0300 Subject: [PATCH] Allow contacts and wallets from the same tag --- lib/store/settings_store.dart | 1 - .../contact_list/contact_list_view_model.dart | 15 +++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/store/settings_store.dart b/lib/store/settings_store.dart index 05b746362..f6a66c220 100644 --- a/lib/store/settings_store.dart +++ b/lib/store/settings_store.dart @@ -609,7 +609,6 @@ abstract class SettingsStoreBase with Store { if (Platform.isAndroid) { final androidInfo = await deviceInfoPlugin.androidInfo; deviceName = '${androidInfo.brand}%20${androidInfo.manufacturer}%20${androidInfo.model}'; - print(deviceName); } else if (Platform.isIOS) { final iosInfo = await deviceInfoPlugin.iosInfo; deviceName = iosInfo.model; diff --git a/lib/view_model/contact_list/contact_list_view_model.dart b/lib/view_model/contact_list/contact_list_view_model.dart index 5b0187fc8..d55254e68 100644 --- a/lib/view_model/contact_list/contact_list_view_model.dart +++ b/lib/view_model/contact_list/contact_list_view_model.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'package:cake_wallet/entities/contact_base.dart'; import 'package:cake_wallet/entities/wallet_contact.dart'; import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_type.dart'; @@ -48,10 +49,16 @@ abstract class ContactListViewModelBase with Store { Future<void> delete(ContactRecord contact) async => contact.original.delete(); @computed - List<ContactRecord> get contactsToShow => - contacts.where((element) => _currency == null || element.type == _currency).toList(); + List<ContactRecord> get contactsToShow => contacts + .where((element) => _isValidForCurrency(element)) + .toList(); @computed - List<WalletContact> get walletContactsToShow => - walletContacts.where((element) => _currency == null || element.type == _currency).toList(); + List<WalletContact> get walletContactsToShow => walletContacts + .where((element) => _isValidForCurrency(element)) + .toList(); + + bool _isValidForCurrency(ContactBase element) { + return _currency == null || element.type == _currency || element.type.title == _currency!.tag; + } }