diff --git a/assets/default_themes/dark.zip b/assets/default_themes/dark.zip index ba8404f9c..1d8899567 100644 Binary files a/assets/default_themes/dark.zip and b/assets/default_themes/dark.zip differ diff --git a/assets/default_themes/light.zip b/assets/default_themes/light.zip index 8cfefa953..093a1b2eb 100644 Binary files a/assets/default_themes/light.zip and b/assets/default_themes/light.zip differ diff --git a/lib/db/hive/db.dart b/lib/db/hive/db.dart index 1efa94cb2..5700f985d 100644 --- a/lib/db/hive/db.dart +++ b/lib/db/hive/db.dart @@ -41,7 +41,6 @@ class DB { String boxNameUsedSerialsCache({required Coin coin}) => "${coin.name}_usedSerialsCache"; - Box? _boxAddressBook; Box? _boxDebugInfo; Box? _boxNodeModels; Box? _boxPrimaryNodes; @@ -100,7 +99,6 @@ class DB { _boxPrefs = await Hive.openBox(boxNamePrefs); } - _boxAddressBook = await Hive.openBox(boxNameAddressBook); _boxDebugInfo = await Hive.openBox(boxNameDebugInfo); if (Hive.isBoxOpen(boxNameNodeModels)) { diff --git a/lib/db/isar/main_db.dart b/lib/db/isar/main_db.dart index 0e9d9efc4..b9841de02 100644 --- a/lib/db/isar/main_db.dart +++ b/lib/db/isar/main_db.dart @@ -3,6 +3,7 @@ import 'package:flutter_native_splash/cli_commands.dart'; import 'package:isar/isar.dart'; import 'package:stackwallet/exceptions/main_db/main_db_exception.dart'; import 'package:stackwallet/models/isar/models/block_explorer.dart'; +import 'package:stackwallet/models/isar/models/contact_entry.dart'; import 'package:stackwallet/models/isar/models/isar_models.dart'; import 'package:stackwallet/models/isar/stack_theme.dart'; import 'package:stackwallet/utilities/amount/amount.dart'; @@ -37,6 +38,7 @@ class MainDB { EthContractSchema, TransactionBlockExplorerSchema, StackThemeSchema, + ContactEntrySchema, ], directory: (await StackFileSystem.applicationIsarDirectory()).path, // inspector: kDebugMode, @@ -47,6 +49,45 @@ class MainDB { return true; } + // contact entries + List getContactEntries(){ + return isar.contactEntrys.where().findAllSync(); + } + + Future deleteContactEntry({required String id}) { + try { + return isar.writeTxn(() async { + await isar.contactEntrys.deleteByCustomId(id); + return true; + }); + } catch (e) { + throw MainDBException("failed deleteContactEntry: $id", e); + } + } + + Future isContactEntryExists({required String id}) async { + return isar.contactEntrys + .where() + .customIdEqualTo(id) + .count() + .then((value) => value > 0); + } + + ContactEntry? getContactEntry({required String id}) { + return isar.contactEntrys.where().customIdEqualTo(id).findFirstSync(); + } + + Future putContactEntry({required ContactEntry contactEntry}) async { + try { + return await isar.writeTxn(() async { + await isar.contactEntrys.put(contactEntry); + return true; + }); + } catch (e) { + throw MainDBException("failed putContactEntry: $contactEntry", e); + } + } + // tx block explorers TransactionBlockExplorer? getTransactionBlockExplorer({required Coin coin}) { return isar.transactionBlockExplorers diff --git a/lib/main.dart b/lib/main.dart index d9d7d4851..60026022f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -162,7 +162,7 @@ void main() async { int dbVersion = DB.instance.get( boxName: DB.boxNameDBInfo, key: "hive_data_version") as int? ?? 0; - if (dbVersion < Constants.currentHiveDbVersion) { + if (dbVersion < Constants.currentDataVersion) { try { await DbVersionMigrator().migrate( dbVersion, @@ -178,9 +178,6 @@ void main() async { } } - //Add Themes directory - TODO - // await StackFileSystem.applicationThemesDirectory(); - monero.onStartup(); wownero.onStartup(); diff --git a/lib/models/contact.dart b/lib/models/contact.dart index 93ff779bb..37961476a 100644 --- a/lib/models/contact.dart +++ b/lib/models/contact.dart @@ -3,6 +3,7 @@ import 'dart:convert'; import 'package:stackwallet/models/contact_address_entry.dart'; import 'package:uuid/uuid.dart'; +@Deprecated("Use lib/models/isar/models/contact_entry.dart instead") class Contact { final String? emojiChar; final String name; diff --git a/lib/models/contact_address_entry.dart b/lib/models/contact_address_entry.dart index ce85228b6..d917b47c0 100644 --- a/lib/models/contact_address_entry.dart +++ b/lib/models/contact_address_entry.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; +@Deprecated("Use lib/models/isar/models/contact_entry.dart instead") class ContactAddressEntry { final Coin coin; final String address; diff --git a/lib/models/contact_address_entry_data.dart b/lib/models/contact_address_entry_data.dart index 7c4641302..b67299a3e 100644 --- a/lib/models/contact_address_entry_data.dart +++ b/lib/models/contact_address_entry_data.dart @@ -1,5 +1,5 @@ import 'package:flutter/cupertino.dart'; -import 'package:stackwallet/models/contact_address_entry.dart'; +import 'package:stackwallet/models/isar/models/contact_entry.dart'; import 'package:stackwallet/utilities/address_utils.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; @@ -57,7 +57,7 @@ class AddressEntryData extends ChangeNotifier { } bool get isValidAddress { - if ( coin == null) { + if (coin == null) { return true; } if (_address == null) { @@ -67,8 +67,11 @@ class AddressEntryData extends ChangeNotifier { } ContactAddressEntry buildAddressEntry() { - return ContactAddressEntry( - coin: coin!, address: address!, label: addressLabel!); + return ContactAddressEntry() + ..coinName = coin!.name + ..address = address! + ..other = null + ..label = addressLabel!; } @override diff --git a/lib/models/isar/models/contact_entry.dart b/lib/models/isar/models/contact_entry.dart new file mode 100644 index 000000000..676b33d23 --- /dev/null +++ b/lib/models/isar/models/contact_entry.dart @@ -0,0 +1,108 @@ +import 'package:isar/isar.dart'; +import 'package:stackwallet/utilities/enums/coin_enum.dart'; + +part 'contact_entry.g.dart'; + +@collection +class ContactEntry { + ContactEntry({ + this.emojiChar, + required this.name, + required this.addresses, + required this.isFavorite, + required this.customId, + }); + + Id id = Isar.autoIncrement; + + late final String? emojiChar; + late final String name; + late final List addresses; + late final bool isFavorite; + + @Index(unique: true, replace: true) + late final String customId; + + ContactEntry copyWith({ + bool shouldCopyEmojiWithNull = false, + String? emojiChar, + String? name, + List? addresses, + bool? isFavorite, + }) { + List _addresses = []; + if (addresses == null) { + for (var e in this.addresses) { + _addresses.add(e.copyWith()); + } + } else { + for (var e in addresses) { + _addresses.add(e.copyWith()); + } + } + String? newEmoji; + if (shouldCopyEmojiWithNull) { + newEmoji = emojiChar; + } else { + newEmoji = emojiChar ?? this.emojiChar; + } + + return ContactEntry( + emojiChar: newEmoji, + name: name ?? this.name, + addresses: _addresses, + isFavorite: isFavorite ?? this.isFavorite, + customId: customId, + ); + } + + Map toMap() { + return { + "emoji": emojiChar, + "name": name, + "addresses": addresses.map((e) => e.toMap()).toList(), + "id": customId, + "isFavorite": isFavorite, + }; + } +} + +@embedded +class ContactAddressEntry { + late final String coinName; + late final String address; + late final String label; + late final String? other; + + @ignore + Coin get coin => Coin.values.byName(coinName); + + ContactAddressEntry(); + + ContactAddressEntry copyWith({ + Coin? coin, + String? address, + String? label, + String? other, + }) { + return ContactAddressEntry() + ..coinName = coin?.name ?? coinName + ..address = address ?? this.address + ..label = label ?? this.label + ..other = other ?? this.other; + } + + Map toMap() { + return { + "label": label, + "address": address, + "coin": coin.name, + "other": other ?? "", + }; + } + + @override + String toString() { + return "AddressBookEntry: ${toMap()}"; + } +} diff --git a/lib/models/isar/models/contact_entry.g.dart b/lib/models/isar/models/contact_entry.g.dart new file mode 100644 index 000000000..dc1eb2b61 --- /dev/null +++ b/lib/models/isar/models/contact_entry.g.dart @@ -0,0 +1,1808 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'contact_entry.dart'; + +// ************************************************************************** +// IsarCollectionGenerator +// ************************************************************************** + +// coverage:ignore-file +// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters + +extension GetContactEntryCollection on Isar { + IsarCollection get contactEntrys => this.collection(); +} + +const ContactEntrySchema = CollectionSchema( + name: r'ContactEntry', + id: -3248212280610531288, + properties: { + r'addresses': PropertySchema( + id: 0, + name: r'addresses', + type: IsarType.objectList, + target: r'ContactAddressEntry', + ), + r'customId': PropertySchema( + id: 1, + name: r'customId', + type: IsarType.string, + ), + r'emojiChar': PropertySchema( + id: 2, + name: r'emojiChar', + type: IsarType.string, + ), + r'isFavorite': PropertySchema( + id: 3, + name: r'isFavorite', + type: IsarType.bool, + ), + r'name': PropertySchema( + id: 4, + name: r'name', + type: IsarType.string, + ) + }, + estimateSize: _contactEntryEstimateSize, + serialize: _contactEntrySerialize, + deserialize: _contactEntryDeserialize, + deserializeProp: _contactEntryDeserializeProp, + idName: r'id', + indexes: { + r'customId': IndexSchema( + id: -7523974382886476007, + name: r'customId', + unique: true, + replace: true, + properties: [ + IndexPropertySchema( + name: r'customId', + type: IndexType.hash, + caseSensitive: true, + ) + ], + ) + }, + links: {}, + embeddedSchemas: {r'ContactAddressEntry': ContactAddressEntrySchema}, + getId: _contactEntryGetId, + getLinks: _contactEntryGetLinks, + attach: _contactEntryAttach, + version: '3.0.5', +); + +int _contactEntryEstimateSize( + ContactEntry object, + List offsets, + Map> allOffsets, +) { + var bytesCount = offsets.last; + bytesCount += 3 + object.addresses.length * 3; + { + final offsets = allOffsets[ContactAddressEntry]!; + for (var i = 0; i < object.addresses.length; i++) { + final value = object.addresses[i]; + bytesCount += + ContactAddressEntrySchema.estimateSize(value, offsets, allOffsets); + } + } + bytesCount += 3 + object.customId.length * 3; + { + final value = object.emojiChar; + if (value != null) { + bytesCount += 3 + value.length * 3; + } + } + bytesCount += 3 + object.name.length * 3; + return bytesCount; +} + +void _contactEntrySerialize( + ContactEntry object, + IsarWriter writer, + List offsets, + Map> allOffsets, +) { + writer.writeObjectList( + offsets[0], + allOffsets, + ContactAddressEntrySchema.serialize, + object.addresses, + ); + writer.writeString(offsets[1], object.customId); + writer.writeString(offsets[2], object.emojiChar); + writer.writeBool(offsets[3], object.isFavorite); + writer.writeString(offsets[4], object.name); +} + +ContactEntry _contactEntryDeserialize( + Id id, + IsarReader reader, + List offsets, + Map> allOffsets, +) { + final object = ContactEntry( + addresses: reader.readObjectList( + offsets[0], + ContactAddressEntrySchema.deserialize, + allOffsets, + ContactAddressEntry(), + ) ?? + [], + customId: reader.readString(offsets[1]), + emojiChar: reader.readStringOrNull(offsets[2]), + isFavorite: reader.readBool(offsets[3]), + name: reader.readString(offsets[4]), + ); + object.id = id; + return object; +} + +P _contactEntryDeserializeProp

( + IsarReader reader, + int propertyId, + int offset, + Map> allOffsets, +) { + switch (propertyId) { + case 0: + return (reader.readObjectList( + offset, + ContactAddressEntrySchema.deserialize, + allOffsets, + ContactAddressEntry(), + ) ?? + []) as P; + case 1: + return (reader.readString(offset)) as P; + case 2: + return (reader.readStringOrNull(offset)) as P; + case 3: + return (reader.readBool(offset)) as P; + case 4: + return (reader.readString(offset)) as P; + default: + throw IsarError('Unknown property with id $propertyId'); + } +} + +Id _contactEntryGetId(ContactEntry object) { + return object.id; +} + +List> _contactEntryGetLinks(ContactEntry object) { + return []; +} + +void _contactEntryAttach( + IsarCollection col, Id id, ContactEntry object) { + object.id = id; +} + +extension ContactEntryByIndex on IsarCollection { + Future getByCustomId(String customId) { + return getByIndex(r'customId', [customId]); + } + + ContactEntry? getByCustomIdSync(String customId) { + return getByIndexSync(r'customId', [customId]); + } + + Future deleteByCustomId(String customId) { + return deleteByIndex(r'customId', [customId]); + } + + bool deleteByCustomIdSync(String customId) { + return deleteByIndexSync(r'customId', [customId]); + } + + Future> getAllByCustomId(List customIdValues) { + final values = customIdValues.map((e) => [e]).toList(); + return getAllByIndex(r'customId', values); + } + + List getAllByCustomIdSync(List customIdValues) { + final values = customIdValues.map((e) => [e]).toList(); + return getAllByIndexSync(r'customId', values); + } + + Future deleteAllByCustomId(List customIdValues) { + final values = customIdValues.map((e) => [e]).toList(); + return deleteAllByIndex(r'customId', values); + } + + int deleteAllByCustomIdSync(List customIdValues) { + final values = customIdValues.map((e) => [e]).toList(); + return deleteAllByIndexSync(r'customId', values); + } + + Future putByCustomId(ContactEntry object) { + return putByIndex(r'customId', object); + } + + Id putByCustomIdSync(ContactEntry object, {bool saveLinks = true}) { + return putByIndexSync(r'customId', object, saveLinks: saveLinks); + } + + Future> putAllByCustomId(List objects) { + return putAllByIndex(r'customId', objects); + } + + List putAllByCustomIdSync(List objects, + {bool saveLinks = true}) { + return putAllByIndexSync(r'customId', objects, saveLinks: saveLinks); + } +} + +extension ContactEntryQueryWhereSort + on QueryBuilder { + QueryBuilder anyId() { + return QueryBuilder.apply(this, (query) { + return query.addWhereClause(const IdWhereClause.any()); + }); + } +} + +extension ContactEntryQueryWhere + on QueryBuilder { + QueryBuilder idEqualTo(Id id) { + return QueryBuilder.apply(this, (query) { + return query.addWhereClause(IdWhereClause.between( + lower: id, + upper: id, + )); + }); + } + + QueryBuilder idNotEqualTo( + Id id) { + return QueryBuilder.apply(this, (query) { + if (query.whereSort == Sort.asc) { + return query + .addWhereClause( + IdWhereClause.lessThan(upper: id, includeUpper: false), + ) + .addWhereClause( + IdWhereClause.greaterThan(lower: id, includeLower: false), + ); + } else { + return query + .addWhereClause( + IdWhereClause.greaterThan(lower: id, includeLower: false), + ) + .addWhereClause( + IdWhereClause.lessThan(upper: id, includeUpper: false), + ); + } + }); + } + + QueryBuilder idGreaterThan( + Id id, + {bool include = false}) { + return QueryBuilder.apply(this, (query) { + return query.addWhereClause( + IdWhereClause.greaterThan(lower: id, includeLower: include), + ); + }); + } + + QueryBuilder idLessThan(Id id, + {bool include = false}) { + return QueryBuilder.apply(this, (query) { + return query.addWhereClause( + IdWhereClause.lessThan(upper: id, includeUpper: include), + ); + }); + } + + QueryBuilder idBetween( + Id lowerId, + Id upperId, { + bool includeLower = true, + bool includeUpper = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addWhereClause(IdWhereClause.between( + lower: lowerId, + includeLower: includeLower, + upper: upperId, + includeUpper: includeUpper, + )); + }); + } + + QueryBuilder customIdEqualTo( + String customId) { + return QueryBuilder.apply(this, (query) { + return query.addWhereClause(IndexWhereClause.equalTo( + indexName: r'customId', + value: [customId], + )); + }); + } + + QueryBuilder + customIdNotEqualTo(String customId) { + return QueryBuilder.apply(this, (query) { + if (query.whereSort == Sort.asc) { + return query + .addWhereClause(IndexWhereClause.between( + indexName: r'customId', + lower: [], + upper: [customId], + includeUpper: false, + )) + .addWhereClause(IndexWhereClause.between( + indexName: r'customId', + lower: [customId], + includeLower: false, + upper: [], + )); + } else { + return query + .addWhereClause(IndexWhereClause.between( + indexName: r'customId', + lower: [customId], + includeLower: false, + upper: [], + )) + .addWhereClause(IndexWhereClause.between( + indexName: r'customId', + lower: [], + upper: [customId], + includeUpper: false, + )); + } + }); + } +} + +extension ContactEntryQueryFilter + on QueryBuilder { + QueryBuilder + addressesLengthEqualTo(int length) { + return QueryBuilder.apply(this, (query) { + return query.listLength( + r'addresses', + length, + true, + length, + true, + ); + }); + } + + QueryBuilder + addressesIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.listLength( + r'addresses', + 0, + true, + 0, + true, + ); + }); + } + + QueryBuilder + addressesIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.listLength( + r'addresses', + 0, + false, + 999999, + true, + ); + }); + } + + QueryBuilder + addressesLengthLessThan( + int length, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.listLength( + r'addresses', + 0, + true, + length, + include, + ); + }); + } + + QueryBuilder + addressesLengthGreaterThan( + int length, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.listLength( + r'addresses', + length, + include, + 999999, + true, + ); + }); + } + + QueryBuilder + addressesLengthBetween( + int lower, + int upper, { + bool includeLower = true, + bool includeUpper = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.listLength( + r'addresses', + lower, + includeLower, + upper, + includeUpper, + ); + }); + } + + QueryBuilder + customIdEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'customId', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + customIdGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'customId', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + customIdLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'customId', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + customIdBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'customId', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + customIdStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'customId', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + customIdEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'customId', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + customIdContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'customId', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + customIdMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'customId', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + customIdIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'customId', + value: '', + )); + }); + } + + QueryBuilder + customIdIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'customId', + value: '', + )); + }); + } + + QueryBuilder + emojiCharIsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'emojiChar', + )); + }); + } + + QueryBuilder + emojiCharIsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'emojiChar', + )); + }); + } + + QueryBuilder + emojiCharEqualTo( + String? value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'emojiChar', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + emojiCharGreaterThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'emojiChar', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + emojiCharLessThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'emojiChar', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + emojiCharBetween( + String? lower, + String? upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'emojiChar', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + emojiCharStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'emojiChar', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + emojiCharEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'emojiChar', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + emojiCharContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'emojiChar', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + emojiCharMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'emojiChar', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + emojiCharIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'emojiChar', + value: '', + )); + }); + } + + QueryBuilder + emojiCharIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'emojiChar', + value: '', + )); + }); + } + + QueryBuilder idEqualTo( + Id value) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'id', + value: value, + )); + }); + } + + QueryBuilder idGreaterThan( + Id value, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'id', + value: value, + )); + }); + } + + QueryBuilder idLessThan( + Id value, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'id', + value: value, + )); + }); + } + + QueryBuilder idBetween( + Id lower, + Id upper, { + bool includeLower = true, + bool includeUpper = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'id', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + )); + }); + } + + QueryBuilder + isFavoriteEqualTo(bool value) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'isFavorite', + value: value, + )); + }); + } + + QueryBuilder nameEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'name', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'name', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder nameLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'name', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder nameBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'name', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'name', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder nameEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'name', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder nameContains( + String value, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'name', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder nameMatches( + String pattern, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'name', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'name', + value: '', + )); + }); + } + + QueryBuilder + nameIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'name', + value: '', + )); + }); + } +} + +extension ContactEntryQueryObject + on QueryBuilder { + QueryBuilder + addressesElement(FilterQuery q) { + return QueryBuilder.apply(this, (query) { + return query.object(q, r'addresses'); + }); + } +} + +extension ContactEntryQueryLinks + on QueryBuilder {} + +extension ContactEntryQuerySortBy + on QueryBuilder { + QueryBuilder sortByCustomId() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'customId', Sort.asc); + }); + } + + QueryBuilder sortByCustomIdDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'customId', Sort.desc); + }); + } + + QueryBuilder sortByEmojiChar() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'emojiChar', Sort.asc); + }); + } + + QueryBuilder sortByEmojiCharDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'emojiChar', Sort.desc); + }); + } + + QueryBuilder sortByIsFavorite() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'isFavorite', Sort.asc); + }); + } + + QueryBuilder + sortByIsFavoriteDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'isFavorite', Sort.desc); + }); + } + + QueryBuilder sortByName() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'name', Sort.asc); + }); + } + + QueryBuilder sortByNameDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'name', Sort.desc); + }); + } +} + +extension ContactEntryQuerySortThenBy + on QueryBuilder { + QueryBuilder thenByCustomId() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'customId', Sort.asc); + }); + } + + QueryBuilder thenByCustomIdDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'customId', Sort.desc); + }); + } + + QueryBuilder thenByEmojiChar() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'emojiChar', Sort.asc); + }); + } + + QueryBuilder thenByEmojiCharDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'emojiChar', Sort.desc); + }); + } + + QueryBuilder thenById() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'id', Sort.asc); + }); + } + + QueryBuilder thenByIdDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'id', Sort.desc); + }); + } + + QueryBuilder thenByIsFavorite() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'isFavorite', Sort.asc); + }); + } + + QueryBuilder + thenByIsFavoriteDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'isFavorite', Sort.desc); + }); + } + + QueryBuilder thenByName() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'name', Sort.asc); + }); + } + + QueryBuilder thenByNameDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'name', Sort.desc); + }); + } +} + +extension ContactEntryQueryWhereDistinct + on QueryBuilder { + QueryBuilder distinctByCustomId( + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addDistinctBy(r'customId', caseSensitive: caseSensitive); + }); + } + + QueryBuilder distinctByEmojiChar( + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addDistinctBy(r'emojiChar', caseSensitive: caseSensitive); + }); + } + + QueryBuilder distinctByIsFavorite() { + return QueryBuilder.apply(this, (query) { + return query.addDistinctBy(r'isFavorite'); + }); + } + + QueryBuilder distinctByName( + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addDistinctBy(r'name', caseSensitive: caseSensitive); + }); + } +} + +extension ContactEntryQueryProperty + on QueryBuilder { + QueryBuilder idProperty() { + return QueryBuilder.apply(this, (query) { + return query.addPropertyName(r'id'); + }); + } + + QueryBuilder, QQueryOperations> + addressesProperty() { + return QueryBuilder.apply(this, (query) { + return query.addPropertyName(r'addresses'); + }); + } + + QueryBuilder customIdProperty() { + return QueryBuilder.apply(this, (query) { + return query.addPropertyName(r'customId'); + }); + } + + QueryBuilder emojiCharProperty() { + return QueryBuilder.apply(this, (query) { + return query.addPropertyName(r'emojiChar'); + }); + } + + QueryBuilder isFavoriteProperty() { + return QueryBuilder.apply(this, (query) { + return query.addPropertyName(r'isFavorite'); + }); + } + + QueryBuilder nameProperty() { + return QueryBuilder.apply(this, (query) { + return query.addPropertyName(r'name'); + }); + } +} + +// ************************************************************************** +// IsarEmbeddedGenerator +// ************************************************************************** + +// coverage:ignore-file +// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters + +const ContactAddressEntrySchema = Schema( + name: r'ContactAddressEntry', + id: 2556413586404997281, + properties: { + r'address': PropertySchema( + id: 0, + name: r'address', + type: IsarType.string, + ), + r'coinName': PropertySchema( + id: 1, + name: r'coinName', + type: IsarType.string, + ), + r'label': PropertySchema( + id: 2, + name: r'label', + type: IsarType.string, + ), + r'other': PropertySchema( + id: 3, + name: r'other', + type: IsarType.string, + ) + }, + estimateSize: _contactAddressEntryEstimateSize, + serialize: _contactAddressEntrySerialize, + deserialize: _contactAddressEntryDeserialize, + deserializeProp: _contactAddressEntryDeserializeProp, +); + +int _contactAddressEntryEstimateSize( + ContactAddressEntry object, + List offsets, + Map> allOffsets, +) { + var bytesCount = offsets.last; + bytesCount += 3 + object.address.length * 3; + bytesCount += 3 + object.coinName.length * 3; + bytesCount += 3 + object.label.length * 3; + { + final value = object.other; + if (value != null) { + bytesCount += 3 + value.length * 3; + } + } + return bytesCount; +} + +void _contactAddressEntrySerialize( + ContactAddressEntry object, + IsarWriter writer, + List offsets, + Map> allOffsets, +) { + writer.writeString(offsets[0], object.address); + writer.writeString(offsets[1], object.coinName); + writer.writeString(offsets[2], object.label); + writer.writeString(offsets[3], object.other); +} + +ContactAddressEntry _contactAddressEntryDeserialize( + Id id, + IsarReader reader, + List offsets, + Map> allOffsets, +) { + final object = ContactAddressEntry(); + object.address = reader.readString(offsets[0]); + object.coinName = reader.readString(offsets[1]); + object.label = reader.readString(offsets[2]); + object.other = reader.readStringOrNull(offsets[3]); + return object; +} + +P _contactAddressEntryDeserializeProp

