feat: Implement conversation mute and favorite features with UI integration and state management.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user