Allow contacts and wallets from the same tag

This commit is contained in:
OmarHatem 2023-06-01 16:26:16 +03:00
parent 9b67db0132
commit 78adf4a5ce
2 changed files with 11 additions and 5 deletions

View file

@ -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;

View file

@ -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;
}
}