Renaming other timestamps with shorter names
This commit is contained in:
parent
11ebab094b
commit
3201308125
@ -28,6 +28,6 @@ data class LiveLocationShareAggregatedSummary(
|
||||
val eventId: String,
|
||||
val roomId: String,
|
||||
val isActive: Boolean?,
|
||||
val endOfLiveTimestampAsMilliseconds: Long?,
|
||||
val endOfLiveTimestampMillis: Long?,
|
||||
val lastLocationDataContent: MessageBeaconLocationDataContent?,
|
||||
)
|
||||
|
@ -50,11 +50,11 @@ data class MessageBeaconLocationDataContent(
|
||||
/**
|
||||
* 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
|
||||
) : MessageContent {
|
||||
|
||||
fun getBestLocationInfo() = locationInfo ?: unstableLocationInfo
|
||||
|
||||
fun getBestTimestampAsMilliseconds() = timestampAsMilliseconds ?: unstableTimestampAsMilliseconds
|
||||
fun getBestTimestampMillis() = timestampMillis ?: unstableTimestampMillis
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ internal object LiveLocationShareAggregatedSummaryMapper {
|
||||
eventId = entity.eventId,
|
||||
roomId = entity.roomId,
|
||||
isActive = entity.isActive,
|
||||
endOfLiveTimestampAsMilliseconds = entity.endOfLiveTimestampAsMilliseconds,
|
||||
endOfLiveTimestampMillis = entity.endOfLiveTimestampMillis,
|
||||
lastLocationDataContent = ContentMapper.map(entity.lastLocationContent).toModel<MessageBeaconLocationDataContent>()
|
||||
)
|
||||
}
|
||||
@ -39,7 +39,7 @@ internal object LiveLocationShareAggregatedSummaryMapper {
|
||||
eventId = model.eventId,
|
||||
roomId = model.roomId,
|
||||
isActive = model.isActive,
|
||||
endOfLiveTimestampAsMilliseconds = model.endOfLiveTimestampAsMilliseconds,
|
||||
endOfLiveTimestampMillis = model.endOfLiveTimestampMillis,
|
||||
lastLocationContent = ContentMapper.map(model.lastLocationDataContent.toContent())
|
||||
)
|
||||
}
|
||||
|
@ -35,8 +35,8 @@ internal class MigrateSessionTo027(realm: DynamicRealm) : RealmMigrator(realm, 2
|
||||
.addField(LiveLocationShareAggregatedSummaryEntityFields.ROOM_ID, String::class.java, FieldAttribute.REQUIRED)
|
||||
.addField(LiveLocationShareAggregatedSummaryEntityFields.IS_ACTIVE, Boolean::class.java)
|
||||
.setNullable(LiveLocationShareAggregatedSummaryEntityFields.IS_ACTIVE, true)
|
||||
.addField(LiveLocationShareAggregatedSummaryEntityFields.END_OF_LIVE_TIMESTAMP_AS_MILLISECONDS, Long::class.java)
|
||||
.setNullable(LiveLocationShareAggregatedSummaryEntityFields.END_OF_LIVE_TIMESTAMP_AS_MILLISECONDS, true)
|
||||
.addField(LiveLocationShareAggregatedSummaryEntityFields.END_OF_LIVE_TIMESTAMP_MILLIS, Long::class.java)
|
||||
.setNullable(LiveLocationShareAggregatedSummaryEntityFields.END_OF_LIVE_TIMESTAMP_MILLIS, true)
|
||||
.addField(LiveLocationShareAggregatedSummaryEntityFields.LAST_LOCATION_CONTENT, String::class.java)
|
||||
?: return
|
||||
|
||||
|
@ -33,7 +33,7 @@ internal open class LiveLocationShareAggregatedSummaryEntity(
|
||||
|
||||
var isActive: Boolean? = null,
|
||||
|
||||
var endOfLiveTimestampAsMilliseconds: Long? = null,
|
||||
var endOfLiveTimestampMillis: Long? = null,
|
||||
|
||||
/**
|
||||
* For now we persist this as a JSON for greater flexibility
|
||||
|
@ -56,7 +56,7 @@ internal class DefaultLiveLocationAggregationProcessor @Inject constructor() : L
|
||||
|
||||
Timber.d("updating summary of id=$targetEventId with isLive=${content.isLive}")
|
||||
|
||||
aggregatedSummary.endOfLiveTimestampAsMilliseconds = content.getBestTimestampMillis()?.let { it + (content.timeout ?: 0) }
|
||||
aggregatedSummary.endOfLiveTimestampMillis = content.getBestTimestampMillis()?.let { it + (content.timeout ?: 0) }
|
||||
aggregatedSummary.isActive = content.isLive
|
||||
}
|
||||
|
||||
@ -77,11 +77,11 @@ internal class DefaultLiveLocationAggregationProcessor @Inject constructor() : L
|
||||
roomId = roomId,
|
||||
eventId = targetEventId
|
||||
)
|
||||
val updatedLocationTimestamp = content.getBestTimestampAsMilliseconds() ?: 0
|
||||
val updatedLocationTimestamp = content.getBestTimestampMillis() ?: 0
|
||||
val currentLocationTimestamp = ContentMapper
|
||||
.map(aggregatedSummary.lastLocationContent)
|
||||
.toModel<MessageBeaconLocationDataContent>()
|
||||
?.getBestTimestampAsMilliseconds()
|
||||
?.getBestTimestampMillis()
|
||||
?: 0
|
||||
|
||||
if (updatedLocationTimestamp.isMoreRecentThan(currentLocationTimestamp)) {
|
||||
|
@ -261,7 +261,7 @@ internal class LocalEchoEventFactory @Inject constructor(
|
||||
eventId = beaconInfoEventId
|
||||
),
|
||||
unstableLocationInfo = LocationInfo(geoUri = geoUri, description = geoUri),
|
||||
unstableTimestampAsMilliseconds = System.currentTimeMillis(),
|
||||
unstableTimestampMillis = System.currentTimeMillis(),
|
||||
)
|
||||
val localId = LocalEcho.createLocalEchoId()
|
||||
return Event(
|
||||
|
Loading…
x
Reference in New Issue
Block a user