mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-18 01:13:55 +00:00
fix: update timestamp without reloading the page
This commit is contained in:
@@ -253,7 +253,7 @@ data class Comment(
|
||||
@SerialName("content")
|
||||
var content: String,
|
||||
@SerialName("timestamp")
|
||||
val timestamp: String,
|
||||
var timestamp: String,
|
||||
@SerialName("deleted")
|
||||
@Serializable(with = NumericBooleanSerializer::class)
|
||||
val deleted: Boolean?,
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user