feat: integrate invite API and improve notification handling
- Add invite code display and binding functionality via API - Fix notification unread count sync on auth state change - Improve notification mark read with server state validation - Add auth state listener to trigger notification refresh - Add YaoCoinConverter for coin-to-yao type conversion - Remove YaoLegend from divination screens (UI cleanup) - Abbreviate relation labels in yao detail view - Add re-register notice to account delete screen - Update 'coins' terminology to 'points' in localization - Fix backend points consumption to only run in CHAT mode - Add HttpxAuthNoiseFilter to suppress auth endpoint logging - Fix notification static_schema import path - Add test coverage for notification bloc error handling - Update AGENTS.md page header rules and image handling - Delete deprecated run-dev.sh script
This commit is contained in:
@@ -60,11 +60,20 @@ class NotificationApi {
|
||||
}
|
||||
|
||||
Future<NotificationItem> markRead({required String notificationId}) async {
|
||||
_logger.info(
|
||||
message: 'Mark read request started',
|
||||
extra: {'notification_id': notificationId},
|
||||
);
|
||||
try {
|
||||
final response = await _apiClient.rawDio.patch<Map<String, dynamic>>(
|
||||
'/api/v1/notifications/$notificationId/read',
|
||||
);
|
||||
return parseNotificationItem(response.data!);
|
||||
final item = parseNotificationItem(response.data!);
|
||||
_logger.info(
|
||||
message: 'Mark read request succeeded',
|
||||
extra: {'notification_id': notificationId, 'is_read': item.isRead},
|
||||
);
|
||||
return item;
|
||||
} on DioException catch (error, stackTrace) {
|
||||
_logger.error(
|
||||
message: 'Mark read failed',
|
||||
@@ -76,11 +85,17 @@ class NotificationApi {
|
||||
}
|
||||
|
||||
Future<int> markAllRead() async {
|
||||
_logger.info(message: 'Mark all read request started');
|
||||
try {
|
||||
final response = await _apiClient.rawDio.patch<Map<String, dynamic>>(
|
||||
'/api/v1/notifications/mark-all-read',
|
||||
);
|
||||
return response.data?['updatedCount'] as int? ?? 0;
|
||||
final updatedCount = response.data?['updatedCount'] as int? ?? 0;
|
||||
_logger.info(
|
||||
message: 'Mark all read request succeeded',
|
||||
extra: {'updated_count': updatedCount},
|
||||
);
|
||||
return updatedCount;
|
||||
} on DioException catch (error, stackTrace) {
|
||||
_logger.error(
|
||||
message: 'Mark all read failed',
|
||||
|
||||
Reference in New Issue
Block a user