feat: Implement clear chat, delete conversation, mute, and report options within the chat screen.

This commit is contained in:
pradeepkumar
2026-03-19 13:57:14 +05:30
parent b848b0260b
commit a837e5ac12
5 changed files with 217 additions and 23 deletions

View File

@@ -160,6 +160,32 @@ class MessagingRepository {
);
}
}
/// DELETE /messages/conversations/:id/messages — clear all messages
Future<void> clearChat(String conversationId) async {
try {
await _dio.delete('${ApiConstants.conversations}/$conversationId/messages');
} on DioException catch (e) {
if (e.error is ApiException) throw e.error as ApiException;
throw ApiException(
message: e.message ?? 'Failed to clear chat',
statusCode: e.response?.statusCode,
);
}
}
/// DELETE /messages/conversations/:id — delete conversation entirely
Future<void> deleteConversation(String conversationId) async {
try {
await _dio.delete('${ApiConstants.conversations}/$conversationId');
} on DioException catch (e) {
if (e.error is ApiException) throw e.error as ApiException;
throw ApiException(
message: e.message ?? 'Failed to delete conversation',
statusCode: e.response?.statusCode,
);
}
}
}
final messagingRepositoryProvider = Provider<MessagingRepository>((ref) {