feat: integrate YOLO runtime, update screens, and sync docs

This commit is contained in:
2026-05-24 10:26:58 +07:00
parent aa3dc4560e
commit 6ca89ca896
14 changed files with 1352 additions and 107 deletions
@@ -40,7 +40,7 @@ class _NotificationScreenState extends State<NotificationScreen> {
final res = await _api
.get('/user/notifications')
.timeout(const Duration(seconds: 10));
final list = (res.data['data'] as List?) ?? [];
final list = _extractList(res.data);
setState(() {
_items = list.map((e) => _NotifItem.fromJson(e)).toList();
});
@@ -56,10 +56,20 @@ class _NotificationScreenState extends State<NotificationScreen> {
}
}
List<Map<String, dynamic>> _extractList(dynamic responseBody) {
final data = responseBody is Map ? responseBody['data'] : null;
final rawList = data is Map ? data['content'] : data;
if (rawList is! List) return const [];
return rawList
.whereType<Map>()
.map((item) => Map<String, dynamic>.from(item))
.toList();
}
Future<void> _markRead(int id) async {
try {
await _api
.patch('/user/notifications/$id/read')
.put('/user/notifications/$id/read')
.timeout(const Duration(seconds: 6));
setState(() {
final idx = _items.indexWhere((n) => n.id == id);
@@ -72,7 +82,7 @@ class _NotificationScreenState extends State<NotificationScreen> {
setState(() => _markingAll = true);
try {
await _api
.patch('/user/notifications/read-all')
.put('/user/notifications/mark-all-read')
.timeout(const Duration(seconds: 8));
setState(() {
_items = _items.map((n) => n.copyWith(isRead: true)).toList();