feat(routing): 域名级系统锁冲突提示 + 重置默认按钮 + 客户端 follow-up 清理
承接 FT-A(GET /v1/me/routing 含只读 system_locked_domains)。 - RoutingProfile 加只读 systemLockedDomains(fromJson 读/toJson 不输出); routing_screen 冲突检测扩展到域名类规则(domain/domain_suffix/domain_keyword 命中锁定域名 → systemLocked),ip_cidr 私网启发式保留。 - RoutingProfile.defaults() + RoutingProfileNotifier.resetToDefault()(复用 _persist:乐观更新/失败回滚/存成功后自动重连,保留只读 systemLockedDomains 不丢)+ routing_screen 加「重置默认」按钮与二次确认弹层(新增 3 个 l10n 键)。 - RoutingRule.copyWith 用哨兵支持 note 显式清空为 null;RoutingRule/Builtin/ RoutingProfile 加值相等 operator==/hashCode。 - T8 smartRouteSub 清理:grep 全仓发现 design/prototype/i18n/alias.json → gen_proto_i18n.mjs(CI 漂移闸)仍有活引用,按计划口径不删,详见 .superpowers/sdd/task-FTB-report.md。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -69,6 +69,14 @@ class RoutingProfileNotifier extends AsyncNotifier<RoutingProfile> {
|
||||
return p.copyWith(rules: rules);
|
||||
});
|
||||
|
||||
/// 重置为出厂默认档案(模式/内置开关/自定义规则/final 全部还原),但保留当前只读的
|
||||
/// [RoutingProfile.systemLockedDomains] 回显不丢——它不是用户可改的档案内容,只是
|
||||
/// 服务端下发的账户相关信息,与「重置」无关。复用 [_mutateAndSave]/[_persist]:
|
||||
/// 乐观更新 + 失败回滚 rethrow + 存成功后连接态 on 则自动重连,同 addRule。
|
||||
Future<void> resetToDefault() => _mutateAndSave(
|
||||
(p) => RoutingProfile.defaults().copyWith(systemLockedDomains: p.systemLockedDomains),
|
||||
);
|
||||
|
||||
Future<void> _mutateAndSave(RoutingProfile Function(RoutingProfile) transform) async {
|
||||
final prev = state.valueOrNull ?? const RoutingProfile();
|
||||
final next = transform(prev);
|
||||
|
||||
Reference in New Issue
Block a user