toggleCommentLike method
Future<void>
toggleCommentLike(
)
Implementation
Future<void> toggleCommentLike(String commentId) async {
final token = await CommunityStorage.getAuthToken();
if (token == null) {
Get.snackbar('Error', CommunityMessages.loginRequiredComment);
return;
}
try {
requireSmartLinksNativeBridge();
final result = await SmartLinksNativeApi.toggleCommentLike(
commentId: commentId,
authToken: token,
);
if (result != null) {
_applyCommentLikeUpdate(commentId);
} else {
Get.snackbar('Error', CommunityMessages.likeCommentFailed);
}
} catch (e) {
Get.snackbar(
'Error',
'${CommunityMessages.likeCommentFailed}: ${e.toString()}',
);
}
}