feat: Implement clear chat, delete conversation, mute, and report options within the chat screen.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user