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.
*/
@Json(name = "org.matrix.msc3488.ts") val unstableTimestampAsMilliseconds: Long? = null,
@Json(name = "m.ts") val timestampAsMilliseconds: Long? = null,
@Json(name = "org.matrix.msc3488.ts") val unstableTimestampMillis: Long? = null,
@Json(name = "m.ts") val timestampMillis: Long? = null,
/**
* Live location asset type.
*/
@ -58,7 +58,7 @@ data class MessageBeaconInfoContent(
@Json(name = "m.asset") val locationAsset: LocationAsset? = null,
) : MessageContent {
fun getBestTimestampAsMilliseconds() = timestampAsMilliseconds ?: unstableTimestampAsMilliseconds
fun getBestTimestampMillis() = timestampMillis ?: unstableTimestampMillis
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)
*/
@Json(name = "org.matrix.msc3488.ts") val unstableTimestampAsMilliseconds: Long? = null,
@Json(name = "m.ts") val timestampAsMilliseconds: Long? = null,
@Json(name = "org.matrix.msc3488.ts") val unstableTimestampMillis: Long? = null,
@Json(name = "m.ts") val timestampMillis: 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 getBestTimestampAsMilliseconds() = timestampAsMilliseconds ?: unstableTimestampAsMilliseconds
fun getBestTimestampMillis() = timestampMillis ?: unstableTimestampMillis
fun getBestText() = text ?: unstableText

View File

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

View File

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

View File

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