Renaming timestamp fields

This commit is contained in:
Maxime NATUREL 2022-05-02 11:10:36 +02:00
parent e82e79d7e2
commit a27569770b
5 changed files with 9 additions and 9 deletions

View file

@ -49,8 +49,8 @@ data class MessageBeaconInfoContent(
/** /**
* Beacon creation timestamp. * Beacon creation timestamp.
*/ */
@Json(name = "org.matrix.msc3488.ts") val unstableTimestampAsMilliseconds: Long? = null, @Json(name = "org.matrix.msc3488.ts") val unstableTimestampMillis: Long? = null,
@Json(name = "m.ts") val timestampAsMilliseconds: Long? = null, @Json(name = "m.ts") val timestampMillis: Long? = null,
/** /**
* Live location asset type. * Live location asset type.
*/ */
@ -58,7 +58,7 @@ data class MessageBeaconInfoContent(
@Json(name = "m.asset") val locationAsset: LocationAsset? = null, @Json(name = "m.asset") val locationAsset: LocationAsset? = null,
) : MessageContent { ) : MessageContent {
fun getBestTimestampAsMilliseconds() = timestampAsMilliseconds ?: unstableTimestampAsMilliseconds fun getBestTimestampMillis() = timestampMillis ?: unstableTimestampMillis
fun getBestLocationAsset() = locationAsset ?: unstableLocationAsset fun getBestLocationAsset() = locationAsset ?: unstableLocationAsset
} }

View file

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

View file

@ -54,7 +54,7 @@ internal class DefaultLiveLocationAggregationProcessor @Inject constructor() : L
eventId = targetEventId eventId = targetEventId
) )
aggregatedSummary.endOfLiveTimestampAsMilliseconds = content.getBestTimestampAsMilliseconds()?.let { it + (content.timeout ?: 0) } aggregatedSummary.endOfLiveTimestampAsMilliseconds = content.getBestTimestampMillis()?.let { it + (content.timeout ?: 0) }
aggregatedSummary.isActive = content.isLive aggregatedSummary.isActive = content.isLive
} }

View file

@ -242,7 +242,7 @@ internal class LocalEchoEventFactory @Inject constructor(
body = geoUri, body = geoUri,
unstableLocationInfo = LocationInfo(geoUri = geoUri, description = geoUri), unstableLocationInfo = LocationInfo(geoUri = geoUri, description = geoUri),
unstableLocationAsset = LocationAsset(type = assetType), unstableLocationAsset = LocationAsset(type = assetType),
unstableTimestampAsMilliseconds = System.currentTimeMillis(), unstableTimestampMillis = System.currentTimeMillis(),
unstableText = geoUri unstableText = geoUri
) )
return createMessageEvent(roomId, content) return createMessageEvent(roomId, content)

View file

@ -99,7 +99,7 @@ class LocationSharingService : VectorService(), LocationTracker.Callback {
val beaconContent = MessageBeaconInfoContent( val beaconContent = MessageBeaconInfoContent(
timeout = roomArgs.durationMillis, timeout = roomArgs.durationMillis,
isLive = true, isLive = true,
unstableTimestampAsMilliseconds = clock.epochMillis() unstableTimestampMillis = clock.epochMillis()
).toContent() ).toContent()
val stateKey = session.myUserId val stateKey = session.myUserId