fix: update timestamp without reloading the page

This commit is contained in:
rebelonion 2024-02-15 13:00:08 -06:00
parent fb99429dd7
commit 093bee94c6
2 changed files with 6 additions and 1 deletions

View file

@ -40,6 +40,8 @@ import io.noties.markwon.image.glide.GlideImagesPlugin
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.text.SimpleDateFormat
import java.util.TimeZone
class CommentsActivity : AppCompatActivity() {
lateinit var binding: ActivityCommentsBinding
@ -258,6 +260,9 @@ class CommentsActivity : AppCompatActivity() {
if (item is CommentItem) {
if (item.comment.commentId == editingCommentId) {
item.comment.content = it
val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
dateFormat.timeZone = TimeZone.getTimeZone("UTC")
item.comment.timestamp = dateFormat.format(System.currentTimeMillis())
item.notifyChanged()
snackString("Comment edited")
}