feat: 增强 HomeScreen 录音交互与 ChatBloc 状态管理

- 新增录音启动延迟处理,解决权限未就绪时的竞态问题
- 实现历史分页滚动位置保持,提升加载体验
- 添加文本输入框点击键盘显示与焦点管理
- 优化 ChatBloc provider 到 MultiBlocProvider 支持
- 修复 ApiException 429 错误详情解析(支持 JSON 字符串 body)
- 改进 LocalNotificationService 精确闹钟权限请求
- 优化 UiSchemaRenderer GridView children 生成
- 支持导航 action 的 replace 参数
- 移除 Agent router 速率限制逻辑(_allow_run_request, _allow_transcribe_request)
- 补充相关单元测试与集成测试
This commit is contained in:
qzl
2026-03-18 17:03:22 +08:00
parent b34697660d
commit 8539f05a66
13 changed files with 578 additions and 143 deletions
@@ -1,4 +1,5 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:dio/dio.dart';
import 'package:social_app/core/api/api_exception.dart';
void main() {
@@ -15,5 +16,37 @@ void main() {
const exception = UnauthorizedException();
expect(exception.message, '请重新登录');
});
test('429 returns backend detail message', () {
final dioException = DioException(
requestOptions: RequestOptions(path: '/api/v1/agent/runs'),
response: Response<dynamic>(
requestOptions: RequestOptions(path: '/api/v1/agent/runs'),
statusCode: 429,
data: <String, dynamic>{'detail': 'Too many SSE connections'},
),
);
final apiException = ApiException.fromDioError(dioException);
expect(apiException.statusCode, 429);
expect(apiException.message, 'Too many SSE connections');
});
test('429 parses detail from string json body', () {
final dioException = DioException(
requestOptions: RequestOptions(path: '/api/v1/agent/runs'),
response: Response<dynamic>(
requestOptions: RequestOptions(path: '/api/v1/agent/runs'),
statusCode: 429,
data: '{"detail":"Too many SSE connections"}',
),
);
final apiException = ApiException.fromDioError(dioException);
expect(apiException.statusCode, 429);
expect(apiException.message, 'Too many SSE connections');
});
});
}