feat(client): 记住上次选择的节点 + 自动连接 toast(1.0.24)
- selectedNodeCodeProvider 改为持久化 StateNotifier(select() 落盘、启动恢复,默认智能 AUTO); 自动连接复用上次选择:智能就智能、具体就具体。 - 自动连接门控加等「选中节点已恢复」(controller.loaded),避免用到未恢复的默认值。 - 自动连接触发时弹 toast「正在自动连接到 X」(全局 ScaffoldMessenger key)。 - 测试:选中节点 select 落盘 + 重启恢复(具体/智能)。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -262,7 +262,7 @@ class ConnectionController extends StateNotifier<ConnectionState> {
|
||||
final smart = _ref.read(selectedNodeCodeProvider) == kSmartNodeCode;
|
||||
final altCode = smart ? _pickAlternativeCode(_ref.read(effectiveNodeProvider).code) : null;
|
||||
if (smart && altCode != null) {
|
||||
_ref.read(selectedNodeCodeProvider.notifier).state = altCode;
|
||||
_ref.read(selectedNodeCodeProvider.notifier).select(altCode);
|
||||
await _disconnect();
|
||||
await _connect();
|
||||
// 重连进行中给出「已自动切换」提示(connecting 态显示,连上后随 copyWith 清除)。
|
||||
|
||||
Reference in New Issue
Block a user