see all token transaction navigation fix

This commit is contained in:
julian 2024-01-13 12:03:54 -06:00
parent 5aea7b3e85
commit 94d1698fd7
5 changed files with 62 additions and 22 deletions

View file

@ -189,7 +189,11 @@ class _TokenViewState extends ConsumerState<TokenView> {
AllTransactionsV2View.routeName, AllTransactionsV2View.routeName,
arguments: ( arguments: (
walletId: widget.walletId, walletId: widget.walletId,
isTokens: true, contractAddress: ref.watch(
pCurrentTokenWallet.select(
(value) => value!.tokenContract.address,
),
),
), ),
); );
}, },

View file

@ -494,10 +494,19 @@ class _TransactionDetailsViewState extends ConsumerState<AllTransactionsView> {
) )
], ],
// TODO: [prio=med] add filters to wallet or cryptocurrency class // TODO: [prio=med] add filters to wallet or cryptocurrency class
// Might not be needed (yet)? // eth tokens should all be on v2 txn now so this should not be needed here
// filter: [ // filter: widget.contractAddress != null
// // todo // ? FilterGroup.and([
// ], // FilterCondition.equalTo(
// property: r"contractAddress",
// value: widget.contractAddress!,
// ),
// const FilterCondition.equalTo(
// property: r"subType",
// value: TransactionSubType.ethToken,
// ),
// ])
// : null,
sortBy: [ sortBy: [
const SortProperty( const SortProperty(
property: "timestamp", property: "timestamp",

View file

@ -59,11 +59,13 @@ class AllTransactionsV2View extends ConsumerStatefulWidget {
const AllTransactionsV2View({ const AllTransactionsV2View({
Key? key, Key? key,
required this.walletId, required this.walletId,
this.contractAddress,
}) : super(key: key); }) : super(key: key);
static const String routeName = "/allTransactionsV2"; static const String routeName = "/allTransactionsV2";
final String walletId; final String walletId;
final String? contractAddress;
@override @override
ConsumerState<AllTransactionsV2View> createState() => ConsumerState<AllTransactionsV2View> createState() =>
@ -491,22 +493,31 @@ class _AllTransactionsV2ViewState extends ConsumerState<AllTransactionsV2View> {
.transactionV2s .transactionV2s
.buildQuery<TransactionV2>( .buildQuery<TransactionV2>(
whereClauses: [ whereClauses: [
IndexWhereClause.equalTo( IndexWhereClause.equalTo(
indexName: 'walletId', indexName: 'walletId',
value: [widget.walletId], value: [widget.walletId],
) )
], ],
// TODO: [prio=med] add filters to wallet or cryptocurrency class // TODO: [prio=med] add filters to wallet or cryptocurrency class
// Might not be needed (yet)? filter: widget.contractAddress != null
// filter: [ ? FilterGroup.and([
// // todo FilterCondition.equalTo(
// ], property: r"contractAddress",
value: widget.contractAddress!,
),
const FilterCondition.equalTo(
property: r"subType",
value: TransactionSubType.ethToken,
),
])
: null,
sortBy: [ sortBy: [
const SortProperty( const SortProperty(
property: "timestamp", property: "timestamp",
sort: Sort.desc, sort: Sort.desc,
), ),
]).findAll(), ])
.findAll(),
builder: (_, AsyncSnapshot<List<TransactionV2>> snapshot) { builder: (_, AsyncSnapshot<List<TransactionV2>> snapshot) {
if (snapshot.connectionState == ConnectionState.done && if (snapshot.connectionState == ConnectionState.done &&
snapshot.hasData) { snapshot.hasData) {

View file

@ -15,7 +15,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart'; import 'package:stackwallet/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart';
import 'package:stackwallet/pages/token_view/sub_widgets/token_summary.dart'; import 'package:stackwallet/pages/token_view/sub_widgets/token_summary.dart';
import 'package:stackwallet/pages/token_view/sub_widgets/token_transaction_list_widget.dart'; import 'package:stackwallet/pages/token_view/sub_widgets/token_transaction_list_widget.dart';
import 'package:stackwallet/pages/wallet_view/transaction_views/all_transactions_view.dart'; import 'package:stackwallet/pages/wallet_view/transaction_views/tx_v2/all_transactions_v2_view.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart'; import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_summary.dart'; import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_summary.dart';
import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/my_wallet.dart'; import 'package:stackwallet/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/my_wallet.dart';
@ -216,10 +216,14 @@ class _DesktopTokenViewState extends ConsumerState<DesktopTokenView> {
text: "See all", text: "See all",
onTap: () { onTap: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
AllTransactionsView.routeName, AllTransactionsV2View.routeName,
arguments: ( arguments: (
walletId: widget.walletId, walletId: widget.walletId,
isTokens: true, contractAddress: ref.watch(
pCurrentTokenWallet.select(
(value) => value!.tokenContract.address,
),
),
), ),
); );
}, },

View file

@ -1325,6 +1325,18 @@ class RouteGenerator {
), ),
); );
} }
if (args is ({String walletId, String contractAddress})) {
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => AllTransactionsV2View(
walletId: args.walletId,
contractAddress: args.contractAddress,
),
settings: RouteSettings(
name: settings.name,
),
);
}
return _routeError("${settings.name} invalid args: ${args.toString()}"); return _routeError("${settings.name} invalid args: ${args.toString()}");
case TransactionSearchFilterView.routeName: case TransactionSearchFilterView.routeName: