Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ melos run format # dart format lib test --line-length=120 across all packages
melos run analyze # flutter analyze . --fatal-infos across all packages
```

Both commands normally finish in a few seconds, but `flutter analyze` occasionally hangs. **Never wait more than 20 seconds for either command — if it hasn't finished by then, kill the process.** A run that takes longer is hung, not slow; kill it and retry.
Both commands normally finish in a few seconds, but the analyzer gets stuck on this machine: the analysis server stops consuming CPU after a few seconds and never returns. **Never wait more than 20 seconds for either command — if it hasn't finished by then, kill the process.** A run that takes longer is hung, not slow. Do not retry in a loop; use a `flutter test` run that imports the changed files as the compile check instead.

Do not run `dart analyze` or `flutter analyze` directly in individual packages; use the melos scripts above so every package is covered with the right flags.

Expand Down
32 changes: 26 additions & 6 deletions mobile-app/lib/v2/screens/accounts/accounts_navigation.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:resonance_network_wallet/providers/route_intent_providers.dart';
import 'package:resonance_network_wallet/v2/screens/accounts/accounts_screen.dart';

/// Route name of the Accounts screen, used to pop back to it.
const accountsScreenRouteName = 'accounts_screen';

/// Pops back to the already-open Accounts screen. Every in-app
/// add/import/disconnect flow originates from that screen, so it stays in the
/// navigation stack and we simply pop back to it instead of rebuilding Home.
Future<T?> openAccountsScreen<T>(BuildContext context, {String? highlightAccountId}) {
return Navigator.of(context).push<T>(
MaterialPageRoute(
settings: const RouteSettings(name: accountsScreenRouteName),
builder: (_) => AccountsScreen(highlightAccountId: highlightAccountId),
),
);
}

/// Returns to the Accounts screen after an add/import/disconnect flow.
///
/// Pops back to the already-open Accounts screen when the flow started there.
/// Flows started elsewhere (e.g. Settings → Add account) have no Accounts route
/// in the stack, so we pop to the root and push a fresh Accounts screen instead
/// of popping the whole stack.
///
/// When [highlightAccountId] is given, that account is highlighted and scrolled
/// into view once the screen is revealed.
/// into view once the screen is shown.
void returnToAccountsScreen(BuildContext context, WidgetRef ref, {String? highlightAccountId}) {
if (highlightAccountId != null) {
var foundAccountsRoute = false;
Navigator.of(context).popUntil((route) {
foundAccountsRoute = route.settings.name == accountsScreenRouteName;
return foundAccountsRoute || route.isFirst;
});

if (!foundAccountsRoute) {
openAccountsScreen(context, highlightAccountId: highlightAccountId);
} else if (highlightAccountId != null) {
ref.read(openAccountsIntentProvider.notifier).state = OpenAccountsIntent(highlightAccountId: highlightAccountId);
}
Navigator.of(context).popUntil((route) => route.settings.name == accountsScreenRouteName);
}
15 changes: 4 additions & 11 deletions mobile-app/lib/v2/screens/accounts/accounts_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,14 @@ import 'package:resonance_network_wallet/v2/components/account_list_row.dart';
import 'package:resonance_network_wallet/v2/components/multisig_tag.dart';
import 'package:resonance_network_wallet/v2/components/private_activity_notice.dart';
import 'package:resonance_network_wallet/v2/screens/accounts/account_menu_screen.dart';
import 'package:resonance_network_wallet/v2/screens/accounts/accounts_navigation.dart';
import 'package:resonance_network_wallet/v2/screens/accounts/multisig_account_menu_screen.dart';
import 'package:resonance_network_wallet/v2/screens/accounts/wallet_name_screen.dart';
import 'package:resonance_network_wallet/v2/screens/settings/add_account_menu_screen.dart';

Future<T?> openAccountsScreen<T>(BuildContext context) {
return Navigator.of(context).push<T>(
MaterialPageRoute(
settings: const RouteSettings(name: accountsScreenRouteName),
builder: (_) => const AccountsScreen(),
),
);
}

class AccountsScreen extends ConsumerStatefulWidget {
const AccountsScreen({super.key});
const AccountsScreen({super.key, this.highlightAccountId});

final String? highlightAccountId;

@override
ConsumerState<AccountsScreen> createState() => _AccountsScreenState();
Expand All @@ -46,6 +38,7 @@ class _AccountsScreenState extends ConsumerState<AccountsScreen> {
@override
void initState() {
super.initState();
_highlightAccountId = widget.highlightAccountId;
_ensureEncryptedAccounts();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:quantus_sdk/quantus_sdk.dart';
import 'package:resonance_network_wallet/v2/screens/accounts/accounts_screen.dart';
import 'package:resonance_network_wallet/v2/screens/accounts/accounts_navigation.dart';

class OpenAccountsManagementButton extends StatelessWidget {
const OpenAccountsManagementButton({super.key});
Expand Down
Loading