fix: update timestamp without reloading the page
This commit is contained in:
parent
fb99429dd7
commit
093bee94c6
2 changed files with 6 additions and 1 deletions
|
@ -253,7 +253,7 @@ data class Comment(
|
||||||
@SerialName("content")
|
@SerialName("content")
|
||||||
var content: String,
|
var content: String,
|
||||||
@SerialName("timestamp")
|
@SerialName("timestamp")
|
||||||
val timestamp: String,
|
var timestamp: String,
|
||||||
@SerialName("deleted")
|
@SerialName("deleted")
|
||||||
@Serializable(with = NumericBooleanSerializer::class)
|
@Serializable(with = NumericBooleanSerializer::class)
|
||||||
val deleted: Boolean?,
|
val deleted: Boolean?,
|
||||||
|
|
|
@ -40,6 +40,8 @@ import io.noties.markwon.image.glide.GlideImagesPlugin
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.TimeZone
|
||||||
|
|
||||||
class CommentsActivity : AppCompatActivity() {
|
class CommentsActivity : AppCompatActivity() {
|
||||||
lateinit var binding: ActivityCommentsBinding
|
lateinit var binding: ActivityCommentsBinding
|
||||||
|
@ -258,6 +260,9 @@ class CommentsActivity : AppCompatActivity() {
|
||||||
if (item is CommentItem) {
|
if (item is CommentItem) {
|
||||||
if (item.comment.commentId == editingCommentId) {
|
if (item.comment.commentId == editingCommentId) {
|
||||||
item.comment.content = it
|
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()
|
item.notifyChanged()
|
||||||
snackString("Comment edited")
|
snackString("Comment edited")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue