diff --git a/assets/svg/icon_filter_arrow_down.svg b/assets/svg/icon_filter_arrow_down.svg new file mode 100644 index 0000000000..b95e332300 --- /dev/null +++ b/assets/svg/icon_filter_arrow_down.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/svg/icon_filter_arrow_up.svg b/assets/svg/icon_filter_arrow_up.svg new file mode 100644 index 0000000000..a2dc80efca --- /dev/null +++ b/assets/svg/icon_filter_arrow_up.svg @@ -0,0 +1,3 @@ + + + diff --git a/drift_schemas/wallets_database/drift_schema_v24.json b/drift_schemas/wallets_database/drift_schema_v24.json new file mode 100644 index 0000000000..302cb744da --- /dev/null +++ b/drift_schemas/wallets_database/drift_schema_v24.json @@ -0,0 +1 @@ +{"_meta":{"description":"This file contains a serialized version of schema entities for drift.","version":"1.2.0"},"options":{"store_date_time_values_as_text":false},"entities":[{"id":0,"references":[],"type":"table","data":{"name":"coins_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"contract_address","getter_name":"contractAddress","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"decimals","getter_name":"decimals","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"icon_u_r_l","getter_name":"iconURL","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"network_id","getter_name":"networkId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"price_u_s_d","getter_name":"priceUSD","moor_type":"double","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"symbol","getter_name":"symbol","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"symbol_group","getter_name":"symbolGroup","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"sync_frequency","getter_name":"syncFrequency","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"native","getter_name":"native","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"native\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"native\" IN (0, 1))"},"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"prioritized","getter_name":"prioritized","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"prioritized\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"prioritized\" IN (0, 1))"},"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"tokenized_community_external_address","getter_name":"tokenizedCommunityExternalAddress","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"tokenized_community_token_type","getter_name":"tokenizedCommunityTokenType","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["id"]}},{"id":1,"references":[],"type":"table","data":{"name":"sync_coins_table","was_declared_in_moor":false,"columns":[{"name":"coin_id","getter_name":"coinId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"sync_after","getter_name":"syncAfter","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["coin_id"]}},{"id":2,"references":[],"type":"table","data":{"name":"networks_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"image","getter_name":"image","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_testnet","getter_name":"isTestnet","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_testnet\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_testnet\" IN (0, 1))"},"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"display_name","getter_name":"displayName","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"explorer_url","getter_name":"explorerUrl","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"tier","getter_name":"tier","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":"const CustomExpression('1')","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["id"]}},{"id":3,"references":[],"type":"table","data":{"name":"transactions_table_v2","was_declared_in_moor":false,"columns":[{"name":"type","getter_name":"type","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"tx_hash","getter_name":"txHash","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"network_id","getter_name":"networkId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"coin_id","getter_name":"coinId","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"memo","getter_name":"memo","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"sender_wallet_address","getter_name":"senderWalletAddress","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"receiver_wallet_address","getter_name":"receiverWalletAddress","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"wallet_view_id","getter_name":"walletViewId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"external_hash","getter_name":"externalHash","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_swap","getter_name":"isSwap","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_swap\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_swap\" IN (0, 1))"},"default_dart":"const CustomExpression('0')","default_client_dart":null,"dsl_features":[]},{"name":"id","getter_name":"id","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"fee","getter_name":"fee","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"native_coin_id","getter_name":"nativeCoinId","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"date_confirmed","getter_name":"dateConfirmed","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const UtcDateTimeConverter()","dart_type_name":"DateTime?"}},{"name":"date_requested","getter_name":"dateRequested","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const UtcDateTimeConverter()","dart_type_name":"DateTime?"}},{"name":"created_at_in_relay","getter_name":"createdAtInRelay","moor_type":"dateTime","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const UtcDateTimeConverter()","dart_type_name":"DateTime?"}},{"name":"user_pubkey","getter_name":"userPubkey","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"asset_id","getter_name":"assetId","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"nft_identifier","getter_name":"nftIdentifier","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"asset_contract_address","getter_name":"assetContractAddress","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"transferred_amount","getter_name":"transferredAmount","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"transferred_amount_usd","getter_name":"transferredAmountUsd","moor_type":"double","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"event_id","getter_name":"eventId","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["tx_hash","wallet_view_id","type"]}},{"id":4,"references":[],"type":"table","data":{"name":"transaction_visibility_status_table","was_declared_in_moor":false,"columns":[{"name":"tx_hash","getter_name":"txHash","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"wallet_view_id","getter_name":"walletViewId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"status","getter_name":"status","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter(TransactionVisibilityStatus.values)","dart_type_name":"TransactionVisibilityStatus"}}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["tx_hash","wallet_view_id"]}},{"id":5,"references":[],"type":"table","data":{"name":"crypto_wallets_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"address","getter_name":"address","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"network_id","getter_name":"networkId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"is_history_loaded","getter_name":"isHistoryLoaded","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"is_history_loaded\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"is_history_loaded\" IN (0, 1))"},"default_dart":"const CustomExpression('0')","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["id"]}},{"id":6,"references":[3],"type":"table","data":{"name":"funds_requests_table","was_declared_in_moor":false,"columns":[{"name":"event_id","getter_name":"eventId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"pubkey","getter_name":"pubkey","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"network_id","getter_name":"networkId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"asset_class","getter_name":"assetClass","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"asset_address","getter_name":"assetAddress","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"from","getter_name":"from","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"to","getter_name":"to","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"wallet_address","getter_name":"walletAddress","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"user_pubkey","getter_name":"userPubkey","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"asset_id","getter_name":"assetId","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"amount","getter_name":"amount","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"amount_usd","getter_name":"amountUsd","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"transaction_id","getter_name":"transactionId","moor_type":"string","nullable":true,"customConstraints":null,"defaultConstraints":"REFERENCES transactions_table_v2 (tx_hash)","dialectAwareDefaultConstraints":{"sqlite":"REFERENCES transactions_table_v2 (tx_hash)"},"default_dart":null,"default_client_dart":null,"dsl_features":[{"foreign_key":{"to":{"table":"transactions_table_v2","column":"tx_hash"},"initially_deferred":false,"on_update":null,"on_delete":null}}]},{"name":"request","getter_name":"request","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"deleted","getter_name":"deleted","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"deleted\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"deleted\" IN (0, 1))"},"default_dart":"const CustomExpression('0')","default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["event_id"]}},{"id":7,"references":[],"type":"table","data":{"name":"nfts_table","was_declared_in_moor":false,"columns":[{"name":"collection_image_uri","getter_name":"collectionImageUri","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"contract","getter_name":"contract","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"description","getter_name":"description","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"kind","getter_name":"kind","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"network_id","getter_name":"networkId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"symbol","getter_name":"symbol","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"token_id","getter_name":"tokenId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"token_uri","getter_name":"tokenUri","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"wallet_id","getter_name":"walletId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"metadata_json","getter_name":"metadataJson","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"created_at","getter_name":"createdAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"updated_at","getter_name":"updatedAt","moor_type":"dateTime","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["contract","token_id","wallet_id"]}}]} \ No newline at end of file diff --git a/lib/app/features/tokenized_communities/enums/tokenized_community_token_type.f.dart b/lib/app/features/tokenized_communities/enums/tokenized_community_token_type.f.dart new file mode 100644 index 0000000000..8c87d9d69f --- /dev/null +++ b/lib/app/features/tokenized_communities/enums/tokenized_community_token_type.f.dart @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: ice License 1.0 + +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'tokenized_community_token_type.f.g.dart'; + +@JsonEnum(alwaysCreate: true) +enum TokenizedCommunityTokenType { + @JsonValue('profile') + tokenTypeProfile, + + @JsonValue('post') + tokenTypePost, + + @JsonValue('article') + tokenTypeArticle, + + @JsonValue('video') + tokenTypeVideo, + + @JsonValue('xcom') + tokenTypeXcom, + + @JsonValue('undefined') + tokenTypeUndefined; + + factory TokenizedCommunityTokenType.fromJson(String json) => + _$TokenizedCommunityTokenTypeEnumMap.map((key, value) => MapEntry(value, key))[json] ?? + TokenizedCommunityTokenType.tokenTypeUndefined; + + String toJson() => _$TokenizedCommunityTokenTypeEnumMap[this]!; +} diff --git a/lib/app/features/tokenized_communities/providers/community_token_trade_notifier_provider.r.dart b/lib/app/features/tokenized_communities/providers/community_token_trade_notifier_provider.r.dart index 922887ccec..be6a24ec26 100644 --- a/lib/app/features/tokenized_communities/providers/community_token_trade_notifier_provider.r.dart +++ b/lib/app/features/tokenized_communities/providers/community_token_trade_notifier_provider.r.dart @@ -321,9 +321,7 @@ class CommunityTokenTradeNotifier extends _$CommunityTokenTradeNotifier { await coinsRepository.updateCoins( [ - coinData.toDB( - isCreatorToken: true, - ), + coinData.toDB(), ], ); diff --git a/lib/app/features/wallets/data/database/tables/coins_table.d.dart b/lib/app/features/wallets/data/database/tables/coins_table.d.dart index 76bc68683f..a556023bb3 100644 --- a/lib/app/features/wallets/data/database/tables/coins_table.d.dart +++ b/lib/app/features/wallets/data/database/tables/coins_table.d.dart @@ -23,7 +23,8 @@ class CoinsTable extends Table { Column get syncFrequency => customType(const DurationType())(); BoolColumn get native => boolean()(); BoolColumn get prioritized => boolean()(); - BoolColumn get isCreatorToken => boolean()(); + TextColumn get tokenizedCommunityExternalAddress => text().nullable()(); + TextColumn get tokenizedCommunityTokenType => text().nullable()(); @override Set get primaryKey => {id}; diff --git a/lib/app/features/wallets/data/database/wallets_database.m.dart b/lib/app/features/wallets/data/database/wallets_database.m.dart index 3b9b5b4f21..101bc48ffe 100644 --- a/lib/app/features/wallets/data/database/wallets_database.m.dart +++ b/lib/app/features/wallets/data/database/wallets_database.m.dart @@ -71,7 +71,7 @@ class WalletsDatabase extends _$WalletsDatabase { final String? appGroupId; @override - int get schemaVersion => 23; + int get schemaVersion => 24; /// Opens a connection to the database with the given pubkey /// Uses app group container for iOS extensions if appGroupId is provided @@ -285,6 +285,40 @@ class WalletsDatabase extends _$WalletsDatabase { ); } }, + from23To24: (Migrator m, Schema24 schema) async { + // Remove deprecated is_creator_token column if present + final isCreatorTokenExists = await isColumnExists( + tableName: schema.coinsTable.actualTableName, + columnName: 'is_creator_token', + ); + if (isCreatorTokenExists) { + await m.dropColumn(schema.coinsTable, 'is_creator_token'); + } + + // Add tokenized_community_external_address column if missing + final tokenizedCommunityExternalAddressExists = await isColumnExists( + tableName: schema.coinsTable.actualTableName, + columnName: 'tokenized_community_external_address', + ); + if (!tokenizedCommunityExternalAddressExists) { + await m.addColumn( + schema.coinsTable, + schema.coinsTable.tokenizedCommunityExternalAddress, + ); + } + + // Add tokenized_community_token_type column if missing + final tokenizedCommunityTokenTypeExists = await isColumnExists( + tableName: schema.coinsTable.actualTableName, + columnName: 'tokenized_community_token_type', + ); + if (!tokenizedCommunityTokenTypeExists) { + await m.addColumn( + schema.coinsTable, + schema.coinsTable.tokenizedCommunityTokenType, + ); + } + }, ), ); } diff --git a/lib/app/features/wallets/data/database/wallets_database.m.steps.dart b/lib/app/features/wallets/data/database/wallets_database.m.steps.dart index ac30703eb5..028966495c 100644 --- a/lib/app/features/wallets/data/database/wallets_database.m.steps.dart +++ b/lib/app/features/wallets/data/database/wallets_database.m.steps.dart @@ -4461,6 +4461,241 @@ i1.GeneratedColumn _column_75(String aliasedName) => type: i1.DriftSqlType.bool, defaultConstraints: i1.GeneratedColumn.constraintIsAlways('CHECK ("is_creator_token" IN (0, 1))')); + +final class Schema24 extends i0.VersionedSchema { + Schema24({required super.database}) : super(version: 24); + @override + late final List entities = [ + coinsTable, + syncCoinsTable, + networksTable, + transactionsTableV2, + transactionVisibilityStatusTable, + cryptoWalletsTable, + fundsRequestsTable, + nftsTable, + ]; + late final Shape23 coinsTable = Shape23( + source: i0.VersionedTable( + entityName: 'coins_table', + withoutRowId: false, + isStrict: false, + tableConstraints: [ + 'PRIMARY KEY(id)', + ], + columns: [ + _column_0, + _column_1, + _column_2, + _column_3, + _column_4, + _column_5, + _column_6, + _column_7, + _column_8, + _column_9, + _column_54, + _column_57, + _column_76, + _column_77, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape1 syncCoinsTable = Shape1( + source: i0.VersionedTable( + entityName: 'sync_coins_table', + withoutRowId: false, + isStrict: false, + tableConstraints: [ + 'PRIMARY KEY(coin_id)', + ], + columns: [ + _column_10, + _column_11, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape6 networksTable = Shape6( + source: i0.VersionedTable( + entityName: 'networks_table', + withoutRowId: false, + isStrict: false, + tableConstraints: [ + 'PRIMARY KEY(id)', + ], + columns: [ + _column_0, + _column_12, + _column_13, + _column_14, + _column_15, + _column_47, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape21 transactionsTableV2 = Shape21( + source: i0.VersionedTable( + entityName: 'transactions_table_v2', + withoutRowId: false, + isStrict: false, + tableConstraints: [ + 'PRIMARY KEY(tx_hash, wallet_view_id, type)', + ], + columns: [ + _column_16, + _column_17, + _column_5, + _column_18, + _column_72, + _column_49, + _column_50, + _column_51, + _column_58, + _column_74, + _column_21, + _column_22, + _column_23, + _column_24, + _column_25, + _column_26, + _column_27, + _column_28, + _column_29, + _column_62, + _column_73, + _column_30, + _column_31, + _column_52, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape16 transactionVisibilityStatusTable = Shape16( + source: i0.VersionedTable( + entityName: 'transaction_visibility_status_table', + withoutRowId: false, + isStrict: false, + tableConstraints: [ + 'PRIMARY KEY(tx_hash, wallet_view_id)', + ], + columns: [ + _column_17, + _column_51, + _column_61, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape4 cryptoWalletsTable = Shape4( + source: i0.VersionedTable( + entityName: 'crypto_wallets_table', + withoutRowId: false, + isStrict: false, + tableConstraints: [ + 'PRIMARY KEY(id)', + ], + columns: [ + _column_0, + _column_33, + _column_5, + _column_34, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape15 fundsRequestsTable = Shape15( + source: i0.VersionedTable( + entityName: 'funds_requests_table', + withoutRowId: false, + isStrict: false, + tableConstraints: [ + 'PRIMARY KEY(event_id)', + ], + columns: [ + _column_35, + _column_36, + _column_59, + _column_5, + _column_38, + _column_39, + _column_40, + _column_41, + _column_42, + _column_28, + _column_29, + _column_43, + _column_44, + _column_53, + _column_46, + _column_60, + ], + attachedDatabase: database, + ), + alias: null); + late final Shape18 nftsTable = Shape18( + source: i0.VersionedTable( + entityName: 'nfts_table', + withoutRowId: false, + isStrict: false, + tableConstraints: [ + 'PRIMARY KEY(contract, token_id, wallet_id)', + ], + columns: [ + _column_63, + _column_64, + _column_65, + _column_66, + _column_4, + _column_5, + _column_7, + _column_67, + _column_68, + _column_69, + _column_70, + _column_37, + _column_71, + ], + attachedDatabase: database, + ), + alias: null); +} + +class Shape23 extends i0.VersionedTable { + Shape23({required super.source, required super.alias}) : super.aliased(); + i1.GeneratedColumn get id => columnsByName['id']! as i1.GeneratedColumn; + i1.GeneratedColumn get contractAddress => + columnsByName['contract_address']! as i1.GeneratedColumn; + i1.GeneratedColumn get decimals => columnsByName['decimals']! as i1.GeneratedColumn; + i1.GeneratedColumn get iconURL => + columnsByName['icon_u_r_l']! as i1.GeneratedColumn; + i1.GeneratedColumn get name => columnsByName['name']! as i1.GeneratedColumn; + i1.GeneratedColumn get networkId => + columnsByName['network_id']! as i1.GeneratedColumn; + i1.GeneratedColumn get priceUSD => + columnsByName['price_u_s_d']! as i1.GeneratedColumn; + i1.GeneratedColumn get symbol => columnsByName['symbol']! as i1.GeneratedColumn; + i1.GeneratedColumn get symbolGroup => + columnsByName['symbol_group']! as i1.GeneratedColumn; + i1.GeneratedColumn get syncFrequency => + columnsByName['sync_frequency']! as i1.GeneratedColumn; + i1.GeneratedColumn get native => columnsByName['native']! as i1.GeneratedColumn; + i1.GeneratedColumn get prioritized => + columnsByName['prioritized']! as i1.GeneratedColumn; + i1.GeneratedColumn get tokenizedCommunityExternalAddress => + columnsByName['tokenized_community_external_address']! as i1.GeneratedColumn; + i1.GeneratedColumn get tokenizedCommunityTokenType => + columnsByName['tokenized_community_token_type']! as i1.GeneratedColumn; +} + +i1.GeneratedColumn _column_76(String aliasedName) => + i1.GeneratedColumn('tokenized_community_external_address', aliasedName, true, + type: i1.DriftSqlType.string); +i1.GeneratedColumn _column_77(String aliasedName) => + i1.GeneratedColumn('tokenized_community_token_type', aliasedName, true, + type: i1.DriftSqlType.string); i0.MigrationStepWithVersion migrationSteps({ required Future Function(i1.Migrator m, Schema2 schema) from1To2, required Future Function(i1.Migrator m, Schema3 schema) from2To3, @@ -4484,6 +4719,7 @@ i0.MigrationStepWithVersion migrationSteps({ required Future Function(i1.Migrator m, Schema21 schema) from20To21, required Future Function(i1.Migrator m, Schema22 schema) from21To22, required Future Function(i1.Migrator m, Schema23 schema) from22To23, + required Future Function(i1.Migrator m, Schema24 schema) from23To24, }) { return (currentVersion, database) async { switch (currentVersion) { @@ -4597,6 +4833,11 @@ i0.MigrationStepWithVersion migrationSteps({ final migrator = i1.Migrator(database, schema); await from22To23(migrator, schema); return 23; + case 23: + final schema = Schema24(database: database); + final migrator = i1.Migrator(database, schema); + await from23To24(migrator, schema); + return 24; default: throw ArgumentError.value('Unknown migration from $currentVersion'); } @@ -4626,6 +4867,7 @@ i1.OnUpgrade stepByStep({ required Future Function(i1.Migrator m, Schema21 schema) from20To21, required Future Function(i1.Migrator m, Schema22 schema) from21To22, required Future Function(i1.Migrator m, Schema23 schema) from22To23, + required Future Function(i1.Migrator m, Schema24 schema) from23To24, }) => i0.VersionedSchema.stepByStepHelper( step: migrationSteps( @@ -4651,4 +4893,5 @@ i1.OnUpgrade stepByStep({ from20To21: from20To21, from21To22: from21To22, from22To23: from22To23, + from23To24: from23To24, )); diff --git a/lib/app/features/wallets/domain/coins/coins_mapper.dart b/lib/app/features/wallets/domain/coins/coins_mapper.dart index 1e2ca88d6d..05140e5614 100644 --- a/lib/app/features/wallets/domain/coins/coins_mapper.dart +++ b/lib/app/features/wallets/domain/coins/coins_mapper.dart @@ -19,7 +19,8 @@ class CoinsMapper { syncFrequency: coin.syncFrequency, native: coin.native ?? false, prioritized: coin.prioritized ?? false, - isCreatorToken: false, + tokenizedCommunityExternalAddress: coin.tokenizedCommunityExternalAddress, + tokenizedCommunityTokenType: coin.tokenizedCommunityTokenType, ), ]; } diff --git a/lib/app/features/wallets/model/coin_data.f.dart b/lib/app/features/wallets/model/coin_data.f.dart index 79d7f01175..d887db6750 100644 --- a/lib/app/features/wallets/model/coin_data.f.dart +++ b/lib/app/features/wallets/model/coin_data.f.dart @@ -1,6 +1,7 @@ // SPDX-License-Identifier: ice License 1.0 import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:ion/app/features/tokenized_communities/enums/tokenized_community_token_type.f.dart'; import 'package:ion/app/features/wallets/data/database/wallets_database.m.dart' as db; import 'package:ion/app/features/wallets/model/network_data.f.dart'; import 'package:ion_identity_client/ion_identity.dart' as ion; @@ -23,7 +24,8 @@ class CoinData with _$CoinData { required Duration syncFrequency, @Default(false) bool native, @Default(false) bool prioritized, - @Default(false) bool isCreatorToken, + String? tokenizedCommunityExternalAddress, + TokenizedCommunityTokenType? tokenizedCommunityTokenType, }) = _CoinData; factory CoinData.fromDB(db.Coin coin, NetworkData network) { @@ -40,7 +42,10 @@ class CoinData with _$CoinData { syncFrequency: coin.syncFrequency, native: coin.native, prioritized: coin.prioritized, - isCreatorToken: coin.isCreatorToken, + tokenizedCommunityExternalAddress: coin.tokenizedCommunityExternalAddress, + tokenizedCommunityTokenType: coin.tokenizedCommunityTokenType != null + ? TokenizedCommunityTokenType.fromJson(coin.tokenizedCommunityTokenType!) + : null, ); } @@ -58,15 +63,16 @@ class CoinData with _$CoinData { syncFrequency: coin.syncFrequency, native: coin.native ?? false, prioritized: coin.prioritized ?? false, + tokenizedCommunityExternalAddress: coin.tokenizedCommunityExternalAddress, + tokenizedCommunityTokenType: coin.tokenizedCommunityTokenType != null + ? TokenizedCommunityTokenType.fromJson(coin.tokenizedCommunityTokenType!) + : null, ); } const CoinData._(); - db.Coin toDB({ - bool? isCreatorToken, - }) => - db.Coin( + db.Coin toDB() => db.Coin( id: id, contractAddress: contractAddress, decimals: decimals, @@ -79,7 +85,8 @@ class CoinData with _$CoinData { syncFrequency: syncFrequency, native: native, prioritized: prioritized, - isCreatorToken: isCreatorToken ?? this.isCreatorToken, + tokenizedCommunityExternalAddress: tokenizedCommunityExternalAddress, + tokenizedCommunityTokenType: tokenizedCommunityTokenType?.toJson(), ); bool get isValid => diff --git a/lib/app/features/wallets/views/pages/wallet_page.dart b/lib/app/features/wallets/views/pages/wallet_page.dart index 8c2ffce815..26fe766d4e 100644 --- a/lib/app/features/wallets/views/pages/wallet_page.dart +++ b/lib/app/features/wallets/views/pages/wallet_page.dart @@ -20,6 +20,7 @@ import 'package:ion/app/features/wallets/providers/wallet_data_sync_coordinator_ import 'package:ion/app/features/wallets/views/pages/wallet_page/components/balance/balance.dart'; import 'package:ion/app/features/wallets/views/pages/wallet_page/components/coins/coins_tab.dart'; import 'package:ion/app/features/wallets/views/pages/wallet_page/components/coins/coins_tab_header.dart'; +import 'package:ion/app/features/wallets/views/pages/wallet_page/components/coins/wallet_coins_filter_bar.dart'; import 'package:ion/app/features/wallets/views/pages/wallet_page/components/friends/friends_list.dart'; import 'package:ion/app/features/wallets/views/pages/wallet_page/components/header/wallet_header.dart'; import 'package:ion/app/features/wallets/views/pages/wallet_page/components/nfts/nfts_tab.dart'; @@ -106,9 +107,12 @@ class WalletPage extends HookConsumerWidget { ), ), ...switch (activeTab.value) { - WalletTabType.coins => const [ - CoinsTabHeader(tabType: WalletTabType.coins), - CoinsTab(tabType: WalletTabType.coins), + WalletTabType.coins => [ + const CoinsTabHeader(tabType: WalletTabType.coins), + SliverToBoxAdapter( + child: WalletCoinsFilterBar(scrollController: scrollController), + ), + const CoinsTab(tabType: WalletTabType.coins), ], WalletTabType.nfts => const [ SliverToBoxAdapter( @@ -116,10 +120,6 @@ class WalletPage extends HookConsumerWidget { ), NftsTab(), ], - WalletTabType.creatorTokens => const [ - CoinsTabHeader(tabType: WalletTabType.creatorTokens), - CoinsTab(tabType: WalletTabType.creatorTokens), - ], }, ], onRefresh: () async { diff --git a/lib/app/features/wallets/views/pages/wallet_page/components/balance/balance.dart b/lib/app/features/wallets/views/pages/wallet_page/components/balance/balance.dart index 9343cb8bf7..fcafb7cacc 100644 --- a/lib/app/features/wallets/views/pages/wallet_page/components/balance/balance.dart +++ b/lib/app/features/wallets/views/pages/wallet_page/components/balance/balance.dart @@ -79,8 +79,6 @@ class Balance extends ConsumerWidget { SelectNetworkToReceiveNftRoute().push(ref.context); case WalletTabType.coins: ReceiveCoinRoute().push(context); - case WalletTabType.creatorTokens: - ReceiveCoinRoute().push(context); } }, onMore: () { diff --git a/lib/app/features/wallets/views/pages/wallet_page/components/coins/coins_tab.dart b/lib/app/features/wallets/views/pages/wallet_page/components/coins/coins_tab.dart index 52ab062cf7..1091769be3 100644 --- a/lib/app/features/wallets/views/pages/wallet_page/components/coins/coins_tab.dart +++ b/lib/app/features/wallets/views/pages/wallet_page/components/coins/coins_tab.dart @@ -5,12 +5,15 @@ import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:ion/app/components/screen_offset/screen_side_offset.dart'; import 'package:ion/app/extensions/extensions.dart'; import 'package:ion/app/extensions/num.dart'; +import 'package:ion/app/features/tokenized_communities/enums/tokenized_community_token_type.f.dart'; +import 'package:ion/app/features/user/pages/creator_tokens/models/token_type_filter.dart'; import 'package:ion/app/features/wallets/data/database/dao/transactions_visibility_status_dao.m.dart'; import 'package:ion/app/features/wallets/providers/filtered_assets_provider.r.dart'; import 'package:ion/app/features/wallets/views/components/coins_list/coin_item.dart'; import 'package:ion/app/features/wallets/views/pages/manage_coins/providers/manage_coins_provider.r.dart'; import 'package:ion/app/features/wallets/views/pages/wallet_page/components/coins/coins_tab_footer.dart'; import 'package:ion/app/features/wallets/views/pages/wallet_page/components/empty_state/empty_state.dart'; +import 'package:ion/app/features/wallets/views/pages/wallet_page/providers/wallet_coins_filter_provider.r.dart'; import 'package:ion/app/features/wallets/views/pages/wallet_page/providers/wallet_page_loader_provider.r.dart'; import 'package:ion/app/features/wallets/views/pages/wallet_page/tab_type.dart'; import 'package:ion/app/router/app_routes.gr.dart'; @@ -35,9 +38,30 @@ class CoinsTab extends ConsumerWidget { } final groups = ref.watch(filteredCoinsNotifierProvider.select((state) => state.valueOrNull)); - final isCreatorTokensTab = tabType == WalletTabType.creatorTokens; + final selectedFilter = ref.watch(walletCoinsFilterNotifierProvider); + final filteredGroups = groups?.where((group) { - return group.coins.any((coin) => coin.coin.isCreatorToken == isCreatorTokensTab); + if (selectedFilter == TokenTypeFilter.all) { + return true; + } + return group.coins.any((coinInWallet) { + final coin = coinInWallet.coin; + final tokenType = coin.tokenizedCommunityTokenType; + + if (tokenType == null) { + // Regular coin - only matches "all" filter + return selectedFilter == TokenTypeFilter.all; + } + + return switch (selectedFilter) { + TokenTypeFilter.all => true, + TokenTypeFilter.creator => tokenType == TokenizedCommunityTokenType.tokenTypeProfile, + TokenTypeFilter.content => tokenType == TokenizedCommunityTokenType.tokenTypePost || + tokenType == TokenizedCommunityTokenType.tokenTypeArticle || + tokenType == TokenizedCommunityTokenType.tokenTypeVideo, + TokenTypeFilter.x => tokenType == TokenizedCommunityTokenType.tokenTypeXcom, + }; + }); }).toList(); if (filteredGroups == null || filteredGroups.isEmpty) { diff --git a/lib/app/features/wallets/views/pages/wallet_page/components/coins/wallet_coins_filter_bar.dart b/lib/app/features/wallets/views/pages/wallet_page/components/coins/wallet_coins_filter_bar.dart new file mode 100644 index 0000000000..5d3dab5d4e --- /dev/null +++ b/lib/app/features/wallets/views/pages/wallet_page/components/coins/wallet_coins_filter_bar.dart @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: ice License 1.0 + +import 'package:flutter/material.dart'; +import 'package:ion/app/components/screen_offset/screen_side_offset.dart'; +import 'package:ion/app/extensions/extensions.dart'; +import 'package:ion/app/features/wallets/views/pages/wallet_page/components/coins/wallet_coins_filter_dropdown.dart'; +import 'package:ion/generated/assets.gen.dart'; + +class WalletCoinsFilterBar extends StatelessWidget { + const WalletCoinsFilterBar({ + this.scrollController, + super.key, + }); + + final ScrollController? scrollController; + + @override + Widget build(BuildContext context) { + final colors = context.theme.appColors; + final textStyles = context.theme.appTextThemes; + + return ScreenSideOffset.small( + child: Padding( + padding: EdgeInsets.symmetric(vertical: 12.0.s), + child: Row( + children: [ + Assets.svg.iconFilter.icon( + color: colors.onTertiaryBackground, + size: 16.0.s, + ), + SizedBox(width: 6.0.s), + Text( + context.i18n.creator_tokens_filter_title, + style: textStyles.subtitle3.copyWith( + color: colors.onTertiaryBackground, + ), + ), + const Spacer(), + WalletCoinsFilterDropdown(scrollController: scrollController), + ], + ), + ), + ); + } +} diff --git a/lib/app/features/wallets/views/pages/wallet_page/components/coins/wallet_coins_filter_dropdown.dart b/lib/app/features/wallets/views/pages/wallet_page/components/coins/wallet_coins_filter_dropdown.dart new file mode 100644 index 0000000000..c515b7832f --- /dev/null +++ b/lib/app/features/wallets/views/pages/wallet_page/components/coins/wallet_coins_filter_dropdown.dart @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: ice License 1.0 + +import 'package:flutter/material.dart'; +import 'package:flutter_hooks/flutter_hooks.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:ion/app/components/overlay_menu/overlay_menu.dart'; +import 'package:ion/app/extensions/extensions.dart'; +import 'package:ion/app/features/wallets/views/pages/wallet_page/components/coins/wallet_coins_filter_menu.dart'; +import 'package:ion/app/features/wallets/views/pages/wallet_page/providers/wallet_coins_filter_provider.r.dart'; +import 'package:ion/generated/assets.gen.dart'; + +class WalletCoinsFilterDropdown extends HookWidget { + const WalletCoinsFilterDropdown({ + this.scrollController, + super.key, + }); + + final ScrollController? scrollController; + + @override + Widget build(BuildContext context) { + final opened = useState(false); + + return OverlayMenu( + scrollController: scrollController, + onOpen: () => opened.value = true, + onClose: () => opened.value = false, + menuBuilder: (closeMenu) => WalletCoinsFilterMenu(closeMenu: closeMenu), + child: _DropdownButton(opened: opened.value), + ); + } +} + +class _DropdownButton extends ConsumerWidget { + const _DropdownButton({required this.opened}); + + final bool opened; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final selectedFilter = ref.watch(walletCoinsFilterNotifierProvider); + final colors = context.theme.appColors; + final textStyles = context.theme.appTextThemes; + + return ConstrainedBox( + constraints: BoxConstraints(minWidth: 140.0.s), + child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text( + selectedFilter.getLabel(context), + style: textStyles.subtitle3.copyWith( + color: colors.onTertiaryBackground, + ), + ), + SizedBox(width: 4.0.s), + (opened ? Assets.svg.iconFilterArrowDown : Assets.svg.iconFilterArrowUp).icon( + color: colors.onTertiaryBackground, + size: 16.0.s, + ), + ], + ), + ); + } +} diff --git a/lib/app/features/wallets/views/pages/wallet_page/components/coins/wallet_coins_filter_menu.dart b/lib/app/features/wallets/views/pages/wallet_page/components/coins/wallet_coins_filter_menu.dart new file mode 100644 index 0000000000..48a1decf53 --- /dev/null +++ b/lib/app/features/wallets/views/pages/wallet_page/components/coins/wallet_coins_filter_menu.dart @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: ice License 1.0 + +import 'package:flutter/material.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:ion/app/components/overlay_menu/overlay_menu_container.dart'; +import 'package:ion/app/components/separated/separated_column.dart'; +import 'package:ion/app/components/separated/separator.dart'; +import 'package:ion/app/extensions/extensions.dart'; +import 'package:ion/app/features/user/pages/creator_tokens/models/token_type_filter.dart'; +import 'package:ion/app/features/wallets/views/pages/wallet_page/providers/wallet_coins_filter_provider.r.dart'; + +class WalletCoinsFilterMenu extends ConsumerWidget { + const WalletCoinsFilterMenu({ + required this.closeMenu, + super.key, + }); + + final VoidCallback closeMenu; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final selectedFilter = ref.watch(walletCoinsFilterNotifierProvider); + + return OverlayMenuContainer( + child: ConstrainedBox( + constraints: BoxConstraints(minWidth: 140.0.s), + child: SeparatedColumn( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + separator: const HorizontalSeparator(), + children: [ + for (final filter in TokenTypeFilter.values) + _TokenTypeFilterItem( + filter: filter, + isSelected: selectedFilter == filter, + closeMenu: closeMenu, + ), + ], + ), + ), + ); + } +} + +class _TokenTypeFilterItem extends ConsumerWidget { + const _TokenTypeFilterItem({ + required this.filter, + required this.isSelected, + required this.closeMenu, + }); + + final TokenTypeFilter filter; + final bool isSelected; + final VoidCallback closeMenu; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final colors = context.theme.appColors; + final textStyles = context.theme.appTextThemes; + + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + ref.read(walletCoinsFilterNotifierProvider.notifier).filter = filter; + closeMenu(); + }, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 16.0.s, vertical: 12.0.s), + child: Text( + filter.getLabel(context), + style: textStyles.subtitle3.copyWith( + color: colors.primaryText, + ), + overflow: TextOverflow.ellipsis, + ), + ), + ); + } +} diff --git a/lib/app/features/wallets/views/pages/wallet_page/components/tabs/tabs_header.dart b/lib/app/features/wallets/views/pages/wallet_page/components/tabs/tabs_header.dart index 4c2102e2d7..0d1bb9b08b 100644 --- a/lib/app/features/wallets/views/pages/wallet_page/components/tabs/tabs_header.dart +++ b/lib/app/features/wallets/views/pages/wallet_page/components/tabs/tabs_header.dart @@ -70,11 +70,6 @@ class WalletTabsHeader extends ConsumerWidget { onTap: () => DAppsRoute().push(context), ), ], - WalletTabsHeaderTab( - isActive: activeTab == WalletTabType.creatorTokens, - title: context.i18n.general_creator_tokens, - onTap: () => onTabSwitch(WalletTabType.creatorTokens), - ), const Spacer(), TextButton( onPressed: () { diff --git a/lib/app/features/wallets/views/pages/wallet_page/providers/wallet_coins_filter_provider.r.dart b/lib/app/features/wallets/views/pages/wallet_page/providers/wallet_coins_filter_provider.r.dart new file mode 100644 index 0000000000..ea930516ce --- /dev/null +++ b/lib/app/features/wallets/views/pages/wallet_page/providers/wallet_coins_filter_provider.r.dart @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: ice License 1.0 + +import 'package:ion/app/features/user/pages/creator_tokens/models/token_type_filter.dart'; +import 'package:riverpod_annotation/riverpod_annotation.dart'; + +part 'wallet_coins_filter_provider.r.g.dart'; + +@riverpod +class WalletCoinsFilterNotifier extends _$WalletCoinsFilterNotifier { + @override + TokenTypeFilter build() => TokenTypeFilter.all; + + set filter(TokenTypeFilter value) { + state = value; + } +} diff --git a/lib/app/features/wallets/views/pages/wallet_page/tab_type.dart b/lib/app/features/wallets/views/pages/wallet_page/tab_type.dart index 0c4ed973bb..3ad73be527 100644 --- a/lib/app/features/wallets/views/pages/wallet_page/tab_type.dart +++ b/lib/app/features/wallets/views/pages/wallet_page/tab_type.dart @@ -7,14 +7,12 @@ import 'package:ion/generated/assets.gen.dart'; enum WalletTabType { coins, - creatorTokens, nfts; CryptoAssetType get walletAssetType { return switch (this) { WalletTabType.coins => CryptoAssetType.coin, WalletTabType.nfts => CryptoAssetType.nft, - WalletTabType.creatorTokens => CryptoAssetType.coin, }; } @@ -22,7 +20,6 @@ enum WalletTabType { return switch (this) { WalletTabType.coins => Assets.svg.walletIconWalletEmptycoins, WalletTabType.nfts => Assets.svg.categoriesNft, - WalletTabType.creatorTokens => Assets.svg.walletIconWalletEmptycoins, }; } @@ -30,7 +27,6 @@ enum WalletTabType { return switch (this) { WalletTabType.coins => Assets.svg.iconButtonManagecoin, WalletTabType.nfts => Assets.svg.iconPostAddanswer, - WalletTabType.creatorTokens => Assets.svg.iconButtonManagecoin, }; } @@ -38,7 +34,6 @@ enum WalletTabType { return switch (this) { WalletTabType.coins => context.i18n.wallet_empty_coins, WalletTabType.nfts => context.i18n.wallet_empty_nfts, - WalletTabType.creatorTokens => context.i18n.wallet_empty_coins, }; } @@ -46,7 +41,6 @@ enum WalletTabType { return switch (this) { WalletTabType.coins => context.i18n.wallet_manage_coins, WalletTabType.nfts => context.i18n.wallet_receive_nft, - WalletTabType.creatorTokens => context.i18n.wallet_manage_coins, }; } @@ -56,8 +50,6 @@ enum WalletTabType { return context.i18n.core_coins; case WalletTabType.nfts: return context.i18n.core_nfts; - case WalletTabType.creatorTokens: - return context.i18n.general_creator_tokens; } } } diff --git a/packages/ion_identity_client/lib/src/coins/models/coin.f.dart b/packages/ion_identity_client/lib/src/coins/models/coin.f.dart index 1263401e62..cb613c436b 100644 --- a/packages/ion_identity_client/lib/src/coins/models/coin.f.dart +++ b/packages/ion_identity_client/lib/src/coins/models/coin.f.dart @@ -20,6 +20,8 @@ class Coin with _$Coin { @SyncFrequencyConverter() required Duration syncFrequency, @Default(false) bool? native, @Default(false) bool? prioritized, + String? tokenizedCommunityExternalAddress, + String? tokenizedCommunityTokenType, }) = _Coin; factory Coin.fromJson(Map json) => _$CoinFromJson(json); diff --git a/packages/ion_identity_client/lib/src/coins/models/coin.f.freezed.dart b/packages/ion_identity_client/lib/src/coins/models/coin.f.freezed.dart index 20e3d047c5..db2f1af796 100644 --- a/packages/ion_identity_client/lib/src/coins/models/coin.f.freezed.dart +++ b/packages/ion_identity_client/lib/src/coins/models/coin.f.freezed.dart @@ -33,6 +33,9 @@ mixin _$Coin { Duration get syncFrequency => throw _privateConstructorUsedError; bool? get native => throw _privateConstructorUsedError; bool? get prioritized => throw _privateConstructorUsedError; + String? get tokenizedCommunityExternalAddress => + throw _privateConstructorUsedError; + String? get tokenizedCommunityTokenType => throw _privateConstructorUsedError; /// Serializes this Coin to a JSON map. Map toJson() => throw _privateConstructorUsedError; @@ -60,7 +63,9 @@ abstract class $CoinCopyWith<$Res> { String symbolGroup, @SyncFrequencyConverter() Duration syncFrequency, bool? native, - bool? prioritized}); + bool? prioritized, + String? tokenizedCommunityExternalAddress, + String? tokenizedCommunityTokenType}); } /// @nodoc @@ -90,6 +95,8 @@ class _$CoinCopyWithImpl<$Res, $Val extends Coin> Object? syncFrequency = null, Object? native = freezed, Object? prioritized = freezed, + Object? tokenizedCommunityExternalAddress = freezed, + Object? tokenizedCommunityTokenType = freezed, }) { return _then(_value.copyWith( contractAddress: null == contractAddress @@ -140,6 +147,15 @@ class _$CoinCopyWithImpl<$Res, $Val extends Coin> ? _value.prioritized : prioritized // ignore: cast_nullable_to_non_nullable as bool?, + tokenizedCommunityExternalAddress: freezed == + tokenizedCommunityExternalAddress + ? _value.tokenizedCommunityExternalAddress + : tokenizedCommunityExternalAddress // ignore: cast_nullable_to_non_nullable + as String?, + tokenizedCommunityTokenType: freezed == tokenizedCommunityTokenType + ? _value.tokenizedCommunityTokenType + : tokenizedCommunityTokenType // ignore: cast_nullable_to_non_nullable + as String?, ) as $Val); } } @@ -163,7 +179,9 @@ abstract class _$$CoinImplCopyWith<$Res> implements $CoinCopyWith<$Res> { String symbolGroup, @SyncFrequencyConverter() Duration syncFrequency, bool? native, - bool? prioritized}); + bool? prioritized, + String? tokenizedCommunityExternalAddress, + String? tokenizedCommunityTokenType}); } /// @nodoc @@ -190,6 +208,8 @@ class __$$CoinImplCopyWithImpl<$Res> Object? syncFrequency = null, Object? native = freezed, Object? prioritized = freezed, + Object? tokenizedCommunityExternalAddress = freezed, + Object? tokenizedCommunityTokenType = freezed, }) { return _then(_$CoinImpl( contractAddress: null == contractAddress @@ -240,6 +260,15 @@ class __$$CoinImplCopyWithImpl<$Res> ? _value.prioritized : prioritized // ignore: cast_nullable_to_non_nullable as bool?, + tokenizedCommunityExternalAddress: freezed == + tokenizedCommunityExternalAddress + ? _value.tokenizedCommunityExternalAddress + : tokenizedCommunityExternalAddress // ignore: cast_nullable_to_non_nullable + as String?, + tokenizedCommunityTokenType: freezed == tokenizedCommunityTokenType + ? _value.tokenizedCommunityTokenType + : tokenizedCommunityTokenType // ignore: cast_nullable_to_non_nullable + as String?, )); } } @@ -259,7 +288,9 @@ class _$CoinImpl implements _Coin { required this.symbolGroup, @SyncFrequencyConverter() required this.syncFrequency, this.native = false, - this.prioritized = false}); + this.prioritized = false, + this.tokenizedCommunityExternalAddress, + this.tokenizedCommunityTokenType}); factory _$CoinImpl.fromJson(Map json) => _$$CoinImplFromJson(json); @@ -291,10 +322,14 @@ class _$CoinImpl implements _Coin { @override @JsonKey() final bool? prioritized; + @override + final String? tokenizedCommunityExternalAddress; + @override + final String? tokenizedCommunityTokenType; @override String toString() { - return 'Coin(contractAddress: $contractAddress, decimals: $decimals, iconURL: $iconURL, id: $id, name: $name, network: $network, priceUSD: $priceUSD, symbol: $symbol, symbolGroup: $symbolGroup, syncFrequency: $syncFrequency, native: $native, prioritized: $prioritized)'; + return 'Coin(contractAddress: $contractAddress, decimals: $decimals, iconURL: $iconURL, id: $id, name: $name, network: $network, priceUSD: $priceUSD, symbol: $symbol, symbolGroup: $symbolGroup, syncFrequency: $syncFrequency, native: $native, prioritized: $prioritized, tokenizedCommunityExternalAddress: $tokenizedCommunityExternalAddress, tokenizedCommunityTokenType: $tokenizedCommunityTokenType)'; } @override @@ -319,7 +354,15 @@ class _$CoinImpl implements _Coin { other.syncFrequency == syncFrequency) && (identical(other.native, native) || other.native == native) && (identical(other.prioritized, prioritized) || - other.prioritized == prioritized)); + other.prioritized == prioritized) && + (identical(other.tokenizedCommunityExternalAddress, + tokenizedCommunityExternalAddress) || + other.tokenizedCommunityExternalAddress == + tokenizedCommunityExternalAddress) && + (identical(other.tokenizedCommunityTokenType, + tokenizedCommunityTokenType) || + other.tokenizedCommunityTokenType == + tokenizedCommunityTokenType)); } @JsonKey(includeFromJson: false, includeToJson: false) @@ -337,7 +380,9 @@ class _$CoinImpl implements _Coin { symbolGroup, syncFrequency, native, - prioritized); + prioritized, + tokenizedCommunityExternalAddress, + tokenizedCommunityTokenType); /// Create a copy of Coin /// with the given fields replaced by the non-null parameter values. @@ -368,7 +413,9 @@ abstract class _Coin implements Coin { required final String symbolGroup, @SyncFrequencyConverter() required final Duration syncFrequency, final bool? native, - final bool? prioritized}) = _$CoinImpl; + final bool? prioritized, + final String? tokenizedCommunityExternalAddress, + final String? tokenizedCommunityTokenType}) = _$CoinImpl; factory _Coin.fromJson(Map json) = _$CoinImpl.fromJson; @@ -397,6 +444,10 @@ abstract class _Coin implements Coin { bool? get native; @override bool? get prioritized; + @override + String? get tokenizedCommunityExternalAddress; + @override + String? get tokenizedCommunityTokenType; /// Create a copy of Coin /// with the given fields replaced by the non-null parameter values. diff --git a/packages/ion_identity_client/lib/src/coins/models/coin.f.g.dart b/packages/ion_identity_client/lib/src/coins/models/coin.f.g.dart index dfbca50b86..3c1895735a 100644 --- a/packages/ion_identity_client/lib/src/coins/models/coin.f.g.dart +++ b/packages/ion_identity_client/lib/src/coins/models/coin.f.g.dart @@ -20,6 +20,10 @@ _$CoinImpl _$$CoinImplFromJson(Map json) => _$CoinImpl( .fromJson((json['syncFrequency'] as num).toInt()), native: json['native'] as bool? ?? false, prioritized: json['prioritized'] as bool? ?? false, + tokenizedCommunityExternalAddress: + json['tokenizedCommunityExternalAddress'] as String?, + tokenizedCommunityTokenType: + json['tokenizedCommunityTokenType'] as String?, ); Map _$$CoinImplToJson(_$CoinImpl instance) => @@ -37,4 +41,8 @@ Map _$$CoinImplToJson(_$CoinImpl instance) => const SyncFrequencyConverter().toJson(instance.syncFrequency), if (instance.native case final value?) 'native': value, if (instance.prioritized case final value?) 'prioritized': value, + if (instance.tokenizedCommunityExternalAddress case final value?) + 'tokenizedCommunityExternalAddress': value, + if (instance.tokenizedCommunityTokenType case final value?) + 'tokenizedCommunityTokenType': value, };