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,
arguments: (
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
// Might not be needed (yet)?
// filter: [
// // todo
// ],
// eth tokens should all be on v2 txn now so this should not be needed here
// filter: widget.contractAddress != null
// ? FilterGroup.and([
// FilterCondition.equalTo(
// property: r"contractAddress",
// value: widget.contractAddress!,
// ),
// const FilterCondition.equalTo(
// property: r"subType",
// value: TransactionSubType.ethToken,
// ),
// ])
// : null,
sortBy: [
const SortProperty(
property: "timestamp",

View file

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