feat: disable automatic node switching (#2807)

David Adegoke committed Jan 15, 2026 at 14:43 UTC 9bac419cb7d7f57c9c197786898a93d87948b108
4 files changed +28 -18
lib/core/node_switching_service.dart
+5 -1
@@ -3,6 +3,7 @@ import 'package:cw_core/node.dart';
3 import 'package:cw_core/wallet_type.dart';
4 import 'package:cake_wallet/store/app_store.dart';
5 import 'package:cake_wallet/store/settings_store.dart';
6 +import 'package:cake_wallet/utils/feature_flag.dart';
7 import 'package:cw_core/utils/print_verbose.dart';
8 import 'package:hive/hive.dart';
9 import 'package:connectivity_plus/connectivity_plus.dart';
@@ -57,7 +58,10 @@ class NodeSwitchingService {
58 Future<void> performHealthCheck() async {
59 if (appStore.wallet == null) return;
60
60 - if (!settingsStore.enableAutomaticNodeSwitching) return;
61 + if (!FeatureFlag.isAutomaticNodeSwitchingEnabled ||
62 + !settingsStore.enableAutomaticNodeSwitching) {
63 + return;
64 + }
65
66 if (_isSwitching) return;
67
lib/reactions/bootstrap.dart
+4 -1
@@ -15,6 +15,7 @@ import 'package:cake_wallet/store/settings_store.dart';
15 import 'package:cake_wallet/store/authentication_store.dart';
16 import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
17 import 'package:cake_wallet/core/node_switching_service.dart';
18 +import 'package:cake_wallet/utils/feature_flag.dart';
19
20 Future<void> bootstrapOffline() async {
21 final authenticationStore = getIt.get<AuthenticationStore>();
@@ -42,5 +43,7 @@ void bootstrapOnline(GlobalKey<NavigatorState> navigatorKey, {required bool load
43 startOnCurrentNodeChangeReaction(appStore);
44 startFiatRateUpdate(appStore, settingsStore, fiatConversionStore);
45
45 - getIt.get<NodeSwitchingService>().startHealthCheckTimer();
46 + if (FeatureFlag.isAutomaticNodeSwitchingEnabled) {
47 + getIt.get<NodeSwitchingService>().startHealthCheckTimer();
48 + }
49 }
\ No newline at end of file
lib/src/screens/settings/manage_nodes_page.dart
+18 -16
@@ -5,6 +5,7 @@ import 'package:cake_wallet/src/screens/nodes/widgets/node_list_row.dart';
5 import 'package:cake_wallet/src/screens/settings/widgets/settings_switcher_cell.dart';
6 import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
7 import 'package:cake_wallet/src/widgets/standard_list.dart';
8 +import 'package:cake_wallet/utils/feature_flag.dart';
9 import 'package:cake_wallet/utils/show_pop_up.dart';
10 import 'package:cake_wallet/view_model/node_list/node_list_view_model.dart';
11 import 'package:cake_wallet/view_model/node_list/pow_node_list_view_model.dart';
@@ -35,23 +36,24 @@ class ManageNodesPage extends BasePage {
36 onTap: (_) async => await Navigator.of(context).pushNamed(Routes.newNode),
37 ),
38 ),
38 - Observer(
39 - builder: (_) => SettingsSwitcherCell(
40 - key: ValueKey('manage_nodes_page_enable_auto_node_switching_button_key'),
41 - title: S.current.enable_auto_node_switching,
42 - value: isPow
43 - ? powNodeListViewModel!.enableAutomaticNodeSwitching
44 - : nodeListViewModel!.enableAutomaticNodeSwitching,
45 - onValueChange: (BuildContext context, bool value) {
46 - if (isPow) {
47 - powNodeListViewModel!.setEnableAutomaticNodeSwitching(value);
48 - } else {
49 - nodeListViewModel!.setEnableAutomaticNodeSwitching(value);
50 - }
51 - },
39 + if (FeatureFlag.isAutomaticNodeSwitchingEnabled)
40 + Observer(
41 + builder: (_) => SettingsSwitcherCell(
42 + key: ValueKey('manage_nodes_page_enable_auto_node_switching_button_key'),
43 + title: S.current.enable_auto_node_switching,
44 + value: isPow
45 + ? powNodeListViewModel!.enableAutomaticNodeSwitching
46 + : nodeListViewModel!.enableAutomaticNodeSwitching,
47 + onValueChange: (BuildContext context, bool value) {
48 + if (isPow) {
49 + powNodeListViewModel!.setEnableAutomaticNodeSwitching(value);
50 + } else {
51 + nodeListViewModel!.setEnableAutomaticNodeSwitching(value);
52 + }
53 + },
54 + ),
55 ),
53 - ),
54 - SizedBox(height: 8),
56 + if (FeatureFlag.isAutomaticNodeSwitchingEnabled) SizedBox(height: 8),
57 Observer(
58 builder: (BuildContext context) {
59 int itemsCount =
lib/utils/feature_flag.dart
+1
@@ -14,4 +14,5 @@ class FeatureFlag {
14 static const bool hasBitcoinViewOnly = true;
15 static const bool customBackgroundEnabled = false;
16 static const bool duressPinEnabled = true;
17 + static const bool isAutomaticNodeSwitchingEnabled = false;
18 }