feat: Implement conversation mute and favorite features with UI integration and state management.

This commit is contained in:
pradeepkumar
2026-03-19 17:03:44 +05:30
parent 32ec839016
commit 858c912df9
4 changed files with 121 additions and 3 deletions

View File

@@ -186,6 +186,38 @@ class MessagingRepository {
);
}
}
/// Toggle mute status for a conversation
Future<void> toggleMute(String conversationId, bool muted) async {
try {
await _dio.patch(
'${ApiConstants.conversations}/$conversationId/mute',
data: {'muted': muted},
);
} on DioException catch (e) {
if (e.error is ApiException) throw e.error as ApiException;
throw ApiException(
message: e.message ?? 'Failed to toggle mute',
statusCode: e.response?.statusCode,
);
}
}
/// Toggle favorite status for a conversation
Future<void> toggleFavorite(String conversationId, bool favorited) async {
try {
await _dio.patch(
'${ApiConstants.conversations}/$conversationId/favorite',
data: {'favorited': favorited},
);
} on DioException catch (e) {
if (e.error is ApiException) throw e.error as ApiException;
throw ApiException(
message: e.message ?? 'Failed to toggle favorite',
statusCode: e.response?.statusCode,
);
}
}
}
final messagingRepositoryProvider = Provider<MessagingRepository>((ref) {