( + IsarReader reader, + int propertyId, + int offset, + Map> allOffsets, +) { + switch (propertyId) { + case 0: + return (reader.readString(offset)) as P; + case 1: + return (reader.readString(offset)) as P; + case 2: + return (reader.readString(offset)) as P; + case 3: + return (reader.readStringOrNull(offset)) as P; + default: + throw IsarError('Unknown property with id $propertyId'); + } +} + +extension ContactAddressEntryQueryFilter on QueryBuilder { + QueryBuilder + addressEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'address', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + addressGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'address', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + addressLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'address', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + addressBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'address', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + addressStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'address', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + addressEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'address', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + addressContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'address', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + addressMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'address', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + addressIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'address', + value: '', + )); + }); + } + + QueryBuilder + addressIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'address', + value: '', + )); + }); + } + + QueryBuilder + coinNameEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinName', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinNameGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'coinName', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinNameLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'coinName', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinNameBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'coinName', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinNameStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'coinName', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinNameEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'coinName', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinNameContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'coinName', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinNameMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'coinName', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinNameIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinName', + value: '', + )); + }); + } + + QueryBuilder + coinNameIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'coinName', + value: '', + )); + }); + } + + QueryBuilder + labelEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'label', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + labelGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'label', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + labelLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'label', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + labelBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'label', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + labelStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'label', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + labelEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'label', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + labelContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'label', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + labelMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'label', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + labelIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'label', + value: '', + )); + }); + } + + QueryBuilder + labelIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'label', + value: '', + )); + }); + } + + QueryBuilder + otherIsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'other', + )); + }); + } + + QueryBuilder + otherIsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'other', + )); + }); + } + + QueryBuilder + otherEqualTo( + String? value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'other', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + otherGreaterThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'other', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + otherLessThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'other', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + otherBetween( + String? lower, + String? upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'other', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + otherStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'other', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + otherEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'other', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + otherContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'other', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + otherMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'other', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + otherIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'other', + value: '', + )); + }); + } + + QueryBuilder + otherIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'other', + value: '', + )); + }); + } +} + +extension ContactAddressEntryQueryObject on QueryBuilder {} diff --git a/lib/models/isar/stack_theme.dart b/lib/models/isar/stack_theme.dart index d91e61cd3..1e46c841b 100644 --- a/lib/models/isar/stack_theme.dart +++ b/lib/models/isar/stack_theme.dart @@ -794,6 +794,15 @@ class StackTheme { Color? _bottomNavIconIcon; final int bottomNavIconIconInt; + // ==== bottomNavIconIcon highlighted ===================================================== + + @ignore + Color get bottomNavIconIconHighlighted => + _bottomNavIconIconHighlighted ??= Color(bottomNavIconIconHighlightedInt); + @ignore + Color? _bottomNavIconIconHighlighted; + final int bottomNavIconIconHighlightedInt; + // ==== topNavIconPrimary ===================================================== @ignore @@ -1556,6 +1565,7 @@ class StackTheme { required this.snackBarTextInfoInt, required this.bottomNavIconBackInt, required this.bottomNavIconIconInt, + required this.bottomNavIconIconHighlightedInt, required this.topNavIconPrimaryInt, required this.topNavIconGreenInt, required this.topNavIconYellowInt, @@ -1795,6 +1805,8 @@ class StackTheme { parseColor(json["colors"]["bottom_nav_icon_back"] as String), bottomNavIconIconInt: parseColor(json["colors"]["bottom_nav_icon_icon"] as String), + bottomNavIconIconHighlightedInt: parseColor( + json["colors"]["bottom_nav_icon_icon_highlighted"] as String), topNavIconPrimaryInt: parseColor(json["colors"]["top_nav_icon_primary"] as String), topNavIconGreenInt: diff --git a/lib/models/isar/stack_theme.g.dart b/lib/models/isar/stack_theme.g.dart index 33646c12e..64d8c3f6c 100644 --- a/lib/models/isar/stack_theme.g.dart +++ b/lib/models/isar/stack_theme.g.dart @@ -73,738 +73,743 @@ const StackThemeSchema = CollectionSchema( name: r'bottomNavIconBackInt', type: IsarType.long, ), - r'bottomNavIconIconInt': PropertySchema( + r'bottomNavIconIconHighlightedInt': PropertySchema( id: 11, + name: r'bottomNavIconIconHighlightedInt', + type: IsarType.long, + ), + r'bottomNavIconIconInt': PropertySchema( + id: 12, name: r'bottomNavIconIconInt', type: IsarType.long, ), r'bottomNavShadowInt': PropertySchema( - id: 12, + id: 13, name: r'bottomNavShadowInt', type: IsarType.long, ), r'bottomNavTextInt': PropertySchema( - id: 13, + id: 14, name: r'bottomNavTextInt', type: IsarType.long, ), r'brightnessString': PropertySchema( - id: 14, + id: 15, name: r'brightnessString', type: IsarType.string, ), r'buttonBackBorderDisabledInt': PropertySchema( - id: 15, + id: 16, name: r'buttonBackBorderDisabledInt', type: IsarType.long, ), r'buttonBackBorderInt': PropertySchema( - id: 16, + id: 17, name: r'buttonBackBorderInt', type: IsarType.long, ), r'buttonBackBorderSecondaryDisabledInt': PropertySchema( - id: 17, + id: 18, name: r'buttonBackBorderSecondaryDisabledInt', type: IsarType.long, ), r'buttonBackBorderSecondaryInt': PropertySchema( - id: 18, + id: 19, name: r'buttonBackBorderSecondaryInt', type: IsarType.long, ), r'buttonBackPrimaryDisabledInt': PropertySchema( - id: 19, + id: 20, name: r'buttonBackPrimaryDisabledInt', type: IsarType.long, ), r'buttonBackPrimaryInt': PropertySchema( - id: 20, + id: 21, name: r'buttonBackPrimaryInt', type: IsarType.long, ), r'buttonBackSecondaryDisabledInt': PropertySchema( - id: 21, + id: 22, name: r'buttonBackSecondaryDisabledInt', type: IsarType.long, ), r'buttonBackSecondaryInt': PropertySchema( - id: 22, + id: 23, name: r'buttonBackSecondaryInt', type: IsarType.long, ), r'buttonTextBorderInt': PropertySchema( - id: 23, + id: 24, name: r'buttonTextBorderInt', type: IsarType.long, ), r'buttonTextBorderlessDisabledInt': PropertySchema( - id: 24, + id: 25, name: r'buttonTextBorderlessDisabledInt', type: IsarType.long, ), r'buttonTextBorderlessInt': PropertySchema( - id: 25, + id: 26, name: r'buttonTextBorderlessInt', type: IsarType.long, ), r'buttonTextDisabledInt': PropertySchema( - id: 26, + id: 27, name: r'buttonTextDisabledInt', type: IsarType.long, ), r'buttonTextPrimaryDisabledInt': PropertySchema( - id: 27, + id: 28, name: r'buttonTextPrimaryDisabledInt', type: IsarType.long, ), r'buttonTextPrimaryInt': PropertySchema( - id: 28, + id: 29, name: r'buttonTextPrimaryInt', type: IsarType.long, ), r'buttonTextSecondaryDisabledInt': PropertySchema( - id: 29, + id: 30, name: r'buttonTextSecondaryDisabledInt', type: IsarType.long, ), r'buttonTextSecondaryInt': PropertySchema( - id: 30, + id: 31, name: r'buttonTextSecondaryInt', type: IsarType.long, ), r'checkboxBGCheckedInt': PropertySchema( - id: 31, + id: 32, name: r'checkboxBGCheckedInt', type: IsarType.long, ), r'checkboxBGDisabledInt': PropertySchema( - id: 32, + id: 33, name: r'checkboxBGDisabledInt', type: IsarType.long, ), r'checkboxBorderEmptyInt': PropertySchema( - id: 33, + id: 34, name: r'checkboxBorderEmptyInt', type: IsarType.long, ), r'checkboxIconCheckedInt': PropertySchema( - id: 34, + id: 35, name: r'checkboxIconCheckedInt', type: IsarType.long, ), r'checkboxIconDisabledInt': PropertySchema( - id: 35, + id: 36, name: r'checkboxIconDisabledInt', type: IsarType.long, ), r'checkboxTextLabelInt': PropertySchema( - id: 36, + id: 37, name: r'checkboxTextLabelInt', type: IsarType.long, ), r'coinColorsJsonString': PropertySchema( - id: 37, + id: 38, name: r'coinColorsJsonString', type: IsarType.string, ), r'currencyListItemBGInt': PropertySchema( - id: 38, + id: 39, name: r'currencyListItemBGInt', type: IsarType.long, ), r'customTextButtonDisabledTextInt': PropertySchema( - id: 39, + id: 40, name: r'customTextButtonDisabledTextInt', type: IsarType.long, ), r'customTextButtonEnabledTextInt': PropertySchema( - id: 40, + id: 41, name: r'customTextButtonEnabledTextInt', type: IsarType.long, ), r'ethTagBGInt': PropertySchema( - id: 41, + id: 42, name: r'ethTagBGInt', type: IsarType.long, ), r'ethTagTextInt': PropertySchema( - id: 42, + id: 43, name: r'ethTagTextInt', type: IsarType.long, ), r'ethWalletTagBGInt': PropertySchema( - id: 43, + id: 44, name: r'ethWalletTagBGInt', type: IsarType.long, ), r'ethWalletTagTextInt': PropertySchema( - id: 44, + id: 45, name: r'ethWalletTagTextInt', type: IsarType.long, ), r'favoriteStarActiveInt': PropertySchema( - id: 45, + id: 46, name: r'favoriteStarActiveInt', type: IsarType.long, ), r'favoriteStarInactiveInt': PropertySchema( - id: 46, + id: 47, name: r'favoriteStarInactiveInt', type: IsarType.long, ), r'gradientBackgroundString': PropertySchema( - id: 47, + id: 48, name: r'gradientBackgroundString', type: IsarType.string, ), r'highlightInt': PropertySchema( - id: 48, + id: 49, name: r'highlightInt', type: IsarType.long, ), r'homeViewButtonBarBoxShadowString': PropertySchema( - id: 49, + id: 50, name: r'homeViewButtonBarBoxShadowString', type: IsarType.string, ), r'infoItemBGInt': PropertySchema( - id: 50, + id: 51, name: r'infoItemBGInt', type: IsarType.long, ), r'infoItemIconsInt': PropertySchema( - id: 51, + id: 52, name: r'infoItemIconsInt', type: IsarType.long, ), r'infoItemLabelInt': PropertySchema( - id: 52, + id: 53, name: r'infoItemLabelInt', type: IsarType.long, ), r'infoItemTextInt': PropertySchema( - id: 53, + id: 54, name: r'infoItemTextInt', type: IsarType.long, ), r'loadingOverlayTextColorInt': PropertySchema( - id: 54, + id: 55, name: r'loadingOverlayTextColorInt', type: IsarType.long, ), r'myStackContactIconBGInt': PropertySchema( - id: 55, + id: 56, name: r'myStackContactIconBGInt', type: IsarType.long, ), r'name': PropertySchema( - id: 56, + id: 57, name: r'name', type: IsarType.string, ), r'numberBackDefaultInt': PropertySchema( - id: 57, + id: 58, name: r'numberBackDefaultInt', type: IsarType.long, ), r'numberTextDefaultInt': PropertySchema( - id: 58, + id: 59, name: r'numberTextDefaultInt', type: IsarType.long, ), r'numpadBackDefaultInt': PropertySchema( - id: 59, + id: 60, name: r'numpadBackDefaultInt', type: IsarType.long, ), r'numpadTextDefaultInt': PropertySchema( - id: 60, + id: 61, name: r'numpadTextDefaultInt', type: IsarType.long, ), r'overlayInt': PropertySchema( - id: 61, + id: 62, name: r'overlayInt', type: IsarType.long, ), r'popupBGInt': PropertySchema( - id: 62, + id: 63, name: r'popupBGInt', type: IsarType.long, ), r'radioButtonBorderDisabledInt': PropertySchema( - id: 63, + id: 64, name: r'radioButtonBorderDisabledInt', type: IsarType.long, ), r'radioButtonBorderEnabledInt': PropertySchema( - id: 64, + id: 65, name: r'radioButtonBorderEnabledInt', type: IsarType.long, ), r'radioButtonIconBorderDisabledInt': PropertySchema( - id: 65, + id: 66, name: r'radioButtonIconBorderDisabledInt', type: IsarType.long, ), r'radioButtonIconBorderInt': PropertySchema( - id: 66, + id: 67, name: r'radioButtonIconBorderInt', type: IsarType.long, ), r'radioButtonIconCircleInt': PropertySchema( - id: 67, + id: 68, name: r'radioButtonIconCircleInt', type: IsarType.long, ), r'radioButtonIconEnabledInt': PropertySchema( - id: 68, + id: 69, name: r'radioButtonIconEnabledInt', type: IsarType.long, ), r'radioButtonLabelDisabledInt': PropertySchema( - id: 69, + id: 70, name: r'radioButtonLabelDisabledInt', type: IsarType.long, ), r'radioButtonLabelEnabledInt': PropertySchema( - id: 70, + id: 71, name: r'radioButtonLabelEnabledInt', type: IsarType.long, ), r'radioButtonTextDisabledInt': PropertySchema( - id: 71, + id: 72, name: r'radioButtonTextDisabledInt', type: IsarType.long, ), r'radioButtonTextEnabledInt': PropertySchema( - id: 72, + id: 73, name: r'radioButtonTextEnabledInt', type: IsarType.long, ), r'rateTypeToggleColorOffInt': PropertySchema( - id: 73, + id: 74, name: r'rateTypeToggleColorOffInt', type: IsarType.long, ), r'rateTypeToggleColorOnInt': PropertySchema( - id: 74, + id: 75, name: r'rateTypeToggleColorOnInt', type: IsarType.long, ), r'rateTypeToggleDesktopColorOffInt': PropertySchema( - id: 75, + id: 76, name: r'rateTypeToggleDesktopColorOffInt', type: IsarType.long, ), r'rateTypeToggleDesktopColorOnInt': PropertySchema( - id: 76, + id: 77, name: r'rateTypeToggleDesktopColorOnInt', type: IsarType.long, ), r'settingsIconBack2Int': PropertySchema( - id: 77, + id: 78, name: r'settingsIconBack2Int', type: IsarType.long, ), r'settingsIconBackInt': PropertySchema( - id: 78, + id: 79, name: r'settingsIconBackInt', type: IsarType.long, ), r'settingsIconElementInt': PropertySchema( - id: 79, + id: 80, name: r'settingsIconElementInt', type: IsarType.long, ), r'settingsIconIconInt': PropertySchema( - id: 80, + id: 81, name: r'settingsIconIconInt', type: IsarType.long, ), r'settingsItem2ActiveBGInt': PropertySchema( - id: 81, + id: 82, name: r'settingsItem2ActiveBGInt', type: IsarType.long, ), r'settingsItem2ActiveSubInt': PropertySchema( - id: 82, + id: 83, name: r'settingsItem2ActiveSubInt', type: IsarType.long, ), r'settingsItem2ActiveTextInt': PropertySchema( - id: 83, + id: 84, name: r'settingsItem2ActiveTextInt', type: IsarType.long, ), r'shadowInt': PropertySchema( - id: 84, + id: 85, name: r'shadowInt', type: IsarType.long, ), r'snackBarBackErrorInt': PropertySchema( - id: 85, + id: 86, name: r'snackBarBackErrorInt', type: IsarType.long, ), r'snackBarBackInfoInt': PropertySchema( - id: 86, + id: 87, name: r'snackBarBackInfoInt', type: IsarType.long, ), r'snackBarBackSuccessInt': PropertySchema( - id: 87, + id: 88, name: r'snackBarBackSuccessInt', type: IsarType.long, ), r'snackBarTextErrorInt': PropertySchema( - id: 88, + id: 89, name: r'snackBarTextErrorInt', type: IsarType.long, ), r'snackBarTextInfoInt': PropertySchema( - id: 89, + id: 90, name: r'snackBarTextInfoInt', type: IsarType.long, ), r'snackBarTextSuccessInt': PropertySchema( - id: 90, + id: 91, name: r'snackBarTextSuccessInt', type: IsarType.long, ), r'splashInt': PropertySchema( - id: 91, + id: 92, name: r'splashInt', type: IsarType.long, ), r'stackWalletBGInt': PropertySchema( - id: 92, + id: 93, name: r'stackWalletBGInt', type: IsarType.long, ), r'stackWalletBottomInt': PropertySchema( - id: 93, + id: 94, name: r'stackWalletBottomInt', type: IsarType.long, ), r'stackWalletMidInt': PropertySchema( - id: 94, + id: 95, name: r'stackWalletMidInt', type: IsarType.long, ), r'standardBoxShadowString': PropertySchema( - id: 95, + id: 96, name: r'standardBoxShadowString', type: IsarType.string, ), r'stepIndicatorBGCheckInt': PropertySchema( - id: 96, + id: 97, name: r'stepIndicatorBGCheckInt', type: IsarType.long, ), r'stepIndicatorBGInactiveInt': PropertySchema( - id: 97, + id: 98, name: r'stepIndicatorBGInactiveInt', type: IsarType.long, ), r'stepIndicatorBGLinesInactiveInt': PropertySchema( - id: 98, + id: 99, name: r'stepIndicatorBGLinesInactiveInt', type: IsarType.long, ), r'stepIndicatorBGLinesInt': PropertySchema( - id: 99, + id: 100, name: r'stepIndicatorBGLinesInt', type: IsarType.long, ), r'stepIndicatorBGNumberInt': PropertySchema( - id: 100, + id: 101, name: r'stepIndicatorBGNumberInt', type: IsarType.long, ), r'stepIndicatorIconInactiveInt': PropertySchema( - id: 101, + id: 102, name: r'stepIndicatorIconInactiveInt', type: IsarType.long, ), r'stepIndicatorIconNumberInt': PropertySchema( - id: 102, + id: 103, name: r'stepIndicatorIconNumberInt', type: IsarType.long, ), r'stepIndicatorIconTextInt': PropertySchema( - id: 103, + id: 104, name: r'stepIndicatorIconTextInt', type: IsarType.long, ), r'switchBGDisabledInt': PropertySchema( - id: 104, + id: 105, name: r'switchBGDisabledInt', type: IsarType.long, ), r'switchBGOffInt': PropertySchema( - id: 105, + id: 106, name: r'switchBGOffInt', type: IsarType.long, ), r'switchBGOnInt': PropertySchema( - id: 106, + id: 107, name: r'switchBGOnInt', type: IsarType.long, ), r'switchCircleDisabledInt': PropertySchema( - id: 107, + id: 108, name: r'switchCircleDisabledInt', type: IsarType.long, ), r'switchCircleOffInt': PropertySchema( - id: 108, + id: 109, name: r'switchCircleOffInt', type: IsarType.long, ), r'switchCircleOnInt': PropertySchema( - id: 109, + id: 110, name: r'switchCircleOnInt', type: IsarType.long, ), r'textConfirmTotalAmountInt': PropertySchema( - id: 110, + id: 111, name: r'textConfirmTotalAmountInt', type: IsarType.long, ), r'textDark2Int': PropertySchema( - id: 111, + id: 112, name: r'textDark2Int', type: IsarType.long, ), r'textDark3Int': PropertySchema( - id: 112, + id: 113, name: r'textDark3Int', type: IsarType.long, ), r'textDarkInt': PropertySchema( - id: 113, + id: 114, name: r'textDarkInt', type: IsarType.long, ), r'textErrorInt': PropertySchema( - id: 114, + id: 115, name: r'textErrorInt', type: IsarType.long, ), r'textFavoriteCardInt': PropertySchema( - id: 115, + id: 116, name: r'textFavoriteCardInt', type: IsarType.long, ), r'textFieldActiveBGInt': PropertySchema( - id: 116, + id: 117, name: r'textFieldActiveBGInt', type: IsarType.long, ), r'textFieldActiveLabelInt': PropertySchema( - id: 117, + id: 118, name: r'textFieldActiveLabelInt', type: IsarType.long, ), r'textFieldActiveSearchIconLeftInt': PropertySchema( - id: 118, + id: 119, name: r'textFieldActiveSearchIconLeftInt', type: IsarType.long, ), r'textFieldActiveSearchIconRightInt': PropertySchema( - id: 119, + id: 120, name: r'textFieldActiveSearchIconRightInt', type: IsarType.long, ), r'textFieldActiveTextInt': PropertySchema( - id: 120, + id: 121, name: r'textFieldActiveTextInt', type: IsarType.long, ), r'textFieldDefaultBGInt': PropertySchema( - id: 121, + id: 122, name: r'textFieldDefaultBGInt', type: IsarType.long, ), r'textFieldDefaultSearchIconLeftInt': PropertySchema( - id: 122, + id: 123, name: r'textFieldDefaultSearchIconLeftInt', type: IsarType.long, ), r'textFieldDefaultSearchIconRightInt': PropertySchema( - id: 123, + id: 124, name: r'textFieldDefaultSearchIconRightInt', type: IsarType.long, ), r'textFieldDefaultTextInt': PropertySchema( - id: 124, + id: 125, name: r'textFieldDefaultTextInt', type: IsarType.long, ), r'textFieldErrorBGInt': PropertySchema( - id: 125, + id: 126, name: r'textFieldErrorBGInt', type: IsarType.long, ), r'textFieldErrorBorderInt': PropertySchema( - id: 126, + id: 127, name: r'textFieldErrorBorderInt', type: IsarType.long, ), r'textFieldErrorLabelInt': PropertySchema( - id: 127, + id: 128, name: r'textFieldErrorLabelInt', type: IsarType.long, ), r'textFieldErrorSearchIconLeftInt': PropertySchema( - id: 128, + id: 129, name: r'textFieldErrorSearchIconLeftInt', type: IsarType.long, ), r'textFieldErrorSearchIconRightInt': PropertySchema( - id: 129, + id: 130, name: r'textFieldErrorSearchIconRightInt', type: IsarType.long, ), r'textFieldErrorTextInt': PropertySchema( - id: 130, + id: 131, name: r'textFieldErrorTextInt', type: IsarType.long, ), r'textFieldSuccessBGInt': PropertySchema( - id: 131, + id: 132, name: r'textFieldSuccessBGInt', type: IsarType.long, ), r'textFieldSuccessBorderInt': PropertySchema( - id: 132, + id: 133, name: r'textFieldSuccessBorderInt', type: IsarType.long, ), r'textFieldSuccessLabelInt': PropertySchema( - id: 133, + id: 134, name: r'textFieldSuccessLabelInt', type: IsarType.long, ), r'textFieldSuccessSearchIconLeftInt': PropertySchema( - id: 134, + id: 135, name: r'textFieldSuccessSearchIconLeftInt', type: IsarType.long, ), r'textFieldSuccessSearchIconRightInt': PropertySchema( - id: 135, + id: 136, name: r'textFieldSuccessSearchIconRightInt', type: IsarType.long, ), r'textFieldSuccessTextInt': PropertySchema( - id: 136, + id: 137, name: r'textFieldSuccessTextInt', type: IsarType.long, ), r'textRestoreInt': PropertySchema( - id: 137, + id: 138, name: r'textRestoreInt', type: IsarType.long, ), r'textSelectedWordTableItemInt': PropertySchema( - id: 138, + id: 139, name: r'textSelectedWordTableItemInt', type: IsarType.long, ), r'textSubtitle1Int': PropertySchema( - id: 139, + id: 140, name: r'textSubtitle1Int', type: IsarType.long, ), r'textSubtitle2Int': PropertySchema( - id: 140, + id: 141, name: r'textSubtitle2Int', type: IsarType.long, ), r'textSubtitle3Int': PropertySchema( - id: 141, + id: 142, name: r'textSubtitle3Int', type: IsarType.long, ), r'textSubtitle4Int': PropertySchema( - id: 142, + id: 143, name: r'textSubtitle4Int', type: IsarType.long, ), r'textSubtitle5Int': PropertySchema( - id: 143, + id: 144, name: r'textSubtitle5Int', type: IsarType.long, ), r'textSubtitle6Int': PropertySchema( - id: 144, + id: 145, name: r'textSubtitle6Int', type: IsarType.long, ), r'textWhiteInt': PropertySchema( - id: 145, + id: 146, name: r'textWhiteInt', type: IsarType.long, ), r'themeId': PropertySchema( - id: 146, + id: 147, name: r'themeId', type: IsarType.string, ), r'tokenSummaryBGInt': PropertySchema( - id: 147, + id: 148, name: r'tokenSummaryBGInt', type: IsarType.long, ), r'tokenSummaryButtonBGInt': PropertySchema( - id: 148, + id: 149, name: r'tokenSummaryButtonBGInt', type: IsarType.long, ), r'tokenSummaryIconInt': PropertySchema( - id: 149, + id: 150, name: r'tokenSummaryIconInt', type: IsarType.long, ), r'tokenSummaryTextPrimaryInt': PropertySchema( - id: 150, + id: 151, name: r'tokenSummaryTextPrimaryInt', type: IsarType.long, ), r'tokenSummaryTextSecondaryInt': PropertySchema( - id: 151, + id: 152, name: r'tokenSummaryTextSecondaryInt', type: IsarType.long, ), r'topNavIconGreenInt': PropertySchema( - id: 152, + id: 153, name: r'topNavIconGreenInt', type: IsarType.long, ), r'topNavIconPrimaryInt': PropertySchema( - id: 153, + id: 154, name: r'topNavIconPrimaryInt', type: IsarType.long, ), r'topNavIconRedInt': PropertySchema( - id: 154, + id: 155, name: r'topNavIconRedInt', type: IsarType.long, ), r'topNavIconYellowInt': PropertySchema( - id: 155, + id: 156, name: r'topNavIconYellowInt', type: IsarType.long, ), r'warningBackgroundInt': PropertySchema( - id: 156, + id: 157, name: r'warningBackgroundInt', type: IsarType.long, ), r'warningForegroundInt': PropertySchema( - id: 157, + id: 158, name: r'warningForegroundInt', type: IsarType.long, ) @@ -888,153 +893,154 @@ void _stackThemeSerialize( writer.writeLong(offsets[8], object.backgroundInt); writer.writeLong(offsets[9], object.bottomNavBackInt); writer.writeLong(offsets[10], object.bottomNavIconBackInt); - writer.writeLong(offsets[11], object.bottomNavIconIconInt); - writer.writeLong(offsets[12], object.bottomNavShadowInt); - writer.writeLong(offsets[13], object.bottomNavTextInt); - writer.writeString(offsets[14], object.brightnessString); - writer.writeLong(offsets[15], object.buttonBackBorderDisabledInt); - writer.writeLong(offsets[16], object.buttonBackBorderInt); - writer.writeLong(offsets[17], object.buttonBackBorderSecondaryDisabledInt); - writer.writeLong(offsets[18], object.buttonBackBorderSecondaryInt); - writer.writeLong(offsets[19], object.buttonBackPrimaryDisabledInt); - writer.writeLong(offsets[20], object.buttonBackPrimaryInt); - writer.writeLong(offsets[21], object.buttonBackSecondaryDisabledInt); - writer.writeLong(offsets[22], object.buttonBackSecondaryInt); - writer.writeLong(offsets[23], object.buttonTextBorderInt); - writer.writeLong(offsets[24], object.buttonTextBorderlessDisabledInt); - writer.writeLong(offsets[25], object.buttonTextBorderlessInt); - writer.writeLong(offsets[26], object.buttonTextDisabledInt); - writer.writeLong(offsets[27], object.buttonTextPrimaryDisabledInt); - writer.writeLong(offsets[28], object.buttonTextPrimaryInt); - writer.writeLong(offsets[29], object.buttonTextSecondaryDisabledInt); - writer.writeLong(offsets[30], object.buttonTextSecondaryInt); - writer.writeLong(offsets[31], object.checkboxBGCheckedInt); - writer.writeLong(offsets[32], object.checkboxBGDisabledInt); - writer.writeLong(offsets[33], object.checkboxBorderEmptyInt); - writer.writeLong(offsets[34], object.checkboxIconCheckedInt); - writer.writeLong(offsets[35], object.checkboxIconDisabledInt); - writer.writeLong(offsets[36], object.checkboxTextLabelInt); - writer.writeString(offsets[37], object.coinColorsJsonString); - writer.writeLong(offsets[38], object.currencyListItemBGInt); - writer.writeLong(offsets[39], object.customTextButtonDisabledTextInt); - writer.writeLong(offsets[40], object.customTextButtonEnabledTextInt); - writer.writeLong(offsets[41], object.ethTagBGInt); - writer.writeLong(offsets[42], object.ethTagTextInt); - writer.writeLong(offsets[43], object.ethWalletTagBGInt); - writer.writeLong(offsets[44], object.ethWalletTagTextInt); - writer.writeLong(offsets[45], object.favoriteStarActiveInt); - writer.writeLong(offsets[46], object.favoriteStarInactiveInt); - writer.writeString(offsets[47], object.gradientBackgroundString); - writer.writeLong(offsets[48], object.highlightInt); - writer.writeString(offsets[49], object.homeViewButtonBarBoxShadowString); - writer.writeLong(offsets[50], object.infoItemBGInt); - writer.writeLong(offsets[51], object.infoItemIconsInt); - writer.writeLong(offsets[52], object.infoItemLabelInt); - writer.writeLong(offsets[53], object.infoItemTextInt); - writer.writeLong(offsets[54], object.loadingOverlayTextColorInt); - writer.writeLong(offsets[55], object.myStackContactIconBGInt); - writer.writeString(offsets[56], object.name); - writer.writeLong(offsets[57], object.numberBackDefaultInt); - writer.writeLong(offsets[58], object.numberTextDefaultInt); - writer.writeLong(offsets[59], object.numpadBackDefaultInt); - writer.writeLong(offsets[60], object.numpadTextDefaultInt); - writer.writeLong(offsets[61], object.overlayInt); - writer.writeLong(offsets[62], object.popupBGInt); - writer.writeLong(offsets[63], object.radioButtonBorderDisabledInt); - writer.writeLong(offsets[64], object.radioButtonBorderEnabledInt); - writer.writeLong(offsets[65], object.radioButtonIconBorderDisabledInt); - writer.writeLong(offsets[66], object.radioButtonIconBorderInt); - writer.writeLong(offsets[67], object.radioButtonIconCircleInt); - writer.writeLong(offsets[68], object.radioButtonIconEnabledInt); - writer.writeLong(offsets[69], object.radioButtonLabelDisabledInt); - writer.writeLong(offsets[70], object.radioButtonLabelEnabledInt); - writer.writeLong(offsets[71], object.radioButtonTextDisabledInt); - writer.writeLong(offsets[72], object.radioButtonTextEnabledInt); - writer.writeLong(offsets[73], object.rateTypeToggleColorOffInt); - writer.writeLong(offsets[74], object.rateTypeToggleColorOnInt); - writer.writeLong(offsets[75], object.rateTypeToggleDesktopColorOffInt); - writer.writeLong(offsets[76], object.rateTypeToggleDesktopColorOnInt); - writer.writeLong(offsets[77], object.settingsIconBack2Int); - writer.writeLong(offsets[78], object.settingsIconBackInt); - writer.writeLong(offsets[79], object.settingsIconElementInt); - writer.writeLong(offsets[80], object.settingsIconIconInt); - writer.writeLong(offsets[81], object.settingsItem2ActiveBGInt); - writer.writeLong(offsets[82], object.settingsItem2ActiveSubInt); - writer.writeLong(offsets[83], object.settingsItem2ActiveTextInt); - writer.writeLong(offsets[84], object.shadowInt); - writer.writeLong(offsets[85], object.snackBarBackErrorInt); - writer.writeLong(offsets[86], object.snackBarBackInfoInt); - writer.writeLong(offsets[87], object.snackBarBackSuccessInt); - writer.writeLong(offsets[88], object.snackBarTextErrorInt); - writer.writeLong(offsets[89], object.snackBarTextInfoInt); - writer.writeLong(offsets[90], object.snackBarTextSuccessInt); - writer.writeLong(offsets[91], object.splashInt); - writer.writeLong(offsets[92], object.stackWalletBGInt); - writer.writeLong(offsets[93], object.stackWalletBottomInt); - writer.writeLong(offsets[94], object.stackWalletMidInt); - writer.writeString(offsets[95], object.standardBoxShadowString); - writer.writeLong(offsets[96], object.stepIndicatorBGCheckInt); - writer.writeLong(offsets[97], object.stepIndicatorBGInactiveInt); - writer.writeLong(offsets[98], object.stepIndicatorBGLinesInactiveInt); - writer.writeLong(offsets[99], object.stepIndicatorBGLinesInt); - writer.writeLong(offsets[100], object.stepIndicatorBGNumberInt); - writer.writeLong(offsets[101], object.stepIndicatorIconInactiveInt); - writer.writeLong(offsets[102], object.stepIndicatorIconNumberInt); - writer.writeLong(offsets[103], object.stepIndicatorIconTextInt); - writer.writeLong(offsets[104], object.switchBGDisabledInt); - writer.writeLong(offsets[105], object.switchBGOffInt); - writer.writeLong(offsets[106], object.switchBGOnInt); - writer.writeLong(offsets[107], object.switchCircleDisabledInt); - writer.writeLong(offsets[108], object.switchCircleOffInt); - writer.writeLong(offsets[109], object.switchCircleOnInt); - writer.writeLong(offsets[110], object.textConfirmTotalAmountInt); - writer.writeLong(offsets[111], object.textDark2Int); - writer.writeLong(offsets[112], object.textDark3Int); - writer.writeLong(offsets[113], object.textDarkInt); - writer.writeLong(offsets[114], object.textErrorInt); - writer.writeLong(offsets[115], object.textFavoriteCardInt); - writer.writeLong(offsets[116], object.textFieldActiveBGInt); - writer.writeLong(offsets[117], object.textFieldActiveLabelInt); - writer.writeLong(offsets[118], object.textFieldActiveSearchIconLeftInt); - writer.writeLong(offsets[119], object.textFieldActiveSearchIconRightInt); - writer.writeLong(offsets[120], object.textFieldActiveTextInt); - writer.writeLong(offsets[121], object.textFieldDefaultBGInt); - writer.writeLong(offsets[122], object.textFieldDefaultSearchIconLeftInt); - writer.writeLong(offsets[123], object.textFieldDefaultSearchIconRightInt); - writer.writeLong(offsets[124], object.textFieldDefaultTextInt); - writer.writeLong(offsets[125], object.textFieldErrorBGInt); - writer.writeLong(offsets[126], object.textFieldErrorBorderInt); - writer.writeLong(offsets[127], object.textFieldErrorLabelInt); - writer.writeLong(offsets[128], object.textFieldErrorSearchIconLeftInt); - writer.writeLong(offsets[129], object.textFieldErrorSearchIconRightInt); - writer.writeLong(offsets[130], object.textFieldErrorTextInt); - writer.writeLong(offsets[131], object.textFieldSuccessBGInt); - writer.writeLong(offsets[132], object.textFieldSuccessBorderInt); - writer.writeLong(offsets[133], object.textFieldSuccessLabelInt); - writer.writeLong(offsets[134], object.textFieldSuccessSearchIconLeftInt); - writer.writeLong(offsets[135], object.textFieldSuccessSearchIconRightInt); - writer.writeLong(offsets[136], object.textFieldSuccessTextInt); - writer.writeLong(offsets[137], object.textRestoreInt); - writer.writeLong(offsets[138], object.textSelectedWordTableItemInt); - writer.writeLong(offsets[139], object.textSubtitle1Int); - writer.writeLong(offsets[140], object.textSubtitle2Int); - writer.writeLong(offsets[141], object.textSubtitle3Int); - writer.writeLong(offsets[142], object.textSubtitle4Int); - writer.writeLong(offsets[143], object.textSubtitle5Int); - writer.writeLong(offsets[144], object.textSubtitle6Int); - writer.writeLong(offsets[145], object.textWhiteInt); - writer.writeString(offsets[146], object.themeId); - writer.writeLong(offsets[147], object.tokenSummaryBGInt); - writer.writeLong(offsets[148], object.tokenSummaryButtonBGInt); - writer.writeLong(offsets[149], object.tokenSummaryIconInt); - writer.writeLong(offsets[150], object.tokenSummaryTextPrimaryInt); - writer.writeLong(offsets[151], object.tokenSummaryTextSecondaryInt); - writer.writeLong(offsets[152], object.topNavIconGreenInt); - writer.writeLong(offsets[153], object.topNavIconPrimaryInt); - writer.writeLong(offsets[154], object.topNavIconRedInt); - writer.writeLong(offsets[155], object.topNavIconYellowInt); - writer.writeLong(offsets[156], object.warningBackgroundInt); - writer.writeLong(offsets[157], object.warningForegroundInt); + writer.writeLong(offsets[11], object.bottomNavIconIconHighlightedInt); + writer.writeLong(offsets[12], object.bottomNavIconIconInt); + writer.writeLong(offsets[13], object.bottomNavShadowInt); + writer.writeLong(offsets[14], object.bottomNavTextInt); + writer.writeString(offsets[15], object.brightnessString); + writer.writeLong(offsets[16], object.buttonBackBorderDisabledInt); + writer.writeLong(offsets[17], object.buttonBackBorderInt); + writer.writeLong(offsets[18], object.buttonBackBorderSecondaryDisabledInt); + writer.writeLong(offsets[19], object.buttonBackBorderSecondaryInt); + writer.writeLong(offsets[20], object.buttonBackPrimaryDisabledInt); + writer.writeLong(offsets[21], object.buttonBackPrimaryInt); + writer.writeLong(offsets[22], object.buttonBackSecondaryDisabledInt); + writer.writeLong(offsets[23], object.buttonBackSecondaryInt); + writer.writeLong(offsets[24], object.buttonTextBorderInt); + writer.writeLong(offsets[25], object.buttonTextBorderlessDisabledInt); + writer.writeLong(offsets[26], object.buttonTextBorderlessInt); + writer.writeLong(offsets[27], object.buttonTextDisabledInt); + writer.writeLong(offsets[28], object.buttonTextPrimaryDisabledInt); + writer.writeLong(offsets[29], object.buttonTextPrimaryInt); + writer.writeLong(offsets[30], object.buttonTextSecondaryDisabledInt); + writer.writeLong(offsets[31], object.buttonTextSecondaryInt); + writer.writeLong(offsets[32], object.checkboxBGCheckedInt); + writer.writeLong(offsets[33], object.checkboxBGDisabledInt); + writer.writeLong(offsets[34], object.checkboxBorderEmptyInt); + writer.writeLong(offsets[35], object.checkboxIconCheckedInt); + writer.writeLong(offsets[36], object.checkboxIconDisabledInt); + writer.writeLong(offsets[37], object.checkboxTextLabelInt); + writer.writeString(offsets[38], object.coinColorsJsonString); + writer.writeLong(offsets[39], object.currencyListItemBGInt); + writer.writeLong(offsets[40], object.customTextButtonDisabledTextInt); + writer.writeLong(offsets[41], object.customTextButtonEnabledTextInt); + writer.writeLong(offsets[42], object.ethTagBGInt); + writer.writeLong(offsets[43], object.ethTagTextInt); + writer.writeLong(offsets[44], object.ethWalletTagBGInt); + writer.writeLong(offsets[45], object.ethWalletTagTextInt); + writer.writeLong(offsets[46], object.favoriteStarActiveInt); + writer.writeLong(offsets[47], object.favoriteStarInactiveInt); + writer.writeString(offsets[48], object.gradientBackgroundString); + writer.writeLong(offsets[49], object.highlightInt); + writer.writeString(offsets[50], object.homeViewButtonBarBoxShadowString); + writer.writeLong(offsets[51], object.infoItemBGInt); + writer.writeLong(offsets[52], object.infoItemIconsInt); + writer.writeLong(offsets[53], object.infoItemLabelInt); + writer.writeLong(offsets[54], object.infoItemTextInt); + writer.writeLong(offsets[55], object.loadingOverlayTextColorInt); + writer.writeLong(offsets[56], object.myStackContactIconBGInt); + writer.writeString(offsets[57], object.name); + writer.writeLong(offsets[58], object.numberBackDefaultInt); + writer.writeLong(offsets[59], object.numberTextDefaultInt); + writer.writeLong(offsets[60], object.numpadBackDefaultInt); + writer.writeLong(offsets[61], object.numpadTextDefaultInt); + writer.writeLong(offsets[62], object.overlayInt); + writer.writeLong(offsets[63], object.popupBGInt); + writer.writeLong(offsets[64], object.radioButtonBorderDisabledInt); + writer.writeLong(offsets[65], object.radioButtonBorderEnabledInt); + writer.writeLong(offsets[66], object.radioButtonIconBorderDisabledInt); + writer.writeLong(offsets[67], object.radioButtonIconBorderInt); + writer.writeLong(offsets[68], object.radioButtonIconCircleInt); + writer.writeLong(offsets[69], object.radioButtonIconEnabledInt); + writer.writeLong(offsets[70], object.radioButtonLabelDisabledInt); + writer.writeLong(offsets[71], object.radioButtonLabelEnabledInt); + writer.writeLong(offsets[72], object.radioButtonTextDisabledInt); + writer.writeLong(offsets[73], object.radioButtonTextEnabledInt); + writer.writeLong(offsets[74], object.rateTypeToggleColorOffInt); + writer.writeLong(offsets[75], object.rateTypeToggleColorOnInt); + writer.writeLong(offsets[76], object.rateTypeToggleDesktopColorOffInt); + writer.writeLong(offsets[77], object.rateTypeToggleDesktopColorOnInt); + writer.writeLong(offsets[78], object.settingsIconBack2Int); + writer.writeLong(offsets[79], object.settingsIconBackInt); + writer.writeLong(offsets[80], object.settingsIconElementInt); + writer.writeLong(offsets[81], object.settingsIconIconInt); + writer.writeLong(offsets[82], object.settingsItem2ActiveBGInt); + writer.writeLong(offsets[83], object.settingsItem2ActiveSubInt); + writer.writeLong(offsets[84], object.settingsItem2ActiveTextInt); + writer.writeLong(offsets[85], object.shadowInt); + writer.writeLong(offsets[86], object.snackBarBackErrorInt); + writer.writeLong(offsets[87], object.snackBarBackInfoInt); + writer.writeLong(offsets[88], object.snackBarBackSuccessInt); + writer.writeLong(offsets[89], object.snackBarTextErrorInt); + writer.writeLong(offsets[90], object.snackBarTextInfoInt); + writer.writeLong(offsets[91], object.snackBarTextSuccessInt); + writer.writeLong(offsets[92], object.splashInt); + writer.writeLong(offsets[93], object.stackWalletBGInt); + writer.writeLong(offsets[94], object.stackWalletBottomInt); + writer.writeLong(offsets[95], object.stackWalletMidInt); + writer.writeString(offsets[96], object.standardBoxShadowString); + writer.writeLong(offsets[97], object.stepIndicatorBGCheckInt); + writer.writeLong(offsets[98], object.stepIndicatorBGInactiveInt); + writer.writeLong(offsets[99], object.stepIndicatorBGLinesInactiveInt); + writer.writeLong(offsets[100], object.stepIndicatorBGLinesInt); + writer.writeLong(offsets[101], object.stepIndicatorBGNumberInt); + writer.writeLong(offsets[102], object.stepIndicatorIconInactiveInt); + writer.writeLong(offsets[103], object.stepIndicatorIconNumberInt); + writer.writeLong(offsets[104], object.stepIndicatorIconTextInt); + writer.writeLong(offsets[105], object.switchBGDisabledInt); + writer.writeLong(offsets[106], object.switchBGOffInt); + writer.writeLong(offsets[107], object.switchBGOnInt); + writer.writeLong(offsets[108], object.switchCircleDisabledInt); + writer.writeLong(offsets[109], object.switchCircleOffInt); + writer.writeLong(offsets[110], object.switchCircleOnInt); + writer.writeLong(offsets[111], object.textConfirmTotalAmountInt); + writer.writeLong(offsets[112], object.textDark2Int); + writer.writeLong(offsets[113], object.textDark3Int); + writer.writeLong(offsets[114], object.textDarkInt); + writer.writeLong(offsets[115], object.textErrorInt); + writer.writeLong(offsets[116], object.textFavoriteCardInt); + writer.writeLong(offsets[117], object.textFieldActiveBGInt); + writer.writeLong(offsets[118], object.textFieldActiveLabelInt); + writer.writeLong(offsets[119], object.textFieldActiveSearchIconLeftInt); + writer.writeLong(offsets[120], object.textFieldActiveSearchIconRightInt); + writer.writeLong(offsets[121], object.textFieldActiveTextInt); + writer.writeLong(offsets[122], object.textFieldDefaultBGInt); + writer.writeLong(offsets[123], object.textFieldDefaultSearchIconLeftInt); + writer.writeLong(offsets[124], object.textFieldDefaultSearchIconRightInt); + writer.writeLong(offsets[125], object.textFieldDefaultTextInt); + writer.writeLong(offsets[126], object.textFieldErrorBGInt); + writer.writeLong(offsets[127], object.textFieldErrorBorderInt); + writer.writeLong(offsets[128], object.textFieldErrorLabelInt); + writer.writeLong(offsets[129], object.textFieldErrorSearchIconLeftInt); + writer.writeLong(offsets[130], object.textFieldErrorSearchIconRightInt); + writer.writeLong(offsets[131], object.textFieldErrorTextInt); + writer.writeLong(offsets[132], object.textFieldSuccessBGInt); + writer.writeLong(offsets[133], object.textFieldSuccessBorderInt); + writer.writeLong(offsets[134], object.textFieldSuccessLabelInt); + writer.writeLong(offsets[135], object.textFieldSuccessSearchIconLeftInt); + writer.writeLong(offsets[136], object.textFieldSuccessSearchIconRightInt); + writer.writeLong(offsets[137], object.textFieldSuccessTextInt); + writer.writeLong(offsets[138], object.textRestoreInt); + writer.writeLong(offsets[139], object.textSelectedWordTableItemInt); + writer.writeLong(offsets[140], object.textSubtitle1Int); + writer.writeLong(offsets[141], object.textSubtitle2Int); + writer.writeLong(offsets[142], object.textSubtitle3Int); + writer.writeLong(offsets[143], object.textSubtitle4Int); + writer.writeLong(offsets[144], object.textSubtitle5Int); + writer.writeLong(offsets[145], object.textSubtitle6Int); + writer.writeLong(offsets[146], object.textWhiteInt); + writer.writeString(offsets[147], object.themeId); + writer.writeLong(offsets[148], object.tokenSummaryBGInt); + writer.writeLong(offsets[149], object.tokenSummaryButtonBGInt); + writer.writeLong(offsets[150], object.tokenSummaryIconInt); + writer.writeLong(offsets[151], object.tokenSummaryTextPrimaryInt); + writer.writeLong(offsets[152], object.tokenSummaryTextSecondaryInt); + writer.writeLong(offsets[153], object.topNavIconGreenInt); + writer.writeLong(offsets[154], object.topNavIconPrimaryInt); + writer.writeLong(offsets[155], object.topNavIconRedInt); + writer.writeLong(offsets[156], object.topNavIconYellowInt); + writer.writeLong(offsets[157], object.warningBackgroundInt); + writer.writeLong(offsets[158], object.warningForegroundInt); } StackTheme _stackThemeDeserialize( @@ -1060,153 +1066,154 @@ StackTheme _stackThemeDeserialize( backgroundInt: reader.readLong(offsets[8]), bottomNavBackInt: reader.readLong(offsets[9]), bottomNavIconBackInt: reader.readLong(offsets[10]), - bottomNavIconIconInt: reader.readLong(offsets[11]), - bottomNavShadowInt: reader.readLong(offsets[12]), - bottomNavTextInt: reader.readLong(offsets[13]), - brightnessString: reader.readString(offsets[14]), - buttonBackBorderDisabledInt: reader.readLong(offsets[15]), - buttonBackBorderInt: reader.readLong(offsets[16]), - buttonBackBorderSecondaryDisabledInt: reader.readLong(offsets[17]), - buttonBackBorderSecondaryInt: reader.readLong(offsets[18]), - buttonBackPrimaryDisabledInt: reader.readLong(offsets[19]), - buttonBackPrimaryInt: reader.readLong(offsets[20]), - buttonBackSecondaryDisabledInt: reader.readLong(offsets[21]), - buttonBackSecondaryInt: reader.readLong(offsets[22]), - buttonTextBorderInt: reader.readLong(offsets[23]), - buttonTextBorderlessDisabledInt: reader.readLong(offsets[24]), - buttonTextBorderlessInt: reader.readLong(offsets[25]), - buttonTextDisabledInt: reader.readLong(offsets[26]), - buttonTextPrimaryDisabledInt: reader.readLong(offsets[27]), - buttonTextPrimaryInt: reader.readLong(offsets[28]), - buttonTextSecondaryDisabledInt: reader.readLong(offsets[29]), - buttonTextSecondaryInt: reader.readLong(offsets[30]), - checkboxBGCheckedInt: reader.readLong(offsets[31]), - checkboxBGDisabledInt: reader.readLong(offsets[32]), - checkboxBorderEmptyInt: reader.readLong(offsets[33]), - checkboxIconCheckedInt: reader.readLong(offsets[34]), - checkboxIconDisabledInt: reader.readLong(offsets[35]), - checkboxTextLabelInt: reader.readLong(offsets[36]), - coinColorsJsonString: reader.readString(offsets[37]), - currencyListItemBGInt: reader.readLong(offsets[38]), - customTextButtonDisabledTextInt: reader.readLong(offsets[39]), - customTextButtonEnabledTextInt: reader.readLong(offsets[40]), - ethTagBGInt: reader.readLong(offsets[41]), - ethTagTextInt: reader.readLong(offsets[42]), - ethWalletTagBGInt: reader.readLong(offsets[43]), - ethWalletTagTextInt: reader.readLong(offsets[44]), - favoriteStarActiveInt: reader.readLong(offsets[45]), - favoriteStarInactiveInt: reader.readLong(offsets[46]), - gradientBackgroundString: reader.readStringOrNull(offsets[47]), - highlightInt: reader.readLong(offsets[48]), - homeViewButtonBarBoxShadowString: reader.readStringOrNull(offsets[49]), - infoItemBGInt: reader.readLong(offsets[50]), - infoItemIconsInt: reader.readLong(offsets[51]), - infoItemLabelInt: reader.readLong(offsets[52]), - infoItemTextInt: reader.readLong(offsets[53]), - loadingOverlayTextColorInt: reader.readLong(offsets[54]), - myStackContactIconBGInt: reader.readLong(offsets[55]), - name: reader.readString(offsets[56]), - numberBackDefaultInt: reader.readLong(offsets[57]), - numberTextDefaultInt: reader.readLong(offsets[58]), - numpadBackDefaultInt: reader.readLong(offsets[59]), - numpadTextDefaultInt: reader.readLong(offsets[60]), - overlayInt: reader.readLong(offsets[61]), - popupBGInt: reader.readLong(offsets[62]), - radioButtonBorderDisabledInt: reader.readLong(offsets[63]), - radioButtonBorderEnabledInt: reader.readLong(offsets[64]), - radioButtonIconBorderDisabledInt: reader.readLong(offsets[65]), - radioButtonIconBorderInt: reader.readLong(offsets[66]), - radioButtonIconCircleInt: reader.readLong(offsets[67]), - radioButtonIconEnabledInt: reader.readLong(offsets[68]), - radioButtonLabelDisabledInt: reader.readLong(offsets[69]), - radioButtonLabelEnabledInt: reader.readLong(offsets[70]), - radioButtonTextDisabledInt: reader.readLong(offsets[71]), - radioButtonTextEnabledInt: reader.readLong(offsets[72]), - rateTypeToggleColorOffInt: reader.readLong(offsets[73]), - rateTypeToggleColorOnInt: reader.readLong(offsets[74]), - rateTypeToggleDesktopColorOffInt: reader.readLong(offsets[75]), - rateTypeToggleDesktopColorOnInt: reader.readLong(offsets[76]), - settingsIconBack2Int: reader.readLong(offsets[77]), - settingsIconBackInt: reader.readLong(offsets[78]), - settingsIconElementInt: reader.readLong(offsets[79]), - settingsIconIconInt: reader.readLong(offsets[80]), - settingsItem2ActiveBGInt: reader.readLong(offsets[81]), - settingsItem2ActiveSubInt: reader.readLong(offsets[82]), - settingsItem2ActiveTextInt: reader.readLong(offsets[83]), - shadowInt: reader.readLong(offsets[84]), - snackBarBackErrorInt: reader.readLong(offsets[85]), - snackBarBackInfoInt: reader.readLong(offsets[86]), - snackBarBackSuccessInt: reader.readLong(offsets[87]), - snackBarTextErrorInt: reader.readLong(offsets[88]), - snackBarTextInfoInt: reader.readLong(offsets[89]), - snackBarTextSuccessInt: reader.readLong(offsets[90]), - splashInt: reader.readLong(offsets[91]), - stackWalletBGInt: reader.readLong(offsets[92]), - stackWalletBottomInt: reader.readLong(offsets[93]), - stackWalletMidInt: reader.readLong(offsets[94]), - standardBoxShadowString: reader.readString(offsets[95]), - stepIndicatorBGCheckInt: reader.readLong(offsets[96]), - stepIndicatorBGInactiveInt: reader.readLong(offsets[97]), - stepIndicatorBGLinesInactiveInt: reader.readLong(offsets[98]), - stepIndicatorBGLinesInt: reader.readLong(offsets[99]), - stepIndicatorBGNumberInt: reader.readLong(offsets[100]), - stepIndicatorIconInactiveInt: reader.readLong(offsets[101]), - stepIndicatorIconNumberInt: reader.readLong(offsets[102]), - stepIndicatorIconTextInt: reader.readLong(offsets[103]), - switchBGDisabledInt: reader.readLong(offsets[104]), - switchBGOffInt: reader.readLong(offsets[105]), - switchBGOnInt: reader.readLong(offsets[106]), - switchCircleDisabledInt: reader.readLong(offsets[107]), - switchCircleOffInt: reader.readLong(offsets[108]), - switchCircleOnInt: reader.readLong(offsets[109]), - textConfirmTotalAmountInt: reader.readLong(offsets[110]), - textDark2Int: reader.readLong(offsets[111]), - textDark3Int: reader.readLong(offsets[112]), - textDarkInt: reader.readLong(offsets[113]), - textErrorInt: reader.readLong(offsets[114]), - textFavoriteCardInt: reader.readLong(offsets[115]), - textFieldActiveBGInt: reader.readLong(offsets[116]), - textFieldActiveLabelInt: reader.readLong(offsets[117]), - textFieldActiveSearchIconLeftInt: reader.readLong(offsets[118]), - textFieldActiveSearchIconRightInt: reader.readLong(offsets[119]), - textFieldActiveTextInt: reader.readLong(offsets[120]), - textFieldDefaultBGInt: reader.readLong(offsets[121]), - textFieldDefaultSearchIconLeftInt: reader.readLong(offsets[122]), - textFieldDefaultSearchIconRightInt: reader.readLong(offsets[123]), - textFieldDefaultTextInt: reader.readLong(offsets[124]), - textFieldErrorBGInt: reader.readLong(offsets[125]), - textFieldErrorBorderInt: reader.readLong(offsets[126]), - textFieldErrorLabelInt: reader.readLong(offsets[127]), - textFieldErrorSearchIconLeftInt: reader.readLong(offsets[128]), - textFieldErrorSearchIconRightInt: reader.readLong(offsets[129]), - textFieldErrorTextInt: reader.readLong(offsets[130]), - textFieldSuccessBGInt: reader.readLong(offsets[131]), - textFieldSuccessBorderInt: reader.readLong(offsets[132]), - textFieldSuccessLabelInt: reader.readLong(offsets[133]), - textFieldSuccessSearchIconLeftInt: reader.readLong(offsets[134]), - textFieldSuccessSearchIconRightInt: reader.readLong(offsets[135]), - textFieldSuccessTextInt: reader.readLong(offsets[136]), - textRestoreInt: reader.readLong(offsets[137]), - textSelectedWordTableItemInt: reader.readLong(offsets[138]), - textSubtitle1Int: reader.readLong(offsets[139]), - textSubtitle2Int: reader.readLong(offsets[140]), - textSubtitle3Int: reader.readLong(offsets[141]), - textSubtitle4Int: reader.readLong(offsets[142]), - textSubtitle5Int: reader.readLong(offsets[143]), - textSubtitle6Int: reader.readLong(offsets[144]), - textWhiteInt: reader.readLong(offsets[145]), - themeId: reader.readString(offsets[146]), - tokenSummaryBGInt: reader.readLong(offsets[147]), - tokenSummaryButtonBGInt: reader.readLong(offsets[148]), - tokenSummaryIconInt: reader.readLong(offsets[149]), - tokenSummaryTextPrimaryInt: reader.readLong(offsets[150]), - tokenSummaryTextSecondaryInt: reader.readLong(offsets[151]), - topNavIconGreenInt: reader.readLong(offsets[152]), - topNavIconPrimaryInt: reader.readLong(offsets[153]), - topNavIconRedInt: reader.readLong(offsets[154]), - topNavIconYellowInt: reader.readLong(offsets[155]), - warningBackgroundInt: reader.readLong(offsets[156]), - warningForegroundInt: reader.readLong(offsets[157]), + bottomNavIconIconHighlightedInt: reader.readLong(offsets[11]), + bottomNavIconIconInt: reader.readLong(offsets[12]), + bottomNavShadowInt: reader.readLong(offsets[13]), + bottomNavTextInt: reader.readLong(offsets[14]), + brightnessString: reader.readString(offsets[15]), + buttonBackBorderDisabledInt: reader.readLong(offsets[16]), + buttonBackBorderInt: reader.readLong(offsets[17]), + buttonBackBorderSecondaryDisabledInt: reader.readLong(offsets[18]), + buttonBackBorderSecondaryInt: reader.readLong(offsets[19]), + buttonBackPrimaryDisabledInt: reader.readLong(offsets[20]), + buttonBackPrimaryInt: reader.readLong(offsets[21]), + buttonBackSecondaryDisabledInt: reader.readLong(offsets[22]), + buttonBackSecondaryInt: reader.readLong(offsets[23]), + buttonTextBorderInt: reader.readLong(offsets[24]), + buttonTextBorderlessDisabledInt: reader.readLong(offsets[25]), + buttonTextBorderlessInt: reader.readLong(offsets[26]), + buttonTextDisabledInt: reader.readLong(offsets[27]), + buttonTextPrimaryDisabledInt: reader.readLong(offsets[28]), + buttonTextPrimaryInt: reader.readLong(offsets[29]), + buttonTextSecondaryDisabledInt: reader.readLong(offsets[30]), + buttonTextSecondaryInt: reader.readLong(offsets[31]), + checkboxBGCheckedInt: reader.readLong(offsets[32]), + checkboxBGDisabledInt: reader.readLong(offsets[33]), + checkboxBorderEmptyInt: reader.readLong(offsets[34]), + checkboxIconCheckedInt: reader.readLong(offsets[35]), + checkboxIconDisabledInt: reader.readLong(offsets[36]), + checkboxTextLabelInt: reader.readLong(offsets[37]), + coinColorsJsonString: reader.readString(offsets[38]), + currencyListItemBGInt: reader.readLong(offsets[39]), + customTextButtonDisabledTextInt: reader.readLong(offsets[40]), + customTextButtonEnabledTextInt: reader.readLong(offsets[41]), + ethTagBGInt: reader.readLong(offsets[42]), + ethTagTextInt: reader.readLong(offsets[43]), + ethWalletTagBGInt: reader.readLong(offsets[44]), + ethWalletTagTextInt: reader.readLong(offsets[45]), + favoriteStarActiveInt: reader.readLong(offsets[46]), + favoriteStarInactiveInt: reader.readLong(offsets[47]), + gradientBackgroundString: reader.readStringOrNull(offsets[48]), + highlightInt: reader.readLong(offsets[49]), + homeViewButtonBarBoxShadowString: reader.readStringOrNull(offsets[50]), + infoItemBGInt: reader.readLong(offsets[51]), + infoItemIconsInt: reader.readLong(offsets[52]), + infoItemLabelInt: reader.readLong(offsets[53]), + infoItemTextInt: reader.readLong(offsets[54]), + loadingOverlayTextColorInt: reader.readLong(offsets[55]), + myStackContactIconBGInt: reader.readLong(offsets[56]), + name: reader.readString(offsets[57]), + numberBackDefaultInt: reader.readLong(offsets[58]), + numberTextDefaultInt: reader.readLong(offsets[59]), + numpadBackDefaultInt: reader.readLong(offsets[60]), + numpadTextDefaultInt: reader.readLong(offsets[61]), + overlayInt: reader.readLong(offsets[62]), + popupBGInt: reader.readLong(offsets[63]), + radioButtonBorderDisabledInt: reader.readLong(offsets[64]), + radioButtonBorderEnabledInt: reader.readLong(offsets[65]), + radioButtonIconBorderDisabledInt: reader.readLong(offsets[66]), + radioButtonIconBorderInt: reader.readLong(offsets[67]), + radioButtonIconCircleInt: reader.readLong(offsets[68]), + radioButtonIconEnabledInt: reader.readLong(offsets[69]), + radioButtonLabelDisabledInt: reader.readLong(offsets[70]), + radioButtonLabelEnabledInt: reader.readLong(offsets[71]), + radioButtonTextDisabledInt: reader.readLong(offsets[72]), + radioButtonTextEnabledInt: reader.readLong(offsets[73]), + rateTypeToggleColorOffInt: reader.readLong(offsets[74]), + rateTypeToggleColorOnInt: reader.readLong(offsets[75]), + rateTypeToggleDesktopColorOffInt: reader.readLong(offsets[76]), + rateTypeToggleDesktopColorOnInt: reader.readLong(offsets[77]), + settingsIconBack2Int: reader.readLong(offsets[78]), + settingsIconBackInt: reader.readLong(offsets[79]), + settingsIconElementInt: reader.readLong(offsets[80]), + settingsIconIconInt: reader.readLong(offsets[81]), + settingsItem2ActiveBGInt: reader.readLong(offsets[82]), + settingsItem2ActiveSubInt: reader.readLong(offsets[83]), + settingsItem2ActiveTextInt: reader.readLong(offsets[84]), + shadowInt: reader.readLong(offsets[85]), + snackBarBackErrorInt: reader.readLong(offsets[86]), + snackBarBackInfoInt: reader.readLong(offsets[87]), + snackBarBackSuccessInt: reader.readLong(offsets[88]), + snackBarTextErrorInt: reader.readLong(offsets[89]), + snackBarTextInfoInt: reader.readLong(offsets[90]), + snackBarTextSuccessInt: reader.readLong(offsets[91]), + splashInt: reader.readLong(offsets[92]), + stackWalletBGInt: reader.readLong(offsets[93]), + stackWalletBottomInt: reader.readLong(offsets[94]), + stackWalletMidInt: reader.readLong(offsets[95]), + standardBoxShadowString: reader.readString(offsets[96]), + stepIndicatorBGCheckInt: reader.readLong(offsets[97]), + stepIndicatorBGInactiveInt: reader.readLong(offsets[98]), + stepIndicatorBGLinesInactiveInt: reader.readLong(offsets[99]), + stepIndicatorBGLinesInt: reader.readLong(offsets[100]), + stepIndicatorBGNumberInt: reader.readLong(offsets[101]), + stepIndicatorIconInactiveInt: reader.readLong(offsets[102]), + stepIndicatorIconNumberInt: reader.readLong(offsets[103]), + stepIndicatorIconTextInt: reader.readLong(offsets[104]), + switchBGDisabledInt: reader.readLong(offsets[105]), + switchBGOffInt: reader.readLong(offsets[106]), + switchBGOnInt: reader.readLong(offsets[107]), + switchCircleDisabledInt: reader.readLong(offsets[108]), + switchCircleOffInt: reader.readLong(offsets[109]), + switchCircleOnInt: reader.readLong(offsets[110]), + textConfirmTotalAmountInt: reader.readLong(offsets[111]), + textDark2Int: reader.readLong(offsets[112]), + textDark3Int: reader.readLong(offsets[113]), + textDarkInt: reader.readLong(offsets[114]), + textErrorInt: reader.readLong(offsets[115]), + textFavoriteCardInt: reader.readLong(offsets[116]), + textFieldActiveBGInt: reader.readLong(offsets[117]), + textFieldActiveLabelInt: reader.readLong(offsets[118]), + textFieldActiveSearchIconLeftInt: reader.readLong(offsets[119]), + textFieldActiveSearchIconRightInt: reader.readLong(offsets[120]), + textFieldActiveTextInt: reader.readLong(offsets[121]), + textFieldDefaultBGInt: reader.readLong(offsets[122]), + textFieldDefaultSearchIconLeftInt: reader.readLong(offsets[123]), + textFieldDefaultSearchIconRightInt: reader.readLong(offsets[124]), + textFieldDefaultTextInt: reader.readLong(offsets[125]), + textFieldErrorBGInt: reader.readLong(offsets[126]), + textFieldErrorBorderInt: reader.readLong(offsets[127]), + textFieldErrorLabelInt: reader.readLong(offsets[128]), + textFieldErrorSearchIconLeftInt: reader.readLong(offsets[129]), + textFieldErrorSearchIconRightInt: reader.readLong(offsets[130]), + textFieldErrorTextInt: reader.readLong(offsets[131]), + textFieldSuccessBGInt: reader.readLong(offsets[132]), + textFieldSuccessBorderInt: reader.readLong(offsets[133]), + textFieldSuccessLabelInt: reader.readLong(offsets[134]), + textFieldSuccessSearchIconLeftInt: reader.readLong(offsets[135]), + textFieldSuccessSearchIconRightInt: reader.readLong(offsets[136]), + textFieldSuccessTextInt: reader.readLong(offsets[137]), + textRestoreInt: reader.readLong(offsets[138]), + textSelectedWordTableItemInt: reader.readLong(offsets[139]), + textSubtitle1Int: reader.readLong(offsets[140]), + textSubtitle2Int: reader.readLong(offsets[141]), + textSubtitle3Int: reader.readLong(offsets[142]), + textSubtitle4Int: reader.readLong(offsets[143]), + textSubtitle5Int: reader.readLong(offsets[144]), + textSubtitle6Int: reader.readLong(offsets[145]), + textWhiteInt: reader.readLong(offsets[146]), + themeId: reader.readString(offsets[147]), + tokenSummaryBGInt: reader.readLong(offsets[148]), + tokenSummaryButtonBGInt: reader.readLong(offsets[149]), + tokenSummaryIconInt: reader.readLong(offsets[150]), + tokenSummaryTextPrimaryInt: reader.readLong(offsets[151]), + tokenSummaryTextSecondaryInt: reader.readLong(offsets[152]), + topNavIconGreenInt: reader.readLong(offsets[153]), + topNavIconPrimaryInt: reader.readLong(offsets[154]), + topNavIconRedInt: reader.readLong(offsets[155]), + topNavIconYellowInt: reader.readLong(offsets[156]), + warningBackgroundInt: reader.readLong(offsets[157]), + warningForegroundInt: reader.readLong(offsets[158]), ); object.id = id; return object; @@ -1253,9 +1260,9 @@ P _stackThemeDeserializeProp

( case 13: return (reader.readLong(offset)) as P; case 14: - return (reader.readString(offset)) as P; - case 15: return (reader.readLong(offset)) as P; + case 15: + return (reader.readString(offset)) as P; case 16: return (reader.readLong(offset)) as P; case 17: @@ -1299,9 +1306,9 @@ P _stackThemeDeserializeProp

( case 36: return (reader.readLong(offset)) as P; case 37: - return (reader.readString(offset)) as P; - case 38: return (reader.readLong(offset)) as P; + case 38: + return (reader.readString(offset)) as P; case 39: return (reader.readLong(offset)) as P; case 40: @@ -1319,13 +1326,13 @@ P _stackThemeDeserializeProp

( case 46: return (reader.readLong(offset)) as P; case 47: - return (reader.readStringOrNull(offset)) as P; + return (reader.readLong(offset)) as P; case 48: - return (reader.readLong(offset)) as P; - case 49: return (reader.readStringOrNull(offset)) as P; - case 50: + case 49: return (reader.readLong(offset)) as P; + case 50: + return (reader.readStringOrNull(offset)) as P; case 51: return (reader.readLong(offset)) as P; case 52: @@ -1337,9 +1344,9 @@ P _stackThemeDeserializeProp

( case 55: return (reader.readLong(offset)) as P; case 56: - return (reader.readString(offset)) as P; - case 57: return (reader.readLong(offset)) as P; + case 57: + return (reader.readString(offset)) as P; case 58: return (reader.readLong(offset)) as P; case 59: @@ -1415,9 +1422,9 @@ P _stackThemeDeserializeProp

( case 94: return (reader.readLong(offset)) as P; case 95: - return (reader.readString(offset)) as P; - case 96: return (reader.readLong(offset)) as P; + case 96: + return (reader.readString(offset)) as P; case 97: return (reader.readLong(offset)) as P; case 98: @@ -1517,9 +1524,9 @@ P _stackThemeDeserializeProp

( case 145: return (reader.readLong(offset)) as P; case 146: - return (reader.readString(offset)) as P; - case 147: return (reader.readLong(offset)) as P; + case 147: + return (reader.readString(offset)) as P; case 148: return (reader.readLong(offset)) as P; case 149: @@ -1540,6 +1547,8 @@ P _stackThemeDeserializeProp

( return (reader.readLong(offset)) as P; case 157: return (reader.readLong(offset)) as P; + case 158: + return (reader.readLong(offset)) as P; default: throw IsarError('Unknown property with id $propertyId'); } @@ -2296,6 +2305,62 @@ extension StackThemeQueryFilter }); } + QueryBuilder + bottomNavIconIconHighlightedIntEqualTo(int value) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'bottomNavIconIconHighlightedInt', + value: value, + )); + }); + } + + QueryBuilder + bottomNavIconIconHighlightedIntGreaterThan( + int value, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'bottomNavIconIconHighlightedInt', + value: value, + )); + }); + } + + QueryBuilder + bottomNavIconIconHighlightedIntLessThan( + int value, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'bottomNavIconIconHighlightedInt', + value: value, + )); + }); + } + + QueryBuilder + bottomNavIconIconHighlightedIntBetween( + int lower, + int upper, { + bool includeLower = true, + bool includeUpper = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'bottomNavIconIconHighlightedInt', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + )); + }); + } + QueryBuilder bottomNavIconIconIntEqualTo(int value) { return QueryBuilder.apply(this, (query) { @@ -11319,6 +11384,20 @@ extension StackThemeQuerySortBy }); } + QueryBuilder + sortByBottomNavIconIconHighlightedInt() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'bottomNavIconIconHighlightedInt', Sort.asc); + }); + } + + QueryBuilder + sortByBottomNavIconIconHighlightedIntDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'bottomNavIconIconHighlightedInt', Sort.desc); + }); + } + QueryBuilder sortByBottomNavIconIconInt() { return QueryBuilder.apply(this, (query) { @@ -13466,6 +13545,20 @@ extension StackThemeQuerySortThenBy }); } + QueryBuilder + thenByBottomNavIconIconHighlightedInt() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'bottomNavIconIconHighlightedInt', Sort.asc); + }); + } + + QueryBuilder + thenByBottomNavIconIconHighlightedIntDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'bottomNavIconIconHighlightedInt', Sort.desc); + }); + } + QueryBuilder thenByBottomNavIconIconInt() { return QueryBuilder.apply(this, (query) { @@ -15557,6 +15650,13 @@ extension StackThemeQueryWhereDistinct }); } + QueryBuilder + distinctByBottomNavIconIconHighlightedInt() { + return QueryBuilder.apply(this, (query) { + return query.addDistinctBy(r'bottomNavIconIconHighlightedInt'); + }); + } + QueryBuilder distinctByBottomNavIconIconInt() { return QueryBuilder.apply(this, (query) { @@ -16643,6 +16743,13 @@ extension StackThemeQueryProperty }); } + QueryBuilder + bottomNavIconIconHighlightedIntProperty() { + return QueryBuilder.apply(this, (query) { + return query.addPropertyName(r'bottomNavIconIconHighlightedInt'); + }); + } + QueryBuilder bottomNavIconIconIntProperty() { return QueryBuilder.apply(this, (query) { diff --git a/lib/notifications/notification_card.dart b/lib/notifications/notification_card.dart index 4470fd63b..c8f09ec7e 100644 --- a/lib/notifications/notification_card.dart +++ b/lib/notifications/notification_card.dart @@ -1,7 +1,14 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; import 'package:stackwallet/models/notification_model.dart'; +import 'package:stackwallet/themes/coin_icon_provider.dart'; import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/themes/theme_providers.dart'; +import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/format.dart'; import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/util.dart'; @@ -9,7 +16,7 @@ import 'package:stackwallet/widgets/conditional_parent.dart'; import 'package:stackwallet/widgets/rounded_container.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart'; -class NotificationCard extends StatelessWidget { +class NotificationCard extends ConsumerWidget { const NotificationCard({ Key? key, required this.notification, @@ -25,8 +32,17 @@ class NotificationCard extends StatelessWidget { static const double mobileIconSize = 24; static const double desktopIconSize = 30; + String coinIconPath(ThemeAssets assets, WidgetRef ref) { + try { + final coin = coinFromPrettyName(notification.coinName); + return ref.read(coinIconProvider(coin)); + } catch (_) { + return notification.iconAssetName; + } + } + @override - Widget build(BuildContext context) { + Widget build(BuildContext context, WidgetRef ref) { final isDesktop = Util.isDesktop; return Stack( @@ -41,8 +57,14 @@ class NotificationCard extends StatelessWidget { child: Row( children: [ notification.changeNowId == null - ? SvgPicture.asset( - notification.iconAssetName, + ? SvgPicture.file( + File( + coinIconPath( + ref.watch( + themeProvider.select((value) => value.assets), + ), + ref), + ), width: isDesktop ? desktopIconSize : mobileIconSize, height: isDesktop ? desktopIconSize : mobileIconSize, ) @@ -53,8 +75,14 @@ class NotificationCard extends StatelessWidget { color: Colors.transparent, borderRadius: BorderRadius.circular(24), ), - child: SvgPicture.asset( - notification.iconAssetName, + child: SvgPicture.file( + File( + coinIconPath( + ref.watch( + themeProvider.select((value) => value.assets), + ), + ref), + ), color: Theme.of(context) .extension()! .accentColorDark, diff --git a/lib/pages/address_book_views/address_book_view.dart b/lib/pages/address_book_views/address_book_view.dart index 8e3ef0629..3faaad48e 100644 --- a/lib/pages/address_book_views/address_book_view.dart +++ b/lib/pages/address_book_views/address_book_view.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'package:stackwallet/models/contact.dart'; -import 'package:stackwallet/models/contact_address_entry.dart'; +import 'package:stackwallet/models/isar/models/contact_entry.dart'; import 'package:stackwallet/pages/address_book_views/subviews/add_address_book_entry_view.dart'; import 'package:stackwallet/pages/address_book_views/subviews/address_book_filter_view.dart'; import 'package:stackwallet/providers/global/address_book_service_provider.dart'; @@ -73,19 +72,18 @@ class _AddressBookViewState extends ConsumerState { final managers = ref.read(walletsChangeNotifierProvider).managers; for (final manager in managers) { addresses.add( - ContactAddressEntry( - coin: manager.coin, - address: await manager.currentReceivingAddress, - label: "Current Receiving", - other: manager.walletName, - ), + ContactAddressEntry() + ..coinName = manager.coin.name + ..address = await manager.currentReceivingAddress + ..label = "Current Receiving" + ..other = manager.walletName, ); } - final self = Contact( + final self = ContactEntry( name: "My Stack", addresses: addresses, isFavorite: true, - id: "default", + customId: "default", ); await ref.read(addressBookServiceProvider).editContact(self); }); @@ -306,8 +304,8 @@ class _AddressBookViewState extends ConsumerState { .where((element) => element.isFavorite) .map( (e) => AddressBookCard( - key: Key("favContactCard_${e.id}_key"), - contactId: e.id, + key: Key("favContactCard_${e.customId}_key"), + contactId: e.customId, ), ), ], @@ -352,8 +350,9 @@ class _AddressBookViewState extends ConsumerState { .matches(widget.filterTerm ?? _searchTerm, e)) .map( (e) => AddressBookCard( - key: Key("desktopContactCard_${e.id}_key"), - contactId: e.id, + key: + Key("desktopContactCard_${e.customId}_key"), + contactId: e.customId, ), ), ], diff --git a/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart b/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart index 76234a539..74e312da4 100644 --- a/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart +++ b/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart @@ -2,8 +2,7 @@ import 'package:emojis/emoji.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:stackwallet/models/contact.dart'; -import 'package:stackwallet/models/contact_address_entry.dart'; +import 'package:stackwallet/models/isar/models/contact_entry.dart'; import 'package:stackwallet/pages/address_book_views/subviews/new_contact_address_entry_form.dart'; import 'package:stackwallet/providers/global/address_book_service_provider.dart'; import 'package:stackwallet/providers/ui/address_book_providers/address_entry_data_provider.dart'; @@ -28,6 +27,7 @@ import 'package:stackwallet/widgets/emoji_select_sheet.dart'; import 'package:stackwallet/widgets/icon_widgets/x_icon.dart'; import 'package:stackwallet/widgets/stack_text_field.dart'; import 'package:stackwallet/widgets/textfield_icon_button.dart'; +import 'package:uuid/uuid.dart'; class AddAddressBookEntryView extends ConsumerStatefulWidget { const AddAddressBookEntryView({ @@ -688,11 +688,12 @@ class _AddAddressBookEntryViewState forms[i].id)) .buildAddressEntry()); } - Contact contact = Contact( + ContactEntry contact = ContactEntry( emojiChar: _selectedEmoji?.char, name: nameController.text, addresses: entries, isFavorite: _isFavorite, + customId: const Uuid().v1(), ); if (await ref diff --git a/lib/pages/address_book_views/subviews/add_new_contact_address_view.dart b/lib/pages/address_book_views/subviews/add_new_contact_address_view.dart index fc41d75cb..f01829ab2 100644 --- a/lib/pages/address_book_views/subviews/add_new_contact_address_view.dart +++ b/lib/pages/address_book_views/subviews/add_new_contact_address_view.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'package:stackwallet/models/contact.dart'; -import 'package:stackwallet/models/contact_address_entry.dart'; +import 'package:stackwallet/models/isar/models/contact_entry.dart'; import 'package:stackwallet/pages/address_book_views/subviews/new_contact_address_entry_form.dart'; import 'package:stackwallet/providers/global/address_book_service_provider.dart'; import 'package:stackwallet/providers/ui/address_book_providers/address_entry_data_provider.dart'; @@ -208,7 +207,7 @@ class _AddNewContactAddressViewState .read(addressEntryDataProvider(0)) .buildAddressEntry()); - Contact editedContact = + ContactEntry editedContact = contact.copyWith(addresses: entries); if (await ref diff --git a/lib/pages/address_book_views/subviews/coin_select_sheet.dart b/lib/pages/address_book_views/subviews/coin_select_sheet.dart index a6bf470f8..d343dbdbb 100644 --- a/lib/pages/address_book_views/subviews/coin_select_sheet.dart +++ b/lib/pages/address_book_views/subviews/coin_select_sheet.dart @@ -1,9 +1,11 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:stackwallet/providers/global/prefs_provider.dart'; -import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/coin_image_provider.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/text_styles.dart'; @@ -87,8 +89,10 @@ class CoinSelectSheet extends StatelessWidget { padding: const EdgeInsets.all(12), child: Row( children: [ - SvgPicture.asset( - ref.watch(coinImageProvider(coin)), + SvgPicture.file( + File( + ref.watch(coinImageProvider(coin)), + ), height: 20, width: 20, ), diff --git a/lib/pages/address_book_views/subviews/contact_details_view.dart b/lib/pages/address_book_views/subviews/contact_details_view.dart index bd5efd1c5..b25120584 100644 --- a/lib/pages/address_book_views/subviews/contact_details_view.dart +++ b/lib/pages/address_book_views/subviews/contact_details_view.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -13,8 +15,8 @@ import 'package:stackwallet/providers/global/address_book_service_provider.dart' import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/providers/ui/address_book_providers/address_entry_data_provider.dart'; import 'package:stackwallet/services/coins/manager.dart'; -import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/clipboard_interface.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; @@ -197,7 +199,7 @@ class _ContactDetailsViewState extends ConsumerState { onPressed: () { ref .read(addressBookServiceProvider) - .removeContact(_contact.id); + .removeContact(_contact.customId); Navigator.of(context).pop(); Navigator.of(context).pop(); showFloatingFlushBar( @@ -334,8 +336,10 @@ class _ContactDetailsViewState extends ConsumerState { padding: const EdgeInsets.all(12), child: Row( children: [ - SvgPicture.asset( - ref.watch(coinIconProvider(e.coin)), + SvgPicture.file( + File( + ref.watch(coinIconProvider(e.coin)), + ), height: 24, ), const SizedBox( diff --git a/lib/pages/address_book_views/subviews/contact_popup.dart b/lib/pages/address_book_views/subviews/contact_popup.dart index b09aba6ef..88cad7f33 100644 --- a/lib/pages/address_book_views/subviews/contact_popup.dart +++ b/lib/pages/address_book_views/subviews/contact_popup.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -9,8 +11,8 @@ import 'package:stackwallet/pages/exchange_view/exchange_step_views/step_2_view. import 'package:stackwallet/pages/send_view/send_view.dart'; import 'package:stackwallet/providers/global/address_book_service_provider.dart'; import 'package:stackwallet/providers/providers.dart'; -import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/theme_providers.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/clipboard_interface.dart'; @@ -110,11 +112,13 @@ class ContactPopUp extends ConsumerWidget { ), child: contact.id == "default" ? Center( - child: SvgPicture.asset( - ref.watch( - themeProvider.select( - (value) => - value.assets.stackIcon, + child: SvgPicture.file( + File( + ref.watch( + themeProvider.select( + (value) => value + .assets.stackIcon, + ), ), ), width: 20, @@ -211,9 +215,11 @@ class ContactPopUp extends ConsumerWidget { const SizedBox( height: 2, ), - SvgPicture.asset( - ref.watch( - coinIconProvider(e.coin), + SvgPicture.file( + File( + ref.watch( + coinIconProvider(e.coin), + ), ), height: 24, ), diff --git a/lib/pages/address_book_views/subviews/edit_contact_address_view.dart b/lib/pages/address_book_views/subviews/edit_contact_address_view.dart index 87f9fec80..4fd98ff88 100644 --- a/lib/pages/address_book_views/subviews/edit_contact_address_view.dart +++ b/lib/pages/address_book_views/subviews/edit_contact_address_view.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'package:stackwallet/models/contact.dart'; -import 'package:stackwallet/models/contact_address_entry.dart'; +import 'package:stackwallet/models/isar/models/contact_entry.dart'; import 'package:stackwallet/pages/address_book_views/subviews/new_contact_address_entry_form.dart'; import 'package:stackwallet/providers/global/address_book_service_provider.dart'; import 'package:stackwallet/providers/ui/address_book_providers/address_entry_data_provider.dart'; @@ -49,7 +48,7 @@ class _EditContactAddressViewState late final BarcodeScannerInterface barcodeScanner; late final ClipboardInterface clipboard; - Future save(Contact contact) async { + Future save(ContactEntry contact) async { if (FocusScope.of(context).hasFocus) { FocusScope.of(context).unfocus(); await Future.delayed( @@ -73,7 +72,7 @@ class _EditContactAddressViewState entries.insert(index, editedEntry); - Contact editedContact = contact.copyWith(addresses: entries); + ContactEntry editedContact = contact.copyWith(addresses: entries); if (await ref.read(addressBookServiceProvider).editContact(editedContact)) { if (mounted) { @@ -226,7 +225,8 @@ class _EditContactAddressViewState ); _addresses.remove(entry); - Contact editedContact = contact.copyWith(addresses: _addresses); + ContactEntry editedContact = + contact.copyWith(addresses: _addresses); if (await ref .read(addressBookServiceProvider) .editContact(editedContact)) { diff --git a/lib/pages/address_book_views/subviews/new_contact_address_entry_form.dart b/lib/pages/address_book_views/subviews/new_contact_address_entry_form.dart index c23a362df..cf315130c 100644 --- a/lib/pages/address_book_views/subviews/new_contact_address_entry_form.dart +++ b/lib/pages/address_book_views/subviews/new_contact_address_entry_form.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:dropdown_button2/dropdown_button2.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -7,8 +9,8 @@ import 'package:stackwallet/pages/address_book_views/subviews/coin_select_sheet. import 'package:stackwallet/providers/providers.dart'; // import 'package:stackwallet/providers/global/should_show_lockscreen_on_resume_state_provider.dart'; import 'package:stackwallet/providers/ui/address_book_providers/address_entry_data_provider.dart'; -import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/address_utils.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/barcode_scanner_interface.dart'; @@ -141,8 +143,10 @@ class _NewContactAddressEntryFormState padding: const EdgeInsets.symmetric(vertical: 4), child: Row( children: [ - SvgPicture.asset( - ref.watch(coinIconProvider(coin)), + SvgPicture.file( + File( + ref.watch(coinIconProvider(coin)), + ), height: 24, width: 24, ), @@ -211,15 +215,17 @@ class _NewContactAddressEntryFormState ) : Row( children: [ - SvgPicture.asset( - ref.watch( - coinIconProvider( - ref.watch( - addressEntryDataProvider(widget.id) - .select( - (value) => value.coin, - ), - )!, + SvgPicture.file( + File( + ref.watch( + coinIconProvider( + ref.watch( + addressEntryDataProvider(widget.id) + .select( + (value) => value.coin, + ), + )!, + ), ), ), height: 20, diff --git a/lib/pages/receive_view/receive_view.dart b/lib/pages/receive_view/receive_view.dart index 154acead7..bd2f6b70e 100644 --- a/lib/pages/receive_view/receive_view.dart +++ b/lib/pages/receive_view/receive_view.dart @@ -144,7 +144,7 @@ class _ReceiveViewState extends ConsumerState { aspectRatio: 1, child: AppBarIconButton( semanticsLabel: - "Address List Pop-up Button. Opens A Pop-up For Adress List Button.", + "Address List Pop-up Button. Opens A Pop-up For Address List Button.", key: const Key("walletNetworkSettingsAddNewNodeViewButton"), size: 36, shadows: const [], diff --git a/lib/pages/settings_views/global_settings_view/advanced_views/manage_explorer_view.dart b/lib/pages/settings_views/global_settings_view/advanced_views/manage_explorer_view.dart index b32ee3595..845c29411 100644 --- a/lib/pages/settings_views/global_settings_view/advanced_views/manage_explorer_view.dart +++ b/lib/pages/settings_views/global_settings_view/advanced_views/manage_explorer_view.dart @@ -35,6 +35,12 @@ class _ManageExplorerViewState extends ConsumerState { .replaceAll("%5BTXID%5D", "[TXID]")); } + @override + void dispose() { + textEditingController.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { return Background( @@ -93,13 +99,19 @@ class _ManageExplorerViewState extends ConsumerState { style: Theme.of(context) .extension()! .getPrimaryEnabledButtonStyle(context), - onPressed: () { + onPressed: () async { textEditingController.text = textEditingController.text.trim(); - setBlockExplorerForCoin( - coin: widget.coin, - url: Uri.parse(textEditingController.text)) - .then((value) => Navigator.of(context).pop()); + await setBlockExplorerForCoin( + coin: widget.coin, + url: Uri.parse( + textEditingController.text, + ), + ); + + if (mounted) { + Navigator.of(context).pop(); + } }, child: Text( "Save", diff --git a/lib/pages/settings_views/global_settings_view/global_settings_view.dart b/lib/pages/settings_views/global_settings_view/global_settings_view.dart index 28e410c99..582ccfde5 100644 --- a/lib/pages/settings_views/global_settings_view/global_settings_view.dart +++ b/lib/pages/settings_views/global_settings_view/global_settings_view.dart @@ -191,7 +191,8 @@ class GlobalSettingsView extends StatelessWidget { title: "Appearance", onPressed: () { Navigator.of(context).pushNamed( - AppearanceSettingsView.routeName); + AppearanceSettingsView.routeName, + ); }, ), if (Platform.isIOS) diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart index 28a926663..b89954521 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart @@ -5,10 +5,9 @@ import 'dart:typed_data'; import 'package:stack_wallet_backup/stack_wallet_backup.dart'; import 'package:stackwallet/db/hive/db.dart'; -import 'package:stackwallet/models/contact.dart'; -import 'package:stackwallet/models/contact_address_entry.dart'; import 'package:stackwallet/models/exchange/change_now/exchange_transaction.dart'; import 'package:stackwallet/models/exchange/response_objects/trade.dart'; +import 'package:stackwallet/models/isar/models/contact_entry.dart'; import 'package:stackwallet/models/node_model.dart'; import 'package:stackwallet/models/stack_restoring_ui_state.dart'; import 'package:stackwallet/models/trade_wallet_lookup.dart'; @@ -266,7 +265,7 @@ abstract class SWB { ); AddressBookService addressBookService = AddressBookService(); - var addresses = await addressBookService.addressBookEntries; + var addresses = addressBookService.contacts; backupJson['addressBookEntries'] = addresses.map((e) => e.toMap()).toList(); @@ -799,7 +798,7 @@ abstract class SWB { // contacts final addressBookService = AddressBookService(); - final allContactIds = addressBookService.contacts.map((e) => e.id); + final allContactIds = addressBookService.contacts.map((e) => e.customId); if (addressBookEntries == null) { // if no contacts were present before attempted restore then delete any that @@ -823,21 +822,20 @@ abstract class SWB { List addresses = []; for (var address in (contact['addresses'] as List)) { addresses.add( - ContactAddressEntry( - coin: Coin.values - .firstWhere((element) => element.name == address['coin']), - address: address['address'] as String, - label: address['label'] as String, - ), + ContactAddressEntry() + ..coinName = address['coin'] as String + ..address = address['address'] as String + ..label = address['label'] as String + ..other = address['other'] as String?, ); } await addressBookService.editContact( - Contact( + ContactEntry( emojiChar: contact['emoji'] as String?, name: contact['name'] as String, addresses: addresses, isFavorite: contact['isFavorite'] as bool, - id: contact['id'] as String, + customId: contact['id'] as String, ), ); } else { @@ -1026,21 +1024,20 @@ abstract class SWB { List addresses = []; for (var address in (contact['addresses'] as List)) { addresses.add( - ContactAddressEntry( - coin: Coin.values - .firstWhere((element) => element.name == address['coin']), - address: address['address'] as String, - label: address['label'] as String, - ), + ContactAddressEntry() + ..coinName = address['coin'] as String + ..address = address['address'] as String + ..label = address['label'] as String + ..other = address['other'] as String?, ); } await addressBookService.addContact( - Contact( + ContactEntry( emojiChar: contact['emoji'] as String?, name: contact['name'] as String, addresses: addresses, isFavorite: contact['isFavorite'] as bool, - id: contact['id'] as String, + customId: contact['id'] as String, ), ); } diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_widgets/restoring_wallet_card.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_widgets/restoring_wallet_card.dart index fbd0e82a6..2db94aff7 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_widgets/restoring_wallet_card.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/sub_widgets/restoring_wallet_card.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; @@ -6,8 +8,8 @@ import 'package:stackwallet/pages/settings_views/global_settings_view/stack_back import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/sub_widgets/restoring_item_card.dart'; import 'package:stackwallet/providers/stack_restore/stack_restoring_ui_state_provider.dart'; import 'package:stackwallet/route_generator.dart'; -import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/stack_restoring_status.dart'; @@ -81,8 +83,10 @@ class _RestoringWalletCardState extends ConsumerState { .extension()! .colorForCoin(coin), child: Center( - child: SvgPicture.asset( - ref.watch(coinIconProvider(coin)), + child: SvgPicture.file( + File( + ref.watch(coinIconProvider(coin)), + ), height: 20, width: 20, ), @@ -222,9 +226,11 @@ class _RestoringWalletCardState extends ConsumerState { .extension()! .colorForCoin(coin), child: Center( - child: SvgPicture.asset( - ref.watch( - coinIconProvider(coin), + child: SvgPicture.file( + File( + ref.watch( + coinIconProvider(coin), + ), ), height: 20, width: 20, diff --git a/lib/pages/settings_views/global_settings_view/startup_preferences/startup_preferences_view.dart b/lib/pages/settings_views/global_settings_view/startup_preferences/startup_preferences_view.dart index f61fd7420..b76b63f46 100644 --- a/lib/pages/settings_views/global_settings_view/startup_preferences/startup_preferences_view.dart +++ b/lib/pages/settings_views/global_settings_view/startup_preferences/startup_preferences_view.dart @@ -1,10 +1,12 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:stackwallet/pages/settings_views/global_settings_view/startup_preferences/startup_wallet_selection_view.dart'; import 'package:stackwallet/providers/providers.dart'; -import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/widgets/background.dart'; @@ -236,22 +238,24 @@ class _StartupPreferencesViewState .only(top: 12), child: Row( children: [ - SvgPicture.asset( - ref.watch( - coinIconProvider( - ref - .watch( - walletsChangeNotifierProvider - .select( - (value) => - value.getManager( - ref.watch( - prefsChangeNotifierProvider.select((value) => value.startupWalletId!), + SvgPicture.file( + File( + ref.watch( + coinIconProvider( + ref + .watch( + walletsChangeNotifierProvider + .select( + (value) => + value.getManager( + ref.watch( + prefsChangeNotifierProvider.select((value) => value.startupWalletId!), + ), ), ), - ), - ) - .coin, + ) + .coin, + ), ), ), ), diff --git a/lib/pages/settings_views/global_settings_view/startup_preferences/startup_wallet_selection_view.dart b/lib/pages/settings_views/global_settings_view/startup_preferences/startup_wallet_selection_view.dart index 047627c38..9b8a95909 100644 --- a/lib/pages/settings_views/global_settings_view/startup_preferences/startup_wallet_selection_view.dart +++ b/lib/pages/settings_views/global_settings_view/startup_preferences/startup_wallet_selection_view.dart @@ -1,9 +1,11 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:stackwallet/providers/providers.dart'; -import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/widgets/background.dart'; @@ -102,9 +104,11 @@ class _StartupWalletSelectionViewState ), child: Padding( padding: const EdgeInsets.all(4), - child: SvgPicture.asset( - ref.watch( - coinIconProvider(manager.coin), + child: SvgPicture.file( + File( + ref.watch( + coinIconProvider(manager.coin), + ), ), width: 20, height: 20, diff --git a/lib/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart b/lib/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart index ffa386877..ad0042dc8 100644 --- a/lib/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart +++ b/lib/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart @@ -1,9 +1,11 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:stackwallet/providers/providers.dart'; -import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/sync_type_enum.dart'; @@ -116,9 +118,11 @@ class WalletSyncingOptionsView extends ConsumerWidget { ), child: Padding( padding: const EdgeInsets.all(4), - child: SvgPicture.asset( - ref.watch( - coinIconProvider(manager.coin), + child: SvgPicture.file( + File( + ref.watch( + coinIconProvider(manager.coin), + ), ), width: 20, height: 20, diff --git a/lib/pages/settings_views/global_settings_view/xpub_view.dart b/lib/pages/settings_views/global_settings_view/xpub_view.dart index bd26251d8..e23131ec8 100644 --- a/lib/pages/settings_views/global_settings_view/xpub_view.dart +++ b/lib/pages/settings_views/global_settings_view/xpub_view.dart @@ -8,7 +8,6 @@ import 'package:qr_flutter/qr_flutter.dart'; import 'package:stackwallet/notifications/show_flush_bar.dart'; import 'package:stackwallet/providers/global/wallets_provider.dart'; import 'package:stackwallet/services/coins/manager.dart'; -import 'package:stackwallet/services/mixins/xpubable.dart'; import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/clipboard_interface.dart'; @@ -177,7 +176,7 @@ class _XPubViewState extends ConsumerState { child: child, ), child: FutureBuilder( - future: (manager.wallet as XPubAble).xpub, + future: manager.xpub, builder: (context, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done && snapshot.hasData) { diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_settings_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_settings_view.dart index 8bef9d88b..26c94e4be 100644 --- a/lib/pages/settings_views/wallet_settings_view/wallet_settings_view.dart +++ b/lib/pages/settings_views/wallet_settings_view/wallet_settings_view.dart @@ -33,7 +33,7 @@ import 'package:stackwallet/widgets/rounded_white_container.dart'; import 'package:tuple/tuple.dart'; /// [eventBus] should only be set during testing -class WalletSettingsView extends StatefulWidget { +class WalletSettingsView extends ConsumerStatefulWidget { const WalletSettingsView({ Key? key, required this.walletId, @@ -52,10 +52,10 @@ class WalletSettingsView extends StatefulWidget { final EventBus? eventBus; @override - State createState() => _WalletSettingsViewState(); + ConsumerState createState() => _WalletSettingsViewState(); } -class _WalletSettingsViewState extends State { +class _WalletSettingsViewState extends ConsumerState { late final String walletId; late final Coin coin; late String xpub; @@ -74,7 +74,7 @@ class _WalletSettingsViewState extends State { walletId = widget.walletId; coin = widget.coin; xPubEnabled = - coin != Coin.monero && coin != Coin.wownero && coin != Coin.epicCash; + ref.read(walletsChangeNotifierProvider).getManager(walletId).hasXPub; xpub = ""; _currentSyncStatus = widget.initialSyncStatus; diff --git a/lib/pages/token_view/sub_widgets/token_summary.dart b/lib/pages/token_view/sub_widgets/token_summary.dart index 11156020c..51679c4d6 100644 --- a/lib/pages/token_view/sub_widgets/token_summary.dart +++ b/lib/pages/token_view/sub_widgets/token_summary.dart @@ -308,14 +308,23 @@ class TokenOptionsButton extends StatelessWidget { child: child, ), ), - child: SvgPicture.file( - File(iconAssetPathSVG), - color: Theme.of(context) - .extension()! - .tokenSummaryIcon, - width: iconSize, - height: iconSize, - ), + child: iconAssetPathSVG.startsWith("assets/") + ? SvgPicture.asset( + iconAssetPathSVG, + color: Theme.of(context) + .extension()! + .tokenSummaryIcon, + width: iconSize, + height: iconSize, + ) + : SvgPicture.file( + File(iconAssetPathSVG), + color: Theme.of(context) + .extension()! + .tokenSummaryIcon, + width: iconSize, + height: iconSize, + ), ), ), ), diff --git a/lib/pages/wallet_view/sub_widgets/tx_icon.dart b/lib/pages/wallet_view/sub_widgets/tx_icon.dart index 74c179b47..5b85861c0 100644 --- a/lib/pages/wallet_view/sub_widgets/tx_icon.dart +++ b/lib/pages/wallet_view/sub_widgets/tx_icon.dart @@ -23,19 +23,6 @@ class TxIcon extends ConsumerWidget { static const Size size = Size(32, 32); - // String _getBundleAssetName( - // bool isCancelled, bool isReceived, bool isPending, BuildContext context) { - // if (!isReceived && transaction.subType == TransactionSubType.mint) { - // if (isCancelled) { - // return Assets.svg.anonymizeFailed; - // } - // if (isPending) { - // return Assets.svg.anonymizePending; - // } - // return Assets.svg.anonymize; - // } - // } - String _getAssetName( bool isCancelled, bool isReceived, bool isPending, ThemeAssets assets) { if (!isReceived && transaction.subType == TransactionSubType.mint) { diff --git a/lib/pages/wallet_view/transaction_views/all_transactions_view.dart b/lib/pages/wallet_view/transaction_views/all_transactions_view.dart index dd3521bce..8d23a67cf 100644 --- a/lib/pages/wallet_view/transaction_views/all_transactions_view.dart +++ b/lib/pages/wallet_view/transaction_views/all_transactions_view.dart @@ -3,8 +3,8 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'package:stackwallet/models/contact.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/transaction.dart'; +import 'package:stackwallet/models/isar/models/contact_entry.dart'; import 'package:stackwallet/models/transaction_filter.dart'; import 'package:stackwallet/notifications/show_flush_bar.dart'; import 'package:stackwallet/pages/wallet_view/sub_widgets/tx_icon.dart'; @@ -120,8 +120,8 @@ class _TransactionDetailsViewState extends ConsumerState { }).toList(); } - bool _isKeywordMatch(Transaction tx, String keyword, List contacts, - Map notes) { + bool _isKeywordMatch(Transaction tx, String keyword, + List contacts, Map notes) { if (keyword.isEmpty) { return true; } diff --git a/lib/pages_desktop_specific/address_book_view/desktop_address_book.dart b/lib/pages_desktop_specific/address_book_view/desktop_address_book.dart index e45e894c2..905948569 100644 --- a/lib/pages_desktop_specific/address_book_view/desktop_address_book.dart +++ b/lib/pages_desktop_specific/address_book_view/desktop_address_book.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'package:stackwallet/models/contact.dart'; -import 'package:stackwallet/models/contact_address_entry.dart'; +import 'package:stackwallet/models/isar/models/contact_entry.dart'; import 'package:stackwallet/pages/address_book_views/subviews/add_address_book_entry_view.dart'; import 'package:stackwallet/pages/address_book_views/subviews/address_book_filter_view.dart'; import 'package:stackwallet/pages_desktop_specific/address_book_view/subwidgets/desktop_address_book_scaffold.dart'; @@ -105,19 +104,18 @@ class _DesktopAddressBook extends ConsumerState { final managers = ref.read(walletsChangeNotifierProvider).managers; for (final manager in managers) { addresses.add( - ContactAddressEntry( - coin: manager.coin, - address: await manager.currentReceivingAddress, - label: "Current Receiving", - other: manager.walletName, - ), + ContactAddressEntry() + ..coinName = manager.coin.name + ..address = await manager.currentReceivingAddress + ..label = "Current Receiving" + ..other = manager.walletName, ); } - final self = Contact( + final self = ContactEntry( name: "My Stack", addresses: addresses, isFavorite: true, - id: "default", + customId: "default", ); await ref.read(addressBookServiceProvider).editContact(self); }); @@ -323,14 +321,14 @@ class _DesktopAddressBook extends ConsumerState { .extension()! .accentColorDark .withOpacity( - currentContactId == favorites[i].id + currentContactId == favorites[i].customId ? 0.08 : 0, ), child: RawMaterialButton( onPressed: () { setState(() { - currentContactId = favorites[i].id; + currentContactId = favorites[i].customId; }); }, padding: const EdgeInsets.symmetric( @@ -346,8 +344,8 @@ class _DesktopAddressBook extends ConsumerState { ), child: AddressBookCard( key: Key( - "favContactCard_${favorites[i].id}_key"), - contactId: favorites[i].id, + "favContactCard_${favorites[i].customId}_key"), + contactId: favorites[i].customId, desktopSendFrom: false, ), ), @@ -393,14 +391,16 @@ class _DesktopAddressBook extends ConsumerState { .extension()! .accentColorDark .withOpacity( - currentContactId == allContacts[i].id + currentContactId == + allContacts[i].customId ? 0.08 : 0, ), child: RawMaterialButton( onPressed: () { setState(() { - currentContactId = allContacts[i].id; + currentContactId = + allContacts[i].customId; }); }, padding: const EdgeInsets.symmetric( @@ -416,8 +416,8 @@ class _DesktopAddressBook extends ConsumerState { ), child: AddressBookCard( key: Key( - "favContactCard_${allContacts[i].id}_key"), - contactId: allContacts[i].id, + "favContactCard_${allContacts[i].customId}_key"), + contactId: allContacts[i].customId, desktopSendFrom: false, ), ), diff --git a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_address_card.dart b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_address_card.dart index 214cc01e9..f26573c1e 100644 --- a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_address_card.dart +++ b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_address_card.dart @@ -2,12 +2,12 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:stackwallet/models/contact_address_entry.dart'; +import 'package:stackwallet/models/isar/models/contact_entry.dart'; import 'package:stackwallet/notifications/show_flush_bar.dart'; import 'package:stackwallet/pages/address_book_views/subviews/edit_contact_address_view.dart'; import 'package:stackwallet/providers/ui/address_book_providers/address_entry_data_provider.dart'; -import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/clipboard_interface.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; diff --git a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_details.dart b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_details.dart index 8b56a9cf5..453fe1cb2 100644 --- a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_details.dart +++ b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_details.dart @@ -1,8 +1,11 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:isar/isar.dart'; -import 'package:stackwallet/models/contact.dart'; +import 'package:stackwallet/db/isar/main_db.dart'; +import 'package:stackwallet/models/isar/models/contact_entry.dart'; import 'package:stackwallet/models/isar/models/isar_models.dart'; import 'package:stackwallet/pages/address_book_views/subviews/add_new_contact_address_view.dart'; import 'package:stackwallet/pages_desktop_specific/address_book_view/subwidgets/desktop_address_card.dart'; @@ -24,8 +27,6 @@ import 'package:stackwallet/widgets/rounded_white_container.dart'; import 'package:stackwallet/widgets/transaction_card.dart'; import 'package:tuple/tuple.dart'; -import '../../../db/isar/main_db.dart'; - class DesktopContactDetails extends ConsumerStatefulWidget { const DesktopContactDetails({ Key? key, @@ -42,7 +43,7 @@ class DesktopContactDetails extends ConsumerStatefulWidget { class _DesktopContactDetailsState extends ConsumerState { List> _cachedTransactions = []; - bool _contactHasAddress(String address, Contact contact) { + bool _contactHasAddress(String address, ContactEntry contact) { for (final entry in contact.addresses) { if (entry.address == address) { return true; @@ -82,7 +83,7 @@ class _DesktopContactDetailsState extends ConsumerState { @override Widget build(BuildContext context) { // provider hack to prevent trying to update widget with deleted contact - Contact? _contact; + ContactEntry? _contact; try { _contact = ref.watch(addressBookServiceProvider .select((value) => value.getContactById(widget.contactId))); @@ -117,12 +118,14 @@ class _DesktopContactDetailsState extends ConsumerState { .textFieldDefaultBG, borderRadius: BorderRadius.circular(32), ), - child: contact.id == "default" + child: contact.customId == "default" ? Center( - child: SvgPicture.asset( - ref.watch( - themeProvider.select( - (value) => value.assets.stackIcon, + child: SvgPicture.file( + File( + ref.watch( + themeProvider.select( + (value) => value.assets.stackIcon, + ), ), ), width: 32, @@ -159,7 +162,7 @@ class _DesktopContactDetailsState extends ConsumerState { barrierColor: Colors.transparent, builder: (context) { return DesktopContactOptionsMenuPopup( - contactId: contact.id, + contactId: contact.customId, ); }, ); @@ -261,7 +264,7 @@ class _DesktopContactDetailsState extends ConsumerState { padding: const EdgeInsets.all(18), child: DesktopAddressCard( entry: contact.addresses[i], - contactId: contact.id, + contactId: contact.customId, ), ), ], diff --git a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_options_menu_popup.dart b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_options_menu_popup.dart index 2c3574acf..3d8fb3a6a 100644 --- a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_options_menu_popup.dart +++ b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_options_menu_popup.dart @@ -147,7 +147,7 @@ class _DesktopContactOptionsMenuPopupState onPressed: () { ref .read(addressBookServiceProvider) - .removeContact(contact.id); + .removeContact(contact.customId); Navigator.of(context).pop(); showFloatingFlushBar( type: FlushBarType.success, diff --git a/lib/pages_desktop_specific/coin_control/desktop_coin_control_use_dialog.dart b/lib/pages_desktop_specific/coin_control/desktop_coin_control_use_dialog.dart index 7fce59bdb..e14d8bb19 100644 --- a/lib/pages_desktop_specific/coin_control/desktop_coin_control_use_dialog.dart +++ b/lib/pages_desktop_specific/coin_control/desktop_coin_control_use_dialog.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; @@ -6,8 +8,8 @@ import 'package:stackwallet/db/isar/main_db.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/utxo.dart'; import 'package:stackwallet/pages_desktop_specific/coin_control/utxo_row.dart'; import 'package:stackwallet/providers/global/wallets_provider.dart'; -import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/constants.dart'; @@ -359,8 +361,10 @@ class _DesktopCoinControlUseDialogState color: Colors.transparent, child: Row( children: [ - SvgPicture.asset( - ref.watch(coinIconProvider(coin)), + SvgPicture.file( + File( + ref.watch(coinIconProvider(coin)), + ), width: 24, height: 24, ), diff --git a/lib/pages_desktop_specific/coin_control/desktop_coin_control_view.dart b/lib/pages_desktop_specific/coin_control/desktop_coin_control_view.dart index af41ad1a8..0685204e4 100644 --- a/lib/pages_desktop_specific/coin_control/desktop_coin_control_view.dart +++ b/lib/pages_desktop_specific/coin_control/desktop_coin_control_view.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; @@ -7,8 +9,8 @@ import 'package:stackwallet/models/isar/models/blockchain_data/utxo.dart'; import 'package:stackwallet/pages_desktop_specific/coin_control/freeze_button.dart'; import 'package:stackwallet/pages_desktop_specific/coin_control/utxo_row.dart'; import 'package:stackwallet/providers/global/wallets_provider.dart'; -import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; @@ -343,8 +345,10 @@ class _DesktopCoinControlViewState color: Colors.transparent, child: Row( children: [ - SvgPicture.asset( - ref.watch(coinIconProvider(coin)), + SvgPicture.file( + File( + ref.watch(coinIconProvider(coin)), + ), width: 24, height: 24, ), diff --git a/lib/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart b/lib/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart index 209c3c28c..4fcbb5a82 100644 --- a/lib/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart +++ b/lib/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'package:decimal/decimal.dart'; import 'package:flutter/material.dart'; @@ -522,10 +523,14 @@ class _DesktopTradeRowCardState extends ConsumerState { borderRadius: BorderRadius.circular(32), ), child: Center( - child: SvgPicture.asset( - _fetchIconAssetForStatus( - trade.status, - ref.watch(themeProvider.select((value) => value.assets)), + child: SvgPicture.file( + File( + _fetchIconAssetForStatus( + trade.status, + ref.watch( + themeProvider.select((value) => value.assets), + ), + ), ), width: 32, height: 32, diff --git a/lib/pages_desktop_specific/desktop_menu_item.dart b/lib/pages_desktop_specific/desktop_menu_item.dart index 4f27a1af0..10c2ad25d 100644 --- a/lib/pages_desktop_specific/desktop_menu_item.dart +++ b/lib/pages_desktop_specific/desktop_menu_item.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; @@ -81,28 +83,36 @@ class DesktopNotificationsIcon extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - return SvgPicture.asset( - ref.watch(notificationsProvider - .select((value) => value.hasUnreadNotifications)) - ? ref.watch( - themeProvider.select( - (value) => value.assets.bellNew, + return ref.watch(notificationsProvider + .select((value) => value.hasUnreadNotifications)) + ? SvgPicture.file( + File( + ref.watch( + themeProvider.select( + (value) => value.assets.bellNew, + ), ), - ) - : Assets.svg.bell, - width: 20, - height: 20, - color: ref.watch(notificationsProvider - .select((value) => value.hasUnreadNotifications)) - ? null - : DesktopMenuItemId.notifications == - ref.watch(currentDesktopMenuItemProvider.state).state - ? Theme.of(context).extension()!.accentColorDark - : Theme.of(context) - .extension()! - .accentColorDark - .withOpacity(0.8), - ); + ), + width: 20, + height: 20, + ) + : SvgPicture.asset( + Assets.svg.bell, + width: 20, + height: 20, + color: ref.watch(notificationsProvider + .select((value) => value.hasUnreadNotifications)) + ? null + : DesktopMenuItemId.notifications == + ref.watch(currentDesktopMenuItemProvider.state).state + ? Theme.of(context) + .extension()! + .accentColorDark + : Theme.of(context) + .extension()! + .accentColorDark + .withOpacity(0.8), + ); } } diff --git a/lib/pages_desktop_specific/my_stack_view/my_stack_view.dart b/lib/pages_desktop_specific/my_stack_view/my_stack_view.dart index 1b327ccea..cf231a30c 100644 --- a/lib/pages_desktop_specific/my_stack_view/my_stack_view.dart +++ b/lib/pages_desktop_specific/my_stack_view/my_stack_view.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -53,10 +55,12 @@ class DesktopMyStackTitle extends ConsumerWidget { SizedBox( width: 32, height: 32, - child: SvgPicture.asset( - ref.watch( - themeProvider.select( - (value) => value.assets.stackIcon, + child: SvgPicture.file( + File( + ref.watch( + themeProvider.select( + (value) => value.assets.stackIcon, + ), ), ), ), diff --git a/lib/pages_desktop_specific/my_stack_view/paynym/desktop_paynym_send_dialog.dart b/lib/pages_desktop_specific/my_stack_view/paynym/desktop_paynym_send_dialog.dart index 8b8712740..8776a3394 100644 --- a/lib/pages_desktop_specific/my_stack_view/paynym/desktop_paynym_send_dialog.dart +++ b/lib/pages_desktop_specific/my_stack_view/paynym/desktop_paynym_send_dialog.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; @@ -10,8 +12,8 @@ import 'package:stackwallet/providers/global/price_provider.dart'; import 'package:stackwallet/providers/global/wallets_provider.dart'; import 'package:stackwallet/providers/wallet/public_private_balance_state_provider.dart'; import 'package:stackwallet/services/coins/firo/firo_wallet.dart'; -import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/barcode_scanner_interface.dart'; import 'package:stackwallet/utilities/clipboard_interface.dart'; @@ -81,8 +83,10 @@ class _DesktopPaynymSendDialogState // Theme.of(context).extension()!.textSubtitle4, child: Row( children: [ - SvgPicture.asset( - ref.watch(coinIconProvider(coin)), + SvgPicture.file( + File( + ref.watch(coinIconProvider(coin)), + ), width: 36, height: 36, ), diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart b/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart index b34709680..4a14cb5a5 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart @@ -1,10 +1,12 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:stackwallet/pages/wallets_view/wallets_overview.dart'; import 'package:stackwallet/providers/providers.dart'; -import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/text_styles.dart'; @@ -141,8 +143,10 @@ class _DesktopWalletSummaryRowState flex: 4, child: Row( children: [ - SvgPicture.asset( - ref.watch(coinIconProvider(widget.coin)), + SvgPicture.file( + File( + ref.watch(coinIconProvider(widget.coin)), + ), width: 28, height: 28, ), diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/address_book_address_chooser/address_book_address_chooser.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/address_book_address_chooser/address_book_address_chooser.dart index 647097bfe..1078bea5d 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/address_book_address_chooser/address_book_address_chooser.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/address_book_address_chooser/address_book_address_chooser.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:stackwallet/models/contact.dart'; +import 'package:stackwallet/models/isar/models/contact_entry.dart'; import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/address_book_address_chooser/sub_widgets/contact_list_item.dart'; import 'package:stackwallet/providers/global/address_book_service_provider.dart'; import 'package:stackwallet/themes/stack_colors.dart'; @@ -34,7 +34,7 @@ class _AddressBookAddressChooserState extends State { String _searchTerm = ""; - int _compareContactFavorite(Contact a, Contact b) { + int _compareContactFavorite(ContactEntry a, ContactEntry b) { if (a.isFavorite && b.isFavorite) { return 0; } else if (a.isFavorite) { @@ -44,8 +44,8 @@ class _AddressBookAddressChooserState extends State { } } - List pullOutFavorites(List contacts) { - final List favorites = []; + List pullOutFavorites(List contacts) { + final List favorites = []; contacts.removeWhere((contact) { if (contact.isFavorite) { favorites.add(contact); @@ -57,7 +57,7 @@ class _AddressBookAddressChooserState extends State { return favorites; } - List filter(List contacts, String searchTerm) { + List filter(List contacts, String searchTerm) { if (widget.coin != null) { contacts.removeWhere( (e) => e.addresses.where((a) => a.coin == widget.coin!).isEmpty); @@ -75,7 +75,7 @@ class _AddressBookAddressChooserState extends State { return contacts; } - bool _matches(String term, Contact contact) { + bool _matches(String term, ContactEntry contact) { final text = term.toLowerCase(); if (contact.name.toLowerCase().contains(text)) { return true; @@ -191,7 +191,7 @@ class _AddressBookAddressChooserState extends State { ), child: Consumer( builder: (context, ref, _) { - List contacts = ref + List contacts = ref .watch(addressBookServiceProvider .select((value) => value.contacts)) .toList(); @@ -228,7 +228,7 @@ class _AddressBookAddressChooserState extends State { ), ); } else if (index < favorites.length + 1) { - final id = favorites[index - 1].id; + final id = favorites[index - 1].customId; return ContactListItem( key: Key("contactContactListItem_${id}_key"), contactId: id, @@ -248,7 +248,8 @@ class _AddressBookAddressChooserState extends State { ), ); } else { - final id = contacts[index - favorites.length - 2].id; + final id = + contacts[index - favorites.length - 2].customId; return ContactListItem( key: Key("contactContactListItem_${id}_key"), contactId: id, diff --git a/lib/pages_desktop_specific/password/delete_password_warning_view.dart b/lib/pages_desktop_specific/password/delete_password_warning_view.dart index 3187eebc0..be2b29ab7 100644 --- a/lib/pages_desktop_specific/password/delete_password_warning_view.dart +++ b/lib/pages_desktop_specific/password/delete_password_warning_view.dart @@ -94,10 +94,12 @@ class _ForgotPasswordDesktopViewState child: Column( mainAxisSize: MainAxisSize.min, children: [ - SvgPicture.asset( - ref.watch( - themeProvider.select( - (value) => value.assets.stackIcon, + SvgPicture.file( + File( + ref.watch( + themeProvider.select( + (value) => value.assets.stackIcon, + ), ), ), width: 100, diff --git a/lib/pages_desktop_specific/password/desktop_login_view.dart b/lib/pages_desktop_specific/password/desktop_login_view.dart index fbaec5f29..3a145e542 100644 --- a/lib/pages_desktop_specific/password/desktop_login_view.dart +++ b/lib/pages_desktop_specific/password/desktop_login_view.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -54,7 +55,7 @@ class _DesktopLoginViewState extends ConsumerState { int dbVersion = DB.instance.get( boxName: DB.boxNameDBInfo, key: "hive_data_version") as int? ?? 0; - if (dbVersion < Constants.currentHiveDbVersion) { + if (dbVersion < Constants.currentDataVersion) { try { await DbVersionMigrator().migrate( dbVersion, @@ -166,10 +167,12 @@ class _DesktopLoginViewState extends ConsumerState { child: Column( mainAxisSize: MainAxisSize.min, children: [ - SvgPicture.asset( - ref.watch( - themeProvider.select( - (value) => value.assets.stackIcon, + SvgPicture.file( + File( + ref.watch( + themeProvider.select( + (value) => value.assets.stackIcon, + ), ), ), width: 100, diff --git a/lib/pages_desktop_specific/password/forgot_password_desktop_view.dart b/lib/pages_desktop_specific/password/forgot_password_desktop_view.dart index 75b52d09b..381247639 100644 --- a/lib/pages_desktop_specific/password/forgot_password_desktop_view.dart +++ b/lib/pages_desktop_specific/password/forgot_password_desktop_view.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; @@ -47,10 +49,12 @@ class _ForgotPasswordDesktopViewState child: Column( mainAxisSize: MainAxisSize.min, children: [ - SvgPicture.asset( - ref.watch( - themeProvider.select( - (value) => value.assets.stackIcon, + SvgPicture.file( + File( + ref.watch( + themeProvider.select( + (value) => value.assets.stackIcon, + ), ), ), width: 100, diff --git a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart index cb4c7a557..08eba6c0f 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/advanced_settings/debug_info_dialog.dart'; +import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/advanced_settings/desktop_manage_block_explorers_dialog.dart'; import 'package:stackwallet/pages_desktop_specific/settings/settings_menu/advanced_settings/stack_privacy_dialog.dart'; import 'package:stackwallet/providers/global/prefs_provider.dart'; import 'package:stackwallet/themes/stack_colors.dart'; @@ -58,7 +59,7 @@ class _AdvancedSettings extends ConsumerState { ), TextSpan( text: - "\n\nConfigurate these settings only if you know what you are doing!", + "\n\nConfigure these settings only if you know what you are doing!", style: STextStyles.desktopTextExtraExtraSmall( context), ), @@ -183,7 +184,7 @@ class _AdvancedSettings extends ConsumerState { PrimaryButton( label: "Change", buttonHeight: ButtonHeight.xs, - width: 86, + width: 101, onPressed: () async { await showDialog( context: context, @@ -207,8 +208,6 @@ class _AdvancedSettings extends ConsumerState { thickness: 0.5, ), ), - - /// TODO: Make a dialog popup Padding( padding: const EdgeInsets.all(10), child: Row( @@ -241,6 +240,44 @@ class _AdvancedSettings extends ConsumerState { ], ), ), + const Padding( + padding: EdgeInsets.all(10.0), + child: Divider( + thickness: 0.5, + ), + ), + Padding( + padding: const EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Block explorers", + style: STextStyles.desktopTextExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textDark), + textAlign: TextAlign.left, + ), + PrimaryButton( + buttonHeight: ButtonHeight.xs, + label: "Edit", + width: 101, + onPressed: () async { + await showDialog( + context: context, + useSafeArea: false, + barrierDismissible: true, + builder: (context) { + return const DesktopManageBlockExplorersDialog(); + }, + ); + }, + ), + ], + ), + ), ], ), ), diff --git a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/desktop_manage_block_explorers_dialog.dart b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/desktop_manage_block_explorers_dialog.dart new file mode 100644 index 000000000..9042f41d4 --- /dev/null +++ b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/desktop_manage_block_explorers_dialog.dart @@ -0,0 +1,266 @@ +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:stackwallet/providers/global/prefs_provider.dart'; +import 'package:stackwallet/themes/coin_icon_provider.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/utilities/assets.dart'; +import 'package:stackwallet/utilities/block_explorers.dart'; +import 'package:stackwallet/utilities/constants.dart'; +import 'package:stackwallet/utilities/enums/coin_enum.dart'; +import 'package:stackwallet/utilities/text_styles.dart'; +import 'package:stackwallet/widgets/desktop/desktop_dialog.dart'; +import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart'; +import 'package:stackwallet/widgets/desktop/primary_button.dart'; +import 'package:stackwallet/widgets/desktop/secondary_button.dart'; +import 'package:stackwallet/widgets/rounded_white_container.dart'; + +class DesktopManageBlockExplorersDialog extends ConsumerWidget { + const DesktopManageBlockExplorersDialog({ + Key? key, + }) : super(key: key); + + @override + Widget build(BuildContext context, WidgetRef ref) { + bool showTestNet = ref.watch( + prefsChangeNotifierProvider.select((value) => value.showTestNetCoins), + ); + + final List coins = showTestNet + ? Coin.values + : Coin.values.sublist(0, Coin.values.length - kTestNetCoinCount); + + return DesktopDialog( + maxHeight: 850, + maxWidth: 600, + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: const EdgeInsets.all(32), + child: Text( + "Manage block explorers", + style: STextStyles.desktopH3(context), + textAlign: TextAlign.center, + ), + ), + const DesktopDialogCloseButton(), + ], + ), + Expanded( + child: Padding( + padding: const EdgeInsets.only( + left: 32, + right: 32, + bottom: 32, + ), + child: ListView.separated( + itemCount: coins.length, + separatorBuilder: (_, __) => const SizedBox( + height: 12, + ), + itemBuilder: (_, index) { + final coin = coins[index]; + + return RoundedWhiteContainer( + padding: const EdgeInsets.symmetric( + vertical: 16, + horizontal: 14, + ), + borderColor: Theme.of(context) + .extension()! + .textSubtitle6, + child: Row( + children: [ + SvgPicture.file( + File( + ref.watch(coinIconProvider(coin)), + ), + width: 24, + height: 24, + ), + const SizedBox( + width: 12, + ), + Expanded( + child: Text( + "${coin.prettyName} block explorer", + style: STextStyles.desktopTextSmall(context), + ), + ), + const SizedBox( + width: 12, + ), + SvgPicture.asset( + Assets.svg.chevronRight, + width: 20, + height: 20, + ), + ], + ), + onPressed: () { + showDialog( + context: context, + useSafeArea: false, + barrierDismissible: true, + builder: (context) { + return _DesktopEditBlockExplorerDialog( + coin: coin, + ); + }, + ); + }, + ); + }, + ), + ), + ), + ], + ), + ); + } +} + +class _DesktopEditBlockExplorerDialog extends ConsumerStatefulWidget { + const _DesktopEditBlockExplorerDialog({Key? key, required this.coin}) + : super(key: key); + + final Coin coin; + + @override + ConsumerState<_DesktopEditBlockExplorerDialog> createState() => + _DesktopEditBlockExplorerDialogState(); +} + +class _DesktopEditBlockExplorerDialogState + extends ConsumerState<_DesktopEditBlockExplorerDialog> { + late final TextEditingController _textEditingController; + late final FocusNode _focusNode; + + @override + void initState() { + _textEditingController = TextEditingController( + text: + getBlockExplorerTransactionUrlFor(coin: widget.coin, txid: "[TXID]") + .toString() + .replaceAll("%5BTXID%5D", "[TXID]")); + _focusNode = FocusNode(); + super.initState(); + } + + @override + void dispose() { + _textEditingController.dispose(); + _focusNode.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return DesktopDialog( + maxHeight: double.infinity, + maxWidth: 600, + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: const EdgeInsets.all(32), + child: Text( + "${widget.coin.prettyName} block explorer", + style: STextStyles.desktopH3(context), + textAlign: TextAlign.center, + ), + ), + const DesktopDialogCloseButton(), + ], + ), + Padding( + padding: const EdgeInsets.only( + left: 32, + right: 32, + bottom: 32, + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + ClipRRect( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + child: TextField( + autocorrect: false, + enableSuggestions: false, + key: const Key("addCustomNodeNodeAddressFieldKey"), + controller: _textEditingController, + focusNode: _focusNode, + style: STextStyles.field(context), + ), + ), + const SizedBox( + height: 16, + ), + RoundedWhiteContainer( + borderColor: + Theme.of(context).extension()!.textSubtitle6, + child: Text( + "Edit your block explorer above. Keep in mind that" + " every block explorer has a slightly different URL scheme." + "\n\n" + "Paste in your block explorer of choice, then edit in" + " [TXID] where the transaction ID should go, and Stack" + " Wallet will auto fill the transaction ID in that place" + " of the URL.", + style: STextStyles.desktopTextExtraExtraSmall(context), + ), + ), + const SizedBox( + height: 16, + ), + Row( + children: [ + Expanded( + child: SecondaryButton( + label: "Cancel", + buttonHeight: ButtonHeight.l, + onPressed: Navigator.of(context).pop, + ), + ), + const SizedBox( + width: 16, + ), + Expanded( + child: PrimaryButton( + label: "Save", + buttonHeight: ButtonHeight.l, + onPressed: () async { + _textEditingController.text = + _textEditingController.text.trim(); + await setBlockExplorerForCoin( + coin: widget.coin, + url: Uri.parse( + _textEditingController.text, + ), + ); + + if (mounted) { + Navigator.of(context).pop(); + } + }, + ), + ), + ], + ) + ], + ), + ) + ], + ), + ); + } +} diff --git a/lib/pages_desktop_specific/settings/settings_menu/nodes_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/nodes_settings.dart index f2cc6f17b..7c39b6c91 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/nodes_settings.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/nodes_settings.dart @@ -6,8 +6,8 @@ import 'package:flutter_svg/svg.dart'; import 'package:stackwallet/pages/settings_views/global_settings_view/manage_nodes_views/coin_nodes_view.dart'; import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/route_generator.dart'; -import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/coin_icon_provider.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; @@ -250,8 +250,10 @@ class _NodesSettings extends ConsumerState { children: [ Row( children: [ - SvgPicture.asset( - ref.watch(coinIconProvider(coin)), + SvgPicture.file( + File( + ref.watch(coinIconProvider(coin)), + ), width: 24, height: 24, ), diff --git a/lib/route_generator.dart b/lib/route_generator.dart index 3ff594299..2791974e6 100644 --- a/lib/route_generator.dart +++ b/lib/route_generator.dart @@ -5,7 +5,6 @@ import 'package:isar/isar.dart'; import 'package:stackwallet/models/add_wallet_list_entity/add_wallet_list_entity.dart'; import 'package:stackwallet/models/add_wallet_list_entity/sub_classes/eth_token_entity.dart'; import 'package:stackwallet/models/buy/response_objects/quote.dart'; -import 'package:stackwallet/models/contact_address_entry.dart'; import 'package:stackwallet/models/exchange/incomplete_exchange.dart'; import 'package:stackwallet/models/exchange/response_objects/trade.dart'; import 'package:stackwallet/models/isar/models/isar_models.dart'; @@ -153,6 +152,8 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/widgets/choose_coin_view.dart'; import 'package:tuple/tuple.dart'; +import 'models/isar/models/contact_entry.dart'; + class RouteGenerator { static const bool useMaterialPageRoute = true; diff --git a/lib/services/address_book_service.dart b/lib/services/address_book_service.dart index e92c0b00b..793dccb8b 100644 --- a/lib/services/address_book_service.dart +++ b/lib/services/address_book_service.dart @@ -1,55 +1,33 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; -import 'package:stackwallet/db/hive/db.dart'; -import 'package:stackwallet/models/contact.dart'; +import 'package:stackwallet/db/isar/main_db.dart'; +import 'package:stackwallet/models/isar/models/contact_entry.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; -import 'package:stackwallet/utilities/logger.dart'; class AddressBookService extends ChangeNotifier { - Contact getContactById(String id) { - final json = DB.instance - .get(boxName: DB.boxNameAddressBook, key: id) as Map?; - if (json == null) { - Logging.instance - .log("Attempted to get non existing contact", level: LogLevel.Fatal); + ContactEntry getContactById(String id) { + ContactEntry? contactEntry = MainDB.instance.getContactEntry(id: id); + if (contactEntry == null) { throw Exception('Contact ID "$id" not found!'); + } else { + return contactEntry; } - return Contact.fromJson(Map.from(json)); } - List get contacts { - final keys = List.from( - DB.instance.keys(boxName: DB.boxNameAddressBook)); - final _contacts = keys - .map((id) => Contact.fromJson(Map.from(DB.instance - .get(boxName: DB.boxNameAddressBook, key: id) as Map))) - .toList(growable: false); - _contacts - .sort((a, b) => a.name.toLowerCase().compareTo(b.name.toLowerCase())); - return _contacts; - } - - Future>? _addressBookEntries; - Future> get addressBookEntries => - _addressBookEntries ??= _fetchAddressBookEntries(); - - // Load address book contact entries - Future> _fetchAddressBookEntries() async { - return contacts; - } + List get contacts => MainDB.instance.getContactEntries(); /// search address book entries - //TODO optimize address book search? - Future> search(String text) async { - if (text.isEmpty) return addressBookEntries; - var results = (await addressBookEntries).toList(); + //TODO search using isar queries + Future> search(String text) async { + if (text.isEmpty) return contacts; + var results = contacts.toList(); results.retainWhere((contact) => matches(text, contact)); return results; } - bool matches(String term, Contact contact) { + bool matches(String term, ContactEntry contact) { if (term.isEmpty) { return true; } @@ -73,44 +51,27 @@ class AddressBookService extends ChangeNotifier { /// /// returns false if it provided [contact]'s id already exists in the database /// other true if the [contact] was saved - Future addContact(Contact contact) async { - if (DB.instance.containsKey( - boxName: DB.boxNameAddressBook, key: contact.id)) { + Future addContact(ContactEntry contact) async { + if (await MainDB.instance.isContactEntryExists(id: contact.customId)) { return false; + } else { + await MainDB.instance.putContactEntry(contactEntry: contact); + notifyListeners(); + return true; } - - await DB.instance.put( - boxName: DB.boxNameAddressBook, - key: contact.id, - value: contact.toMap()); - - Logging.instance.log("add address book entry saved", level: LogLevel.Info); - await _refreshAddressBookEntries(); - return true; } /// Edit contact - Future editContact(Contact editedContact) async { + Future editContact(ContactEntry editedContact) async { // over write the contact with edited version - await DB.instance.put( - boxName: DB.boxNameAddressBook, - key: editedContact.id, - value: editedContact.toMap()); - - Logging.instance.log("edit address book entry saved", level: LogLevel.Info); - await _refreshAddressBookEntries(); + await MainDB.instance.putContactEntry(contactEntry: editedContact); + notifyListeners(); return true; } /// Remove address book contact entry from db if it exists Future removeContact(String id) async { - await DB.instance.delete(key: id, boxName: DB.boxNameAddressBook); - await _refreshAddressBookEntries(); - } - - Future _refreshAddressBookEntries() async { - final newAddressBookEntries = await _fetchAddressBookEntries(); - _addressBookEntries = Future(() => newAddressBookEntries); + await MainDB.instance.deleteContactEntry(id: id); notifyListeners(); } } diff --git a/lib/services/coins/bitcoin/bitcoin_wallet.dart b/lib/services/coins/bitcoin/bitcoin_wallet.dart index 5dee0e430..cfa3b73cf 100644 --- a/lib/services/coins/bitcoin/bitcoin_wallet.dart +++ b/lib/services/coins/bitcoin/bitcoin_wallet.dart @@ -53,11 +53,11 @@ import 'package:uuid/uuid.dart'; const int MINIMUM_CONFIRMATIONS = 1; final Amount DUST_LIMIT = Amount( rawValue: BigInt.from(294), - fractionDigits: Coin.particl.decimals, + fractionDigits: Coin.bitcoin.decimals, ); final Amount DUST_LIMIT_P2PKH = Amount( rawValue: BigInt.from(546), - fractionDigits: Coin.particl.decimals, + fractionDigits: Coin.bitcoin.decimals, ); const String GENESIS_HASH_MAINNET = diff --git a/lib/services/coins/bitcoincash/bitcoincash_wallet.dart b/lib/services/coins/bitcoincash/bitcoincash_wallet.dart index 5820dcc59..e5117d08b 100644 --- a/lib/services/coins/bitcoincash/bitcoincash_wallet.dart +++ b/lib/services/coins/bitcoincash/bitcoincash_wallet.dart @@ -71,7 +71,6 @@ String constructDerivePath({ case 0x80: // bch mainnet wif switch (derivePathType) { case DerivePathType.bip44: - case DerivePathType.bip49: coinType = 145; // bch mainnet break; case DerivePathType.bch44: // bitcoin.com wallet specific @@ -95,9 +94,6 @@ String constructDerivePath({ case DerivePathType.bch44: purpose = 44; break; - case DerivePathType.bip49: - purpose = 49; - break; default: throw Exception("DerivePathType $derivePathType not supported"); } @@ -283,10 +279,6 @@ class BitcoinCashWallet extends CoinServiceAPI return DerivePathType.bip44; } - if (decodeBase58[0] == _network.scriptHash) { - // P2SH - return DerivePathType.bip49; - } throw ArgumentError('Invalid version or Network mismatch'); } else { try { @@ -419,15 +411,6 @@ class BitcoinCashWallet extends CoinServiceAPI addrType = isar_models.AddressType.p2pkh; addressString = bitbox.Address.toCashAddress(addressString); break; - case DerivePathType.bip49: - addressString = P2SH( - data: PaymentData( - redeem: P2WPKH(data: data, network: _network).data), - network: _network) - .data - .address!; - addrType = isar_models.AddressType.p2sh; - break; default: throw Exception("DerivePathType $type not supported"); } @@ -518,7 +501,6 @@ class BitcoinCashWallet extends CoinServiceAPI final deriveTypes = [ DerivePathType.bip44, - DerivePathType.bip49, ]; if (coin != Coin.bitcoincashTestnet) { @@ -1397,10 +1379,6 @@ class BitcoinCashWallet extends CoinServiceAPI // P2PKH _generateAddressForChain(0, 0, DerivePathType.bip44), _generateAddressForChain(1, 0, DerivePathType.bip44), - - // P2SH - _generateAddressForChain(0, 0, DerivePathType.bip49), - _generateAddressForChain(1, 0, DerivePathType.bip49), ]); await db.putAddresses(initialAddresses); @@ -1408,7 +1386,7 @@ class BitcoinCashWallet extends CoinServiceAPI Logging.instance.log("_generateNewWalletFinished", level: LogLevel.Info); } - /// Generates a new internal or external chain address for the wallet using a BIP44 or BIP49 derivation path. + /// Generates a new internal or external chain address for the wallet using a BIP44 derivation path. /// [chain] - Use 0 for receiving (external), 1 for change (internal). Should not be any other value! /// [index] - This can be any integer >= 0 Future _generateAddressForChain( @@ -1449,17 +1427,6 @@ class BitcoinCashWallet extends CoinServiceAPI addrType = isar_models.AddressType.p2pkh; address = bitbox.Address.toCashAddress(address); break; - case DerivePathType.bip49: - address = P2SH( - data: PaymentData( - redeem: P2WPKH(data: data, network: _network).data), - network: _network) - .data - .address!; - addrType = isar_models.AddressType.p2sh; - break; - case DerivePathType.bip84: - throw UnsupportedError("bip84 not supported by BCH"); default: throw Exception("DerivePathType $derivePathType not supported"); } @@ -1502,13 +1469,6 @@ class BitcoinCashWallet extends CoinServiceAPI coinType = coin == Coin.bitcoincash ? "0" : "1"; purpose = "44"; break; - case DerivePathType.bip49: - type = isar_models.AddressType.p2sh; - coinType = coin == Coin.bitcoincash ? "145" : "1"; - purpose = "49"; - break; - case DerivePathType.bip84: - throw UnsupportedError("bip84 not supported by BCH"); default: throw Exception("DerivePathType $derivePathType not supported"); } @@ -1537,9 +1497,6 @@ class BitcoinCashWallet extends CoinServiceAPI case DerivePathType.bch44: key = "${walletId}_${chainId}DerivationsBch44P2PKH"; break; - case DerivePathType.bip49: - key = "${walletId}_${chainId}DerivationsP2SH"; - break; default: throw UnsupportedError( "${derivePathType.name} not supported by ${coin.prettyName}"); @@ -2721,20 +2678,6 @@ class BitcoinCashWallet extends CoinServiceAPI redeemScript = null; break; - case DerivePathType.bip49: - final p2wpkh = P2WPKH( - data: PaymentData( - pubkey: Format.stringToUint8List(pubKey), - ), - network: _network, - ).data; - redeemScript = p2wpkh.output; - data = P2SH( - data: PaymentData(redeem: p2wpkh), - network: _network, - ).data; - break; - default: throw Exception("DerivePathType unsupported"); } diff --git a/lib/services/coins/manager.dart b/lib/services/coins/manager.dart index a44cf9d8f..b8bb6d6d4 100644 --- a/lib/services/coins/manager.dart +++ b/lib/services/coins/manager.dart @@ -12,8 +12,8 @@ import 'package:stackwallet/services/event_bus/events/global/updated_in_backgrou import 'package:stackwallet/services/event_bus/global_event_bus.dart'; import 'package:stackwallet/services/mixins/coin_control_interface.dart'; import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart'; -import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/services/mixins/xpubable.dart'; +import 'package:stackwallet/utilities/amount/amount.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/logger.dart'; @@ -252,7 +252,8 @@ class Manager with ChangeNotifier { ); } - bool get hasXPub => _currentWallet is XPubAble; + // TODO: re enable once xpubs have been redone + bool get hasXPub => false; //_currentWallet is XPubAble; Future get xpub async { if (!hasXPub) { diff --git a/lib/themes/stack_colors.dart b/lib/themes/stack_colors.dart index 2aeade5b9..8a326cb97 100644 --- a/lib/themes/stack_colors.dart +++ b/lib/themes/stack_colors.dart @@ -103,6 +103,7 @@ class StackColors extends ThemeExtension { // icons final Color bottomNavIconBack; final Color bottomNavIconIcon; + final Color bottomNavIconIconHighlighted; final Color topNavIconPrimary; final Color topNavIconGreen; final Color topNavIconYellow; @@ -281,6 +282,7 @@ class StackColors extends ThemeExtension { required this.snackBarTextInfo, required this.bottomNavIconBack, required this.bottomNavIconIcon, + required this.bottomNavIconIconHighlighted, required this.topNavIconPrimary, required this.topNavIconGreen, required this.topNavIconYellow, @@ -441,6 +443,7 @@ class StackColors extends ThemeExtension { snackBarTextInfo: colorTheme.snackBarTextInfo, bottomNavIconBack: colorTheme.bottomNavIconBack, bottomNavIconIcon: colorTheme.bottomNavIconIcon, + bottomNavIconIconHighlighted: colorTheme.bottomNavIconIconHighlighted, topNavIconPrimary: colorTheme.topNavIconPrimary, topNavIconGreen: colorTheme.topNavIconGreen, topNavIconYellow: colorTheme.topNavIconYellow, @@ -603,6 +606,7 @@ class StackColors extends ThemeExtension { Color? snackBarTextInfo, Color? bottomNavIconBack, Color? bottomNavIconIcon, + Color? bottomNavIconIconHighlighted, Color? topNavIconPrimary, Color? topNavIconGreen, Color? topNavIconYellow, @@ -776,6 +780,8 @@ class StackColors extends ThemeExtension { snackBarTextInfo: snackBarTextInfo ?? this.snackBarTextInfo, bottomNavIconBack: bottomNavIconBack ?? this.bottomNavIconBack, bottomNavIconIcon: bottomNavIconIcon ?? this.bottomNavIconIcon, + bottomNavIconIconHighlighted: + bottomNavIconIconHighlighted ?? this.bottomNavIconIconHighlighted, topNavIconPrimary: topNavIconPrimary ?? this.topNavIconPrimary, topNavIconGreen: topNavIconGreen ?? this.topNavIconGreen, topNavIconYellow: topNavIconYellow ?? this.topNavIconYellow, @@ -1279,6 +1285,11 @@ class StackColors extends ThemeExtension { other.bottomNavIconIcon, t, )!, + bottomNavIconIconHighlighted: Color.lerp( + bottomNavIconIconHighlighted, + other.bottomNavIconIconHighlighted, + t, + )!, topNavIconPrimary: Color.lerp( topNavIconPrimary, other.topNavIconPrimary, diff --git a/lib/utilities/constants.dart b/lib/utilities/constants.dart index 92e99849d..9a82262d0 100644 --- a/lib/utilities/constants.dart +++ b/lib/utilities/constants.dart @@ -42,7 +42,7 @@ abstract class Constants { // Enable Logger.print statements static const bool disableLogger = false; - static const int currentHiveDbVersion = 8; + static const int currentDataVersion = 10; static const int rescanV1 = 1; diff --git a/lib/utilities/db_version_migration.dart b/lib/utilities/db_version_migration.dart index 24e8b8582..a83ea4305 100644 --- a/lib/utilities/db_version_migration.dart +++ b/lib/utilities/db_version_migration.dart @@ -3,9 +3,12 @@ import 'package:isar/isar.dart'; import 'package:stackwallet/db/hive/db.dart'; import 'package:stackwallet/db/isar/main_db.dart'; import 'package:stackwallet/electrumx_rpc/electrumx.dart'; +import 'package:stackwallet/models/contact.dart'; import 'package:stackwallet/models/exchange/change_now/exchange_transaction.dart'; import 'package:stackwallet/models/exchange/response_objects/trade.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/address.dart'; +import 'package:stackwallet/models/isar/models/contact_entry.dart' + as isar_contact; import 'package:stackwallet/models/isar/models/isar_models.dart' as isar_models; import 'package:stackwallet/models/models.dart'; import 'package:stackwallet/models/node_model.dart'; @@ -290,6 +293,48 @@ class DbVersionMigrator with WalletDB { // try to continue migrating return await migrate(8, secureStore: secureStore); + case 8: + // migrate + await Hive.openBox(DB.boxNameAllWalletsData); + final walletsService = + WalletsService(secureStorageInterface: secureStore); + final walletInfoList = await walletsService.walletNames; + await MainDB.instance.initMainDB(); + for (final walletId in walletInfoList.keys) { + final info = walletInfoList[walletId]!; + if (info.coin == Coin.bitcoincash || + info.coin == Coin.bitcoincashTestnet) { + final ids = await MainDB.instance + .getAddresses(walletId) + .filter() + .typeEqualTo(isar_models.AddressType.p2sh) + .idProperty() + .findAll(); + + await MainDB.instance.isar.writeTxn(() async { + await MainDB.instance.isar.addresses.deleteAll(ids); + }); + } + } + + // update version + await DB.instance.put( + boxName: DB.boxNameDBInfo, key: "hive_data_version", value: 9); + + // try to continue migrating + return await migrate(9, secureStore: secureStore); + + case 9: + // migrate + await _v9(); + + // update version + await DB.instance.put( + boxName: DB.boxNameDBInfo, key: "hive_data_version", value: 10); + + // try to continue migrating + return await migrate(10, secureStore: secureStore); + default: // finally return return; @@ -447,4 +492,50 @@ class DbVersionMigrator with WalletDB { } } } + + Future _v9() async { + final addressBookBox = await Hive.openBox(DB.boxNameAddressBook); + await MainDB.instance.initMainDB(); + + final keys = List.from(addressBookBox.keys); + final contacts = keys + .map((id) => Contact.fromJson( + Map.from( + addressBookBox.get(id) as Map, + ), + )) + .toList(growable: false); + + final List newContacts = []; + + for (final contact in contacts) { + final List newContactAddressEntries = + []; + + for (final entry in contact.addresses) { + newContactAddressEntries.add( + isar_contact.ContactAddressEntry() + ..coinName = entry.coin.name + ..address = entry.address + ..label = entry.label + ..other = entry.other, + ); + } + + final newContact = isar_contact.ContactEntry( + name: contact.name, + addresses: newContactAddressEntries, + isFavorite: contact.isFavorite, + customId: contact.id, + ); + + newContacts.add(newContact); + } + + await MainDB.instance.isar.writeTxn(() async { + await MainDB.instance.isar.contactEntrys.putAll(newContacts); + }); + + await addressBookBox.deleteFromDisk(); + } } diff --git a/lib/widgets/address_book_card.dart b/lib/widgets/address_book_card.dart index 4fca40e01..ee4f9c2db 100644 --- a/lib/widgets/address_book_card.dart +++ b/lib/widgets/address_book_card.dart @@ -1,10 +1,13 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'package:stackwallet/models/contact.dart'; +import 'package:stackwallet/models/isar/models/contact_entry.dart'; import 'package:stackwallet/pages/address_book_views/subviews/contact_popup.dart'; import 'package:stackwallet/providers/global/address_book_service_provider.dart'; import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/themes/theme_providers.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; @@ -14,8 +17,6 @@ import 'package:stackwallet/widgets/conditional_parent.dart'; import 'package:stackwallet/widgets/expandable.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart'; -import '../themes/theme_providers.dart'; - class AddressBookCard extends ConsumerStatefulWidget { const AddressBookCard({ Key? key, @@ -48,7 +49,7 @@ class _AddressBookCardState extends ConsumerState { @override Widget build(BuildContext context) { // provider hack to prevent trying to update widget with deleted contact - Contact? _contact; + ContactEntry? _contact; try { _contact = ref.watch(addressBookServiceProvider .select((value) => value.getContactById(contactId))); @@ -81,7 +82,7 @@ class _AddressBookCardState extends ConsumerState { width: 32, height: 32, decoration: BoxDecoration( - color: contact.id == "default" + color: contact.customId == "default" ? Theme.of(context) .extension()! .myStackContactIconBG @@ -90,12 +91,14 @@ class _AddressBookCardState extends ConsumerState { .textFieldDefaultBG, borderRadius: BorderRadius.circular(32), ), - child: contact.id == "default" + child: contact.customId == "default" ? Center( - child: SvgPicture.asset( - ref.watch( - themeProvider.select( - (value) => value.assets.stackIcon, + child: SvgPicture.file( + File( + ref.watch( + themeProvider.select( + (value) => value.assets.stackIcon, + ), ), ), width: 20, @@ -176,7 +179,7 @@ class _AddressBookCardState extends ConsumerState { useSafeArea: true, barrierDismissible: true, builder: (_) => ContactPopUp( - contactId: contact.id, + contactId: contact.customId, ), ); }, diff --git a/lib/widgets/desktop/living_stack_icon.dart b/lib/widgets/desktop/living_stack_icon.dart index a5c17108a..166f30f9c 100644 --- a/lib/widgets/desktop/living_stack_icon.dart +++ b/lib/widgets/desktop/living_stack_icon.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -47,10 +49,12 @@ class _LivingStackIconState extends ConsumerState { child: AnimatedScale( duration: const Duration(milliseconds: 200), scale: _hovering ? 1.2 : 1, - child: SvgPicture.asset( - ref.watch( - themeProvider.select( - (value) => value.assets.stackIcon, + child: SvgPicture.file( + File( + ref.watch( + themeProvider.select( + (value) => value.assets.stackIcon, + ), ), ), ), diff --git a/lib/widgets/rounded_container.dart b/lib/widgets/rounded_container.dart index c30f7a186..ef679472b 100644 --- a/lib/widgets/rounded_container.dart +++ b/lib/widgets/rounded_container.dart @@ -46,6 +46,12 @@ class RoundedContainer extends StatelessWidget { borderRadius: BorderRadius.circular( Constants.size.circularBorderRadius * radiusMultiplier, ), + side: borderColor == null + ? BorderSide.none + : BorderSide( + color: borderColor!, + width: 1.2, + ), ), onPressed: onPressed, child: child, diff --git a/lib/widgets/wallet_navigation_bar/components/icons/exchange_nav_icon.dart b/lib/widgets/wallet_navigation_bar/components/icons/exchange_nav_icon.dart index bf635fc90..223703334 100644 --- a/lib/widgets/wallet_navigation_bar/components/icons/exchange_nav_icon.dart +++ b/lib/widgets/wallet_navigation_bar/components/icons/exchange_nav_icon.dart @@ -14,7 +14,7 @@ class ExchangeNavIcon extends ConsumerWidget { File( ref.watch( themeProvider.select( - (value) => value.assets.buy, + (value) => value.assets.exchange, ), ), ), diff --git a/lib/widgets/wallet_navigation_bar/components/wallet_navigation_bar_item.dart b/lib/widgets/wallet_navigation_bar/components/wallet_navigation_bar_item.dart index b4b6914f7..8fed3c4e4 100644 --- a/lib/widgets/wallet_navigation_bar/components/wallet_navigation_bar_item.dart +++ b/lib/widgets/wallet_navigation_bar/components/wallet_navigation_bar_item.dart @@ -68,9 +68,10 @@ class WalletNavigationBarItem extends ConsumerWidget { Text( data.label ?? "", style: STextStyles.buttonSmall(context).copyWith( - color: Theme.of(context) - .extension()! - .bottomNavText), + color: Theme.of(context) + .extension()! + .bottomNavText, + ), ), ], ), @@ -112,7 +113,11 @@ class WalletNavigationBarMoreItem extends ConsumerWidget { child: Text( data.label ?? "", textAlign: TextAlign.center, - style: STextStyles.buttonSmall(context), + style: STextStyles.buttonSmall(context).copyWith( + color: Theme.of(context) + .extension()! + .bottomNavText, + ), ), ), const SizedBox( diff --git a/lib/widgets/wallet_navigation_bar/wallet_navigation_bar.dart b/lib/widgets/wallet_navigation_bar/wallet_navigation_bar.dart index ceaea74db..f389b2c85 100644 --- a/lib/widgets/wallet_navigation_bar/wallet_navigation_bar.dart +++ b/lib/widgets/wallet_navigation_bar/wallet_navigation_bar.dart @@ -175,7 +175,7 @@ class _WalletNavigationBarState extends ConsumerState { height: 20, color: Theme.of(context) .extension()! - .infoItemIcons, + .bottomNavIconIconHighlighted, ), crossFadeState: ref .watch(walletNavBarMore.state) @@ -190,10 +190,10 @@ class _WalletNavigationBarState extends ConsumerState { style: STextStyles.buttonSmall(context) .copyWith( - color: Theme.of(context) - .extension< - StackColors>()! - .bottomNavText), + color: Theme.of(context) + .extension()! + .bottomNavText, + ), ), secondChild: Text( "More", @@ -202,7 +202,7 @@ class _WalletNavigationBarState extends ConsumerState { .copyWith( color: Theme.of(context) .extension()! - .infoItemIcons, + .bottomNavIconIconHighlighted, ), ), crossFadeState: ref diff --git a/pubspec.yaml b/pubspec.yaml index 2b8d498b8..1aaeb2d57 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: Stack Wallet # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.7.8+170 +version: 1.7.8+171 environment: sdk: ">=2.17.0 <3.0.0" @@ -343,14 +343,9 @@ flutter: # exchange icons - assets/svg/exchange_icons/ - # theme selectors -# - assets/svg/dark-theme.svg -# - assets/svg/light-mode.svg - # buy - assets/svg/buy/ - # lottie animations # basic - assets/lottie/test2.json diff --git a/test/address_book_service_test.dart b/test/address_book_service_test.dart deleted file mode 100644 index adc036d5a..000000000 --- a/test/address_book_service_test.dart +++ /dev/null @@ -1,174 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; -import 'package:hive/hive.dart'; -import 'package:hive_test/hive_test.dart'; -import 'package:stackwallet/db/hive/db.dart'; -import 'package:stackwallet/models/contact.dart'; -import 'package:stackwallet/models/contact_address_entry.dart'; -import 'package:stackwallet/services/address_book_service.dart'; -import 'package:stackwallet/utilities/enums/coin_enum.dart'; - -void main() { - group("Empty DB tests", () { - setUp(() async { - await setUpTestHive(); - await Hive.openBox(DB.boxNameAddressBook); - }); - - test("get empty contacts", () { - final service = AddressBookService(); - expect(service.contacts, []); - }); - - test("get empty addressBookEntries", () async { - final service = AddressBookService(); - expect(await service.addressBookEntries, []); - }); - - test("getContactById from empty db", () { - final service = AddressBookService(); - expect(() => service.getContactById("some id"), throwsException); - }); - - tearDown(() async { - await tearDownTestHive(); - }); - }); - - group("Preloaded DB tests", () { - final contactA = Contact(name: "john", addresses: [], isFavorite: true); - final contactB = Contact( - name: "JANE", - addresses: [ - const ContactAddressEntry( - coin: Coin.bitcoin, - address: "some btc address", - label: "rent", - ), - ], - isFavorite: false); - final contactC = Contact( - name: "Bill", - addresses: [ - const ContactAddressEntry( - coin: Coin.monero, - address: "some xmr address", - label: "market", - ), - const ContactAddressEntry( - coin: Coin.epicCash, - address: "some epic address", - label: "gas", - ), - ], - isFavorite: true); - - setUp(() async { - await setUpTestHive(); - await Hive.openBox(DB.boxNameAddressBook); - - await DB.instance.put( - boxName: DB.boxNameAddressBook, - key: contactA.id, - value: contactA.toMap()); - await DB.instance.put( - boxName: DB.boxNameAddressBook, - key: contactB.id, - value: contactB.toMap()); - await DB.instance.put( - boxName: DB.boxNameAddressBook, - key: contactC.id, - value: contactC.toMap()); - }); - - test("getContactById with non existing ID", () { - final service = AddressBookService(); - expect(() => service.getContactById("some id"), throwsException); - }); - - test("getContactById with existing ID", () { - final service = AddressBookService(); - expect( - service.getContactById(contactA.id).toString(), contactA.toString()); - }); - - test("get contacts", () { - final service = AddressBookService(); - expect(service.contacts.toString(), - [contactC, contactB, contactA].toString()); - }); - - test("get addressBookEntries", () async { - final service = AddressBookService(); - expect((await service.addressBookEntries).toString(), - [contactC, contactB, contactA].toString()); - }); - - test("search contacts", () async { - final service = AddressBookService(); - final results = await service.search("j"); - expect(results.toString(), [contactB, contactA].toString()); - - final results2 = await service.search("ja"); - expect(results2.toString(), [contactB].toString()); - - final results3 = await service.search("john"); - expect(results3.toString(), [contactA].toString()); - - final results4 = await service.search("po"); - expect(results4.toString(), [].toString()); - - final results5 = await service.search(""); - expect(results5.toString(), [contactC, contactB, contactA].toString()); - - final results6 = await service.search("epic address"); - expect(results6.toString(), [contactC].toString()); - }); - - test("add new contact", () async { - final service = AddressBookService(); - final contactD = Contact(name: "tim", addresses: [], isFavorite: true); - final result = await service.addContact(contactD); - expect(result, true); - expect(service.contacts.length, 4); - expect( - service.getContactById(contactD.id).toString(), contactD.toString()); - }); - - test("add duplicate contact", () async { - final service = AddressBookService(); - final result = await service.addContact(contactA); - expect(result, false); - expect(service.contacts.length, 3); - expect(service.contacts.toString(), - [contactC, contactB, contactA].toString()); - }); - - test("edit contact", () async { - final service = AddressBookService(); - final editedContact = contactB.copyWith(name: "Mike"); - expect(await service.editContact(editedContact), true); - expect(service.contacts.length, 3); - expect(service.contacts.toString(), - [contactC, contactA, editedContact].toString()); - }); - - test("remove existing contact", () async { - final service = AddressBookService(); - await service.removeContact(contactB.id); - expect(service.contacts.length, 2); - expect(service.contacts.toString(), [contactC, contactA].toString()); - }); - - test("remove non existing contact", () async { - final service = AddressBookService(); - await service.removeContact("some id"); - expect(service.contacts.length, 3); - expect(service.contacts.toString(), - [contactC, contactB, contactA].toString()); - }); - - tearDown(() async { - await tearDownTestHive(); - }); - }); -} diff --git a/test/notifications/notification_card_test.dart b/test/notifications/notification_card_test.dart index b362a9650..24c23b35a 100644 --- a/test/notifications/notification_card_test.dart +++ b/test/notifications/notification_card_test.dart @@ -1,17 +1,35 @@ import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; import 'package:stackwallet/models/isar/stack_theme.dart'; import 'package:stackwallet/models/notification_model.dart'; import 'package:stackwallet/notifications/notification_card.dart'; import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/themes/theme_service.dart'; import 'package:stackwallet/utilities/assets.dart'; import '../sample_data/theme_json.dart'; +import 'notification_card_test.mocks.dart'; +@GenerateMocks([ + ThemeService, +]) void main() { testWidgets("test notification card", (widgetTester) async { final key = UniqueKey(); + final mockThemeService = MockThemeService(); + final theme = StackTheme.fromJson( + json: lightThemeJsonMap, + applicationThemesDirectoryPath: "test", + ); + + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => theme, + ); + final notificationCard = NotificationCard( key: key, notification: NotificationModel( @@ -27,19 +45,21 @@ void main() { ); await widgetTester.pumpWidget( - MaterialApp( - theme: ThemeData( - extensions: [ - StackColors.fromStackColorTheme( - StackTheme.fromJson( - json: lightThemeJsonMap, - applicationThemesDirectoryPath: "test", + ProviderScope( + overrides: [ + pThemeService.overrideWithValue(mockThemeService), + ], + child: MaterialApp( + theme: ThemeData( + extensions: [ + StackColors.fromStackColorTheme( + theme, ), - ), - ], - ), - home: Material( - child: notificationCard, + ], + ), + home: Material( + child: notificationCard, + ), ), ), ); diff --git a/test/notifications/notification_card_test.mocks.dart b/test/notifications/notification_card_test.mocks.dart new file mode 100644 index 000000000..7f60b97c9 --- /dev/null +++ b/test/notifications/notification_card_test.mocks.dart @@ -0,0 +1,122 @@ +// Mocks generated by Mockito 5.3.2 from annotations +// in stackwallet/test/notifications/notification_card_test.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i5; +import 'dart:typed_data' as _i6; + +import 'package:mockito/mockito.dart' as _i1; +import 'package:stackwallet/db/isar/main_db.dart' as _i2; +import 'package:stackwallet/models/isar/stack_theme.dart' as _i4; +import 'package:stackwallet/themes/theme_service.dart' as _i3; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +class _FakeMainDB_0 extends _i1.SmartFake implements _i2.MainDB { + _FakeMainDB_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [ThemeService]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockThemeService extends _i1.Mock implements _i3.ThemeService { + MockThemeService() { + _i1.throwOnMissingStub(this); + } + + @override + _i2.MainDB get db => (super.noSuchMethod( + Invocation.getter(#db), + returnValue: _FakeMainDB_0( + this, + Invocation.getter(#db), + ), + ) as _i2.MainDB); + @override + List<_i4.StackTheme> get installedThemes => (super.noSuchMethod( + Invocation.getter(#installedThemes), + returnValue: <_i4.StackTheme>[], + ) as List<_i4.StackTheme>); + @override + void init(_i2.MainDB? db) => super.noSuchMethod( + Invocation.method( + #init, + [db], + ), + returnValueForMissingStub: null, + ); + @override + _i5.Future install({required _i6.Uint8List? themeArchiveData}) => + (super.noSuchMethod( + Invocation.method( + #install, + [], + {#themeArchiveData: themeArchiveData}, + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future remove({required String? themeId}) => (super.noSuchMethod( + Invocation.method( + #remove, + [], + {#themeId: themeId}, + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future verifyInstalled({required String? themeId}) => + (super.noSuchMethod( + Invocation.method( + #verifyInstalled, + [], + {#themeId: themeId}, + ), + returnValue: _i5.Future.value(false), + ) as _i5.Future); + @override + _i5.Future> fetchThemes() => (super.noSuchMethod( + Invocation.method( + #fetchThemes, + [], + ), + returnValue: _i5.Future>.value( + <_i3.StackThemeMetaData>[]), + ) as _i5.Future>); + @override + _i5.Future<_i6.Uint8List> fetchTheme( + {required _i3.StackThemeMetaData? themeMetaData}) => + (super.noSuchMethod( + Invocation.method( + #fetchTheme, + [], + {#themeMetaData: themeMetaData}, + ), + returnValue: _i5.Future<_i6.Uint8List>.value(_i6.Uint8List(0)), + ) as _i5.Future<_i6.Uint8List>); + @override + _i4.StackTheme? getTheme({required String? themeId}) => + (super.noSuchMethod(Invocation.method( + #getTheme, + [], + {#themeId: themeId}, + )) as _i4.StackTheme?); +} diff --git a/test/sample_data/theme_json.dart b/test/sample_data/theme_json.dart index 8bff3a179..6f7601b42 100644 --- a/test/sample_data/theme_json.dart +++ b/test/sample_data/theme_json.dart @@ -91,6 +91,7 @@ const Map lightThemeJsonMap = { "snack_bar_text_info": "0xFF002A78", "bottom_nav_icon_back": "0xFFA2A2A2", "bottom_nav_icon_icon": "0xFF232323", + "bottom_nav_icon_icon_highlighted": "0xFF232323", "top_nav_icon_primary": "0xFF232323", "top_nav_icon_green": "0xFF00A578", "top_nav_icon_yellow": "0xFFF4C517", diff --git a/test/screen_tests/address_book_view/address_book_view_screen_test.mocks.dart b/test/screen_tests/address_book_view/address_book_view_screen_test.mocks.dart index 754121b87..68c48dd34 100644 --- a/test/screen_tests/address_book_view/address_book_view_screen_test.mocks.dart +++ b/test/screen_tests/address_book_view/address_book_view_screen_test.mocks.dart @@ -7,7 +7,7 @@ import 'dart:async' as _i4; import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/models/contact.dart' as _i2; +import 'package:stackwallet/models/isar/models/contact_entry.dart' as _i2; import 'package:stackwallet/services/address_book_service.dart' as _i3; // ignore_for_file: type=lint @@ -21,8 +21,8 @@ import 'package:stackwallet/services/address_book_service.dart' as _i3; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakeContact_0 extends _i1.SmartFake implements _i2.Contact { - _FakeContact_0( +class _FakeContactEntry_0 extends _i1.SmartFake implements _i2.ContactEntry { + _FakeContactEntry_0( Object parent, Invocation parentInvocation, ) : super( @@ -37,46 +37,43 @@ class _FakeContact_0 extends _i1.SmartFake implements _i2.Contact { class MockAddressBookService extends _i1.Mock implements _i3.AddressBookService { @override - List<_i2.Contact> get contacts => (super.noSuchMethod( + List<_i2.ContactEntry> get contacts => (super.noSuchMethod( Invocation.getter(#contacts), - returnValue: <_i2.Contact>[], - ) as List<_i2.Contact>); - @override - _i4.Future> get addressBookEntries => (super.noSuchMethod( - Invocation.getter(#addressBookEntries), - returnValue: _i4.Future>.value(<_i2.Contact>[]), - ) as _i4.Future>); + returnValue: <_i2.ContactEntry>[], + ) as List<_i2.ContactEntry>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); @override - _i2.Contact getContactById(String? id) => (super.noSuchMethod( + _i2.ContactEntry getContactById(String? id) => (super.noSuchMethod( Invocation.method( #getContactById, [id], ), - returnValue: _FakeContact_0( + returnValue: _FakeContactEntry_0( this, Invocation.method( #getContactById, [id], ), ), - ) as _i2.Contact); + ) as _i2.ContactEntry); @override - _i4.Future> search(String? text) => (super.noSuchMethod( + _i4.Future> search(String? text) => + (super.noSuchMethod( Invocation.method( #search, [text], ), - returnValue: _i4.Future>.value(<_i2.Contact>[]), - ) as _i4.Future>); + returnValue: + _i4.Future>.value(<_i2.ContactEntry>[]), + ) as _i4.Future>); @override bool matches( String? term, - _i2.Contact? contact, + _i2.ContactEntry? contact, ) => (super.noSuchMethod( Invocation.method( @@ -89,7 +86,7 @@ class MockAddressBookService extends _i1.Mock returnValue: false, ) as bool); @override - _i4.Future addContact(_i2.Contact? contact) => (super.noSuchMethod( + _i4.Future addContact(_i2.ContactEntry? contact) => (super.noSuchMethod( Invocation.method( #addContact, [contact], @@ -97,7 +94,7 @@ class MockAddressBookService extends _i1.Mock returnValue: _i4.Future.value(false), ) as _i4.Future); @override - _i4.Future editContact(_i2.Contact? editedContact) => + _i4.Future editContact(_i2.ContactEntry? editedContact) => (super.noSuchMethod( Invocation.method( #editContact, diff --git a/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.mocks.dart b/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.mocks.dart index 4c690a92d..80a28f732 100644 --- a/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.mocks.dart +++ b/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.mocks.dart @@ -9,7 +9,7 @@ import 'dart:ui' as _i11; import 'package:barcode_scan2/barcode_scan2.dart' as _i2; import 'package:mockito/mockito.dart' as _i1; import 'package:stackwallet/models/balance.dart' as _i6; -import 'package:stackwallet/models/contact.dart' as _i3; +import 'package:stackwallet/models/isar/models/contact_entry.dart' as _i3; import 'package:stackwallet/models/isar/models/isar_models.dart' as _i14; import 'package:stackwallet/models/models.dart' as _i5; import 'package:stackwallet/services/address_book_service.dart' as _i10; @@ -40,8 +40,8 @@ class _FakeScanResult_0 extends _i1.SmartFake implements _i2.ScanResult { ); } -class _FakeContact_1 extends _i1.SmartFake implements _i3.Contact { - _FakeContact_1( +class _FakeContactEntry_1 extends _i1.SmartFake implements _i3.ContactEntry { + _FakeContactEntry_1( Object parent, Invocation parentInvocation, ) : super( @@ -126,46 +126,43 @@ class MockBarcodeScannerWrapper extends _i1.Mock class MockAddressBookService extends _i1.Mock implements _i10.AddressBookService { @override - List<_i3.Contact> get contacts => (super.noSuchMethod( + List<_i3.ContactEntry> get contacts => (super.noSuchMethod( Invocation.getter(#contacts), - returnValue: <_i3.Contact>[], - ) as List<_i3.Contact>); - @override - _i9.Future> get addressBookEntries => (super.noSuchMethod( - Invocation.getter(#addressBookEntries), - returnValue: _i9.Future>.value(<_i3.Contact>[]), - ) as _i9.Future>); + returnValue: <_i3.ContactEntry>[], + ) as List<_i3.ContactEntry>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); @override - _i3.Contact getContactById(String? id) => (super.noSuchMethod( + _i3.ContactEntry getContactById(String? id) => (super.noSuchMethod( Invocation.method( #getContactById, [id], ), - returnValue: _FakeContact_1( + returnValue: _FakeContactEntry_1( this, Invocation.method( #getContactById, [id], ), ), - ) as _i3.Contact); + ) as _i3.ContactEntry); @override - _i9.Future> search(String? text) => (super.noSuchMethod( + _i9.Future> search(String? text) => + (super.noSuchMethod( Invocation.method( #search, [text], ), - returnValue: _i9.Future>.value(<_i3.Contact>[]), - ) as _i9.Future>); + returnValue: + _i9.Future>.value(<_i3.ContactEntry>[]), + ) as _i9.Future>); @override bool matches( String? term, - _i3.Contact? contact, + _i3.ContactEntry? contact, ) => (super.noSuchMethod( Invocation.method( @@ -178,7 +175,7 @@ class MockAddressBookService extends _i1.Mock returnValue: false, ) as bool); @override - _i9.Future addContact(_i3.Contact? contact) => (super.noSuchMethod( + _i9.Future addContact(_i3.ContactEntry? contact) => (super.noSuchMethod( Invocation.method( #addContact, [contact], @@ -186,7 +183,7 @@ class MockAddressBookService extends _i1.Mock returnValue: _i9.Future.value(false), ) as _i9.Future); @override - _i9.Future editContact(_i3.Contact? editedContact) => + _i9.Future editContact(_i3.ContactEntry? editedContact) => (super.noSuchMethod( Invocation.method( #editContact, diff --git a/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.mocks.dart b/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.mocks.dart index 266112adf..935ea5526 100644 --- a/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.mocks.dart +++ b/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.mocks.dart @@ -8,7 +8,7 @@ import 'dart:ui' as _i9; import 'package:mockito/mockito.dart' as _i1; import 'package:stackwallet/models/balance.dart' as _i5; -import 'package:stackwallet/models/contact.dart' as _i2; +import 'package:stackwallet/models/isar/models/contact_entry.dart' as _i2; import 'package:stackwallet/models/isar/models/isar_models.dart' as _i12; import 'package:stackwallet/models/models.dart' as _i4; import 'package:stackwallet/services/address_book_service.dart' as _i7; @@ -30,8 +30,8 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i11; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakeContact_0 extends _i1.SmartFake implements _i2.Contact { - _FakeContact_0( +class _FakeContactEntry_0 extends _i1.SmartFake implements _i2.ContactEntry { + _FakeContactEntry_0( Object parent, Invocation parentInvocation, ) : super( @@ -87,46 +87,43 @@ class _FakeAmount_4 extends _i1.SmartFake implements _i6.Amount { class MockAddressBookService extends _i1.Mock implements _i7.AddressBookService { @override - List<_i2.Contact> get contacts => (super.noSuchMethod( + List<_i2.ContactEntry> get contacts => (super.noSuchMethod( Invocation.getter(#contacts), - returnValue: <_i2.Contact>[], - ) as List<_i2.Contact>); - @override - _i8.Future> get addressBookEntries => (super.noSuchMethod( - Invocation.getter(#addressBookEntries), - returnValue: _i8.Future>.value(<_i2.Contact>[]), - ) as _i8.Future>); + returnValue: <_i2.ContactEntry>[], + ) as List<_i2.ContactEntry>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); @override - _i2.Contact getContactById(String? id) => (super.noSuchMethod( + _i2.ContactEntry getContactById(String? id) => (super.noSuchMethod( Invocation.method( #getContactById, [id], ), - returnValue: _FakeContact_0( + returnValue: _FakeContactEntry_0( this, Invocation.method( #getContactById, [id], ), ), - ) as _i2.Contact); + ) as _i2.ContactEntry); @override - _i8.Future> search(String? text) => (super.noSuchMethod( + _i8.Future> search(String? text) => + (super.noSuchMethod( Invocation.method( #search, [text], ), - returnValue: _i8.Future>.value(<_i2.Contact>[]), - ) as _i8.Future>); + returnValue: + _i8.Future>.value(<_i2.ContactEntry>[]), + ) as _i8.Future>); @override bool matches( String? term, - _i2.Contact? contact, + _i2.ContactEntry? contact, ) => (super.noSuchMethod( Invocation.method( @@ -139,7 +136,7 @@ class MockAddressBookService extends _i1.Mock returnValue: false, ) as bool); @override - _i8.Future addContact(_i2.Contact? contact) => (super.noSuchMethod( + _i8.Future addContact(_i2.ContactEntry? contact) => (super.noSuchMethod( Invocation.method( #addContact, [contact], @@ -147,7 +144,7 @@ class MockAddressBookService extends _i1.Mock returnValue: _i8.Future.value(false), ) as _i8.Future); @override - _i8.Future editContact(_i2.Contact? editedContact) => + _i8.Future editContact(_i2.ContactEntry? editedContact) => (super.noSuchMethod( Invocation.method( #editContact, diff --git a/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.mocks.dart b/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.mocks.dart index dc9692644..8874682ae 100644 --- a/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.mocks.dart +++ b/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.mocks.dart @@ -8,7 +8,7 @@ import 'dart:ui' as _i9; import 'package:mockito/mockito.dart' as _i1; import 'package:stackwallet/models/balance.dart' as _i5; -import 'package:stackwallet/models/contact.dart' as _i2; +import 'package:stackwallet/models/isar/models/contact_entry.dart' as _i2; import 'package:stackwallet/models/isar/models/isar_models.dart' as _i12; import 'package:stackwallet/models/models.dart' as _i4; import 'package:stackwallet/services/address_book_service.dart' as _i7; @@ -28,8 +28,8 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i11; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakeContact_0 extends _i1.SmartFake implements _i2.Contact { - _FakeContact_0( +class _FakeContactEntry_0 extends _i1.SmartFake implements _i2.ContactEntry { + _FakeContactEntry_0( Object parent, Invocation parentInvocation, ) : super( @@ -85,46 +85,43 @@ class _FakeAmount_4 extends _i1.SmartFake implements _i6.Amount { class MockAddressBookService extends _i1.Mock implements _i7.AddressBookService { @override - List<_i2.Contact> get contacts => (super.noSuchMethod( + List<_i2.ContactEntry> get contacts => (super.noSuchMethod( Invocation.getter(#contacts), - returnValue: <_i2.Contact>[], - ) as List<_i2.Contact>); - @override - _i8.Future> get addressBookEntries => (super.noSuchMethod( - Invocation.getter(#addressBookEntries), - returnValue: _i8.Future>.value(<_i2.Contact>[]), - ) as _i8.Future>); + returnValue: <_i2.ContactEntry>[], + ) as List<_i2.ContactEntry>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); @override - _i2.Contact getContactById(String? id) => (super.noSuchMethod( + _i2.ContactEntry getContactById(String? id) => (super.noSuchMethod( Invocation.method( #getContactById, [id], ), - returnValue: _FakeContact_0( + returnValue: _FakeContactEntry_0( this, Invocation.method( #getContactById, [id], ), ), - ) as _i2.Contact); + ) as _i2.ContactEntry); @override - _i8.Future> search(String? text) => (super.noSuchMethod( + _i8.Future> search(String? text) => + (super.noSuchMethod( Invocation.method( #search, [text], ), - returnValue: _i8.Future>.value(<_i2.Contact>[]), - ) as _i8.Future>); + returnValue: + _i8.Future>.value(<_i2.ContactEntry>[]), + ) as _i8.Future>); @override bool matches( String? term, - _i2.Contact? contact, + _i2.ContactEntry? contact, ) => (super.noSuchMethod( Invocation.method( @@ -137,7 +134,7 @@ class MockAddressBookService extends _i1.Mock returnValue: false, ) as bool); @override - _i8.Future addContact(_i2.Contact? contact) => (super.noSuchMethod( + _i8.Future addContact(_i2.ContactEntry? contact) => (super.noSuchMethod( Invocation.method( #addContact, [contact], @@ -145,7 +142,7 @@ class MockAddressBookService extends _i1.Mock returnValue: _i8.Future.value(false), ) as _i8.Future); @override - _i8.Future editContact(_i2.Contact? editedContact) => + _i8.Future editContact(_i2.ContactEntry? editedContact) => (super.noSuchMethod( Invocation.method( #editContact, diff --git a/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.mocks.dart b/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.mocks.dart index 4d7191c2c..73941fed6 100644 --- a/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.mocks.dart +++ b/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.mocks.dart @@ -7,7 +7,7 @@ import 'dart:async' as _i4; import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/models/contact.dart' as _i2; +import 'package:stackwallet/models/isar/models/contact_entry.dart' as _i2; import 'package:stackwallet/services/address_book_service.dart' as _i6; import 'package:stackwallet/services/locale_service.dart' as _i7; import 'package:stackwallet/services/notes_service.dart' as _i3; @@ -23,8 +23,8 @@ import 'package:stackwallet/services/notes_service.dart' as _i3; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakeContact_0 extends _i1.SmartFake implements _i2.Contact { - _FakeContact_0( +class _FakeContactEntry_0 extends _i1.SmartFake implements _i2.ContactEntry { + _FakeContactEntry_0( Object parent, Invocation parentInvocation, ) : super( @@ -141,46 +141,43 @@ class MockNotesService extends _i1.Mock implements _i3.NotesService { class MockAddressBookService extends _i1.Mock implements _i6.AddressBookService { @override - List<_i2.Contact> get contacts => (super.noSuchMethod( + List<_i2.ContactEntry> get contacts => (super.noSuchMethod( Invocation.getter(#contacts), - returnValue: <_i2.Contact>[], - ) as List<_i2.Contact>); - @override - _i4.Future> get addressBookEntries => (super.noSuchMethod( - Invocation.getter(#addressBookEntries), - returnValue: _i4.Future>.value(<_i2.Contact>[]), - ) as _i4.Future>); + returnValue: <_i2.ContactEntry>[], + ) as List<_i2.ContactEntry>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); @override - _i2.Contact getContactById(String? id) => (super.noSuchMethod( + _i2.ContactEntry getContactById(String? id) => (super.noSuchMethod( Invocation.method( #getContactById, [id], ), - returnValue: _FakeContact_0( + returnValue: _FakeContactEntry_0( this, Invocation.method( #getContactById, [id], ), ), - ) as _i2.Contact); + ) as _i2.ContactEntry); @override - _i4.Future> search(String? text) => (super.noSuchMethod( + _i4.Future> search(String? text) => + (super.noSuchMethod( Invocation.method( #search, [text], ), - returnValue: _i4.Future>.value(<_i2.Contact>[]), - ) as _i4.Future>); + returnValue: + _i4.Future>.value(<_i2.ContactEntry>[]), + ) as _i4.Future>); @override bool matches( String? term, - _i2.Contact? contact, + _i2.ContactEntry? contact, ) => (super.noSuchMethod( Invocation.method( @@ -193,7 +190,7 @@ class MockAddressBookService extends _i1.Mock returnValue: false, ) as bool); @override - _i4.Future addContact(_i2.Contact? contact) => (super.noSuchMethod( + _i4.Future addContact(_i2.ContactEntry? contact) => (super.noSuchMethod( Invocation.method( #addContact, [contact], @@ -201,7 +198,7 @@ class MockAddressBookService extends _i1.Mock returnValue: _i4.Future.value(false), ) as _i4.Future); @override - _i4.Future editContact(_i2.Contact? editedContact) => + _i4.Future editContact(_i2.ContactEntry? editedContact) => (super.noSuchMethod( Invocation.method( #editContact, diff --git a/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.mocks.dart b/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.mocks.dart index 86d4ca961..02b5eb2b7 100644 --- a/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.mocks.dart +++ b/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.mocks.dart @@ -7,7 +7,7 @@ import 'dart:async' as _i4; import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/models/contact.dart' as _i2; +import 'package:stackwallet/models/isar/models/contact_entry.dart' as _i2; import 'package:stackwallet/services/address_book_service.dart' as _i3; import 'package:stackwallet/services/notes_service.dart' as _i6; @@ -22,8 +22,8 @@ import 'package:stackwallet/services/notes_service.dart' as _i6; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakeContact_0 extends _i1.SmartFake implements _i2.Contact { - _FakeContact_0( +class _FakeContactEntry_0 extends _i1.SmartFake implements _i2.ContactEntry { + _FakeContactEntry_0( Object parent, Invocation parentInvocation, ) : super( @@ -38,46 +38,43 @@ class _FakeContact_0 extends _i1.SmartFake implements _i2.Contact { class MockAddressBookService extends _i1.Mock implements _i3.AddressBookService { @override - List<_i2.Contact> get contacts => (super.noSuchMethod( + List<_i2.ContactEntry> get contacts => (super.noSuchMethod( Invocation.getter(#contacts), - returnValue: <_i2.Contact>[], - ) as List<_i2.Contact>); - @override - _i4.Future> get addressBookEntries => (super.noSuchMethod( - Invocation.getter(#addressBookEntries), - returnValue: _i4.Future>.value(<_i2.Contact>[]), - ) as _i4.Future>); + returnValue: <_i2.ContactEntry>[], + ) as List<_i2.ContactEntry>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); @override - _i2.Contact getContactById(String? id) => (super.noSuchMethod( + _i2.ContactEntry getContactById(String? id) => (super.noSuchMethod( Invocation.method( #getContactById, [id], ), - returnValue: _FakeContact_0( + returnValue: _FakeContactEntry_0( this, Invocation.method( #getContactById, [id], ), ), - ) as _i2.Contact); + ) as _i2.ContactEntry); @override - _i4.Future> search(String? text) => (super.noSuchMethod( + _i4.Future> search(String? text) => + (super.noSuchMethod( Invocation.method( #search, [text], ), - returnValue: _i4.Future>.value(<_i2.Contact>[]), - ) as _i4.Future>); + returnValue: + _i4.Future>.value(<_i2.ContactEntry>[]), + ) as _i4.Future>); @override bool matches( String? term, - _i2.Contact? contact, + _i2.ContactEntry? contact, ) => (super.noSuchMethod( Invocation.method( @@ -90,7 +87,7 @@ class MockAddressBookService extends _i1.Mock returnValue: false, ) as bool); @override - _i4.Future addContact(_i2.Contact? contact) => (super.noSuchMethod( + _i4.Future addContact(_i2.ContactEntry? contact) => (super.noSuchMethod( Invocation.method( #addContact, [contact], @@ -98,7 +95,7 @@ class MockAddressBookService extends _i1.Mock returnValue: _i4.Future.value(false), ) as _i4.Future); @override - _i4.Future editContact(_i2.Contact? editedContact) => + _i4.Future editContact(_i2.ContactEntry? editedContact) => (super.noSuchMethod( Invocation.method( #editContact, diff --git a/test/services/coins/bitcoincash/bitcoincash_wallet_test.dart b/test/services/coins/bitcoincash/bitcoincash_wallet_test.dart index 9fad50494..661c9a1b7 100644 --- a/test/services/coins/bitcoincash/bitcoincash_wallet_test.dart +++ b/test/services/coins/bitcoincash/bitcoincash_wallet_test.dart @@ -175,17 +175,6 @@ void main() async { verifyNoMoreInteractions(cachedClient); verifyNoMoreInteractions(tracker); }); - - test("Multisig/P2SH address", () { - expect( - mainnetWallet?.addressType( - address: "3DYuVEmuKWQFxJcF7jDPhwPiXLTiNnyMFb"), - DerivePathType.bip49); - expect(secureStore.interactions, 0); - verifyNoMoreInteractions(client); - verifyNoMoreInteractions(cachedClient); - verifyNoMoreInteractions(tracker); - }); }); group("validate mainnet bitcoincash addresses", () { diff --git a/test/widget_tests/address_book_card_test.dart b/test/widget_tests/address_book_card_test.dart index 2c068f73d..faf78be2f 100644 --- a/test/widget_tests/address_book_card_test.dart +++ b/test/widget_tests/address_book_card_test.dart @@ -5,18 +5,17 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; -import 'package:stackwallet/models/contact.dart'; -import 'package:stackwallet/models/contact_address_entry.dart'; +import 'package:stackwallet/models/isar/models/contact_entry.dart'; import 'package:stackwallet/models/isar/stack_theme.dart'; import 'package:stackwallet/pages/address_book_views/subviews/contact_popup.dart'; import 'package:stackwallet/providers/global/address_book_service_provider.dart'; import 'package:stackwallet/services/address_book_service.dart'; -import '../sample_data/theme_json.dart'; import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/util.dart'; import 'package:stackwallet/widgets/address_book_card.dart'; +import '../sample_data/theme_json.dart'; import 'address_book_card_test.mocks.dart'; class MockedFunctions extends Mock { @@ -27,18 +26,20 @@ class MockedFunctions extends Mock { void main() { testWidgets('test returns Contact Address Entry', (widgetTester) async { final service = MockAddressBookService(); - final applicationThemesDirectoryPath = ""; + const applicationThemesDirectoryPath = ""; when(service.getContactById("default")).thenAnswer( - (realInvocation) => Contact( + (realInvocation) => ContactEntry( name: "John Doe", addresses: [ - const ContactAddressEntry( - coin: Coin.bitcoincash, - address: "some bch address", - label: "Bills") + ContactAddressEntry() + ..coinName = Coin.bitcoincash.name + ..address = "some bch address" + ..label = "Bills" + ..other = null ], isFavorite: true, + customId: '', ), ); diff --git a/test/widget_tests/address_book_card_test.mocks.dart b/test/widget_tests/address_book_card_test.mocks.dart index 550095d26..f26ca5dbd 100644 --- a/test/widget_tests/address_book_card_test.mocks.dart +++ b/test/widget_tests/address_book_card_test.mocks.dart @@ -7,7 +7,7 @@ import 'dart:async' as _i4; import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/models/contact.dart' as _i2; +import 'package:stackwallet/models/isar/models/contact_entry.dart' as _i2; import 'package:stackwallet/services/address_book_service.dart' as _i3; // ignore_for_file: type=lint @@ -21,8 +21,8 @@ import 'package:stackwallet/services/address_book_service.dart' as _i3; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakeContact_0 extends _i1.SmartFake implements _i2.Contact { - _FakeContact_0( +class _FakeContactEntry_0 extends _i1.SmartFake implements _i2.ContactEntry { + _FakeContactEntry_0( Object parent, Invocation parentInvocation, ) : super( @@ -41,46 +41,43 @@ class MockAddressBookService extends _i1.Mock } @override - List<_i2.Contact> get contacts => (super.noSuchMethod( + List<_i2.ContactEntry> get contacts => (super.noSuchMethod( Invocation.getter(#contacts), - returnValue: <_i2.Contact>[], - ) as List<_i2.Contact>); - @override - _i4.Future> get addressBookEntries => (super.noSuchMethod( - Invocation.getter(#addressBookEntries), - returnValue: _i4.Future>.value(<_i2.Contact>[]), - ) as _i4.Future>); + returnValue: <_i2.ContactEntry>[], + ) as List<_i2.ContactEntry>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); @override - _i2.Contact getContactById(String? id) => (super.noSuchMethod( + _i2.ContactEntry getContactById(String? id) => (super.noSuchMethod( Invocation.method( #getContactById, [id], ), - returnValue: _FakeContact_0( + returnValue: _FakeContactEntry_0( this, Invocation.method( #getContactById, [id], ), ), - ) as _i2.Contact); + ) as _i2.ContactEntry); @override - _i4.Future> search(String? text) => (super.noSuchMethod( + _i4.Future> search(String? text) => + (super.noSuchMethod( Invocation.method( #search, [text], ), - returnValue: _i4.Future>.value(<_i2.Contact>[]), - ) as _i4.Future>); + returnValue: + _i4.Future>.value(<_i2.ContactEntry>[]), + ) as _i4.Future>); @override bool matches( String? term, - _i2.Contact? contact, + _i2.ContactEntry? contact, ) => (super.noSuchMethod( Invocation.method( @@ -93,7 +90,7 @@ class MockAddressBookService extends _i1.Mock returnValue: false, ) as bool); @override - _i4.Future addContact(_i2.Contact? contact) => (super.noSuchMethod( + _i4.Future addContact(_i2.ContactEntry? contact) => (super.noSuchMethod( Invocation.method( #addContact, [contact], @@ -101,7 +98,7 @@ class MockAddressBookService extends _i1.Mock returnValue: _i4.Future.value(false), ) as _i4.Future); @override - _i4.Future editContact(_i2.Contact? editedContact) => + _i4.Future editContact(_i2.ContactEntry? editedContact) => (super.noSuchMethod( Invocation.method( #editContact,