Update File Post
Upload files
If you want to edit a file post to add more files, the files to be added must be uploaded first. The AmityFileRepository
class handles the uploading and downloading of files. The repository has an uploadFile
method which takes the file's Uri
and returns an array of AmityUploadResult
for successful or failed uploads.
AmityUploadResult
will return four possible types of data:
AmityUploadResult.PROGRESS
- uploading is in progress. It returnsAmityUploadInfo
which can be used to track the progress of the upload.AmityUploadResult.COMPLETE
- the upload completed successfully. It returnsAmityFile
that can then be attached to the post.AmityUploadResult.ERROR(exception)
- the upload failed. It returns anException
.AmityUploadResult.CANCELLED
- uploading is canceled.
You can upload a maximum of ten files in a single post.
Update file post
To edit a file post, use the edit
method as shown in the sample code below. The attachments
should contain the existing files and the uploaded files that you want to add to the post which are stored in existingFiles
and newFiles
respectively.
You can remove existing files from the post by excluding them from the attachments
list. You can also change the order of the files in the list.
To update mentioned users in a post, refer to update mention in post.
Last updated