Here's an overview of how you can start integrating comments into your applications
Amity Social SDK's comment creation is designed to handle comments in a fast and reliable way throughout your application. Each comment is given a unique commentId that cannot be changed, and the SDK includes an optimistic update feature. To work with comments, you'll need to use the CommentRepository.
With the SDK's optimistic creation feature for comments, you don't need to create a unique commentId yourself. Instead, the SDK generates one automatically for you. However, you'll need to provide a referenceId and referenceType. This feature allows the app to display the comment optimistically, assuming that it will be added successfully. This improves the user experience by reducing perceived latency.
A comment should not exceed 20,000 characters in length.
The AmityNotificationToken
returned by the observeOnceWithBlock:
is saved in self.token
, a strongly referenced property. This is needed in order to prevent the observe block to be released.
The parentId
parameter in createComment:
is optional.
The referenceId
parameter in createComment:
is mandatory and will only support AmityPost
identifier.
Version 6
Beta (v0.0.1)
Amity Social SDK also allows you to create comments with images. When creating a comment with images, you can use the SDK's optimistic creation feature just like with text comments. The SDK will automatically generate a unique commentId for the image comment. However, in addition to the referenceId and referenceType, you'll also need to provide the image data in the form of fileId
.
To create a comment with images, you will need to upload an image using #upload-images function and proving fileId
s in attachments
parameter. The SDK will then handle the rest and create the comment with the image optimistically.
The functionality isn't currently supported by this SDK.
Version 6
Beta (v0.0.1)
The functionality isn't currently supported by this SDK.
In addition to creating top-level comments, Amity Social SDK also allows you to reply to existing comments. To reply to a comment, you'll need to specify the parent comment's commentId
as one of the parameters. This allows the SDK to associate the new comment as a reply to the parent comment.
Similar to creating a top-level comment, you can use the SDK's optimistic creation feature to create a reply comment. You don't need to provide a unique commentId
for the reply comment, as the SDK generates one automatically. Instead, you'll need to provide the parentId
, referenceId
, referenceType
, and the text content of the reply.
Supported ✅ (please wait while we prepare a real example!)
Version 6
Beta (v0.0.1)
The functionality isn't currently supported by this SDK.
Version 6
Beta (v0.0.1)
The functionality isn't currently supported by this SDK.