Fixing wrong timestamp unit for location event

This commit is contained in:
Maxime NATUREL 2022-04-26 14:46:40 +02:00
parent 65724fbdd4
commit 6e68a5187e
2 changed files with 5 additions and 5 deletions

View file

@ -49,8 +49,8 @@ data class MessageLocationContent(
/**
* Exact time that the data in the event refers to (milliseconds since the UNIX epoch)
*/
@Json(name = "org.matrix.msc3488.ts") val unstableTs: Long? = null,
@Json(name = "m.ts") val ts: Long? = null,
@Json(name = "org.matrix.msc3488.ts") val unstableTimestampAsMilliseconds: Long? = null,
@Json(name = "m.ts") val timestampAsMilliseconds: Long? = null,
@Json(name = "org.matrix.msc1767.text") val unstableText: String? = null,
@Json(name = "m.text") val text: String? = null,
/**
@ -66,7 +66,7 @@ data class MessageLocationContent(
fun getBestLocationInfo() = locationInfo ?: unstableLocationInfo
fun getBestTs() = ts ?: unstableTs
fun getBestTimestampAsMilliseconds() = timestampAsMilliseconds ?: unstableTimestampAsMilliseconds
fun getBestText() = text ?: unstableText

View file

@ -238,7 +238,7 @@ internal class LocalEchoEventFactory @Inject constructor(
body = geoUri,
unstableLocationInfo = LocationInfo(geoUri = geoUri, description = geoUri),
unstableLocationAsset = LocationAsset(type = assetType),
unstableTs = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),
unstableTimestampAsMilliseconds = System.currentTimeMillis(),
unstableText = geoUri
)
return createMessageEvent(roomId, content)
@ -257,7 +257,7 @@ internal class LocalEchoEventFactory @Inject constructor(
eventId = beaconInfoEventId
),
unstableLocationInfo = LocationInfo(geoUri = geoUri, description = geoUri),
unstableTimestampAsMilliseconds = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()),
unstableTimestampAsMilliseconds = System.currentTimeMillis(),
)
val localId = LocalEcho.createLocalEchoId()
return Event(