Image Post
To create an image post, images must be uploaded first. SDK provides a convenient class AmityFileRepository
to handle upload and download images. The repository contains uploadImage
method which takes Uri
and provides you with an array of AmityUploadResult
for successful upload or failed uploads. AmityUploadResult
could return four possible types of data.
AmityUploadResult.PROGRESS
indicates an uploading state of the current upload and returnsAmityUploadInfo
to track the progress of the upload.AmityUploadResult.COMPLETE
indicates a successful state of the current upload and returnsAmityImage
to attach.AmityUploadResult.ERROR(exception)
indicates a failure state of the current upload and attachException
.AmityUploadResult.CANCELLED
indicates a canceled state of the current upload.
A post can have a maximum of ten images.
Now to create the image post. We can build the post first by using AmityImagePostCreator.Builder
. Then use the same createPost
method in AmityFeedRepository
to create an image post.
Create an image post with mention
When creating an image post with mention, you can provide the JsonObject
for the metadata
parameter and provide the list of userId
for the mentionUsers
parameter.
To render mention, refer to Rendering Mention section.
Last updated