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 eventId: String,
|
||||||
val roomId: String,
|
val roomId: String,
|
||||||
val isActive: Boolean?,
|
val isActive: Boolean?,
|
||||||
val endOfLiveTimestampAsMilliseconds: Long?,
|
val endOfLiveTimestampMillis: Long?,
|
||||||
val lastLocationDataContent: MessageBeaconLocationDataContent?,
|
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)
|
* 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
|
||||||
) : MessageContent {
|
) : MessageContent {
|
||||||
|
|
||||||
fun getBestLocationInfo() = locationInfo ?: unstableLocationInfo
|
fun getBestLocationInfo() = locationInfo ?: unstableLocationInfo
|
||||||
|
|
||||||
fun getBestTimestampAsMilliseconds() = timestampAsMilliseconds ?: unstableTimestampAsMilliseconds
|
fun getBestTimestampMillis() = timestampMillis ?: unstableTimestampMillis
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ internal object LiveLocationShareAggregatedSummaryMapper {
|
|||||||
eventId = entity.eventId,
|
eventId = entity.eventId,
|
||||||
roomId = entity.roomId,
|
roomId = entity.roomId,
|
||||||
isActive = entity.isActive,
|
isActive = entity.isActive,
|
||||||
endOfLiveTimestampAsMilliseconds = entity.endOfLiveTimestampAsMilliseconds,
|
endOfLiveTimestampMillis = entity.endOfLiveTimestampMillis,
|
||||||
lastLocationDataContent = ContentMapper.map(entity.lastLocationContent).toModel<MessageBeaconLocationDataContent>()
|
lastLocationDataContent = ContentMapper.map(entity.lastLocationContent).toModel<MessageBeaconLocationDataContent>()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ internal object LiveLocationShareAggregatedSummaryMapper {
|
|||||||
eventId = model.eventId,
|
eventId = model.eventId,
|
||||||
roomId = model.roomId,
|
roomId = model.roomId,
|
||||||
isActive = model.isActive,
|
isActive = model.isActive,
|
||||||
endOfLiveTimestampAsMilliseconds = model.endOfLiveTimestampAsMilliseconds,
|
endOfLiveTimestampMillis = model.endOfLiveTimestampMillis,
|
||||||
lastLocationContent = ContentMapper.map(model.lastLocationDataContent.toContent())
|
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.ROOM_ID, String::class.java, FieldAttribute.REQUIRED)
|
||||||
.addField(LiveLocationShareAggregatedSummaryEntityFields.IS_ACTIVE, Boolean::class.java)
|
.addField(LiveLocationShareAggregatedSummaryEntityFields.IS_ACTIVE, Boolean::class.java)
|
||||||
.setNullable(LiveLocationShareAggregatedSummaryEntityFields.IS_ACTIVE, true)
|
.setNullable(LiveLocationShareAggregatedSummaryEntityFields.IS_ACTIVE, true)
|
||||||
.addField(LiveLocationShareAggregatedSummaryEntityFields.END_OF_LIVE_TIMESTAMP_AS_MILLISECONDS, Long::class.java)
|
.addField(LiveLocationShareAggregatedSummaryEntityFields.END_OF_LIVE_TIMESTAMP_MILLIS, Long::class.java)
|
||||||
.setNullable(LiveLocationShareAggregatedSummaryEntityFields.END_OF_LIVE_TIMESTAMP_AS_MILLISECONDS, true)
|
.setNullable(LiveLocationShareAggregatedSummaryEntityFields.END_OF_LIVE_TIMESTAMP_MILLIS, true)
|
||||||
.addField(LiveLocationShareAggregatedSummaryEntityFields.LAST_LOCATION_CONTENT, String::class.java)
|
.addField(LiveLocationShareAggregatedSummaryEntityFields.LAST_LOCATION_CONTENT, String::class.java)
|
||||||
?: return
|
?: return
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ internal open class LiveLocationShareAggregatedSummaryEntity(
|
|||||||
|
|
||||||
var isActive: Boolean? = null,
|
var isActive: Boolean? = null,
|
||||||
|
|
||||||
var endOfLiveTimestampAsMilliseconds: Long? = null,
|
var endOfLiveTimestampMillis: Long? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For now we persist this as a JSON for greater flexibility
|
* 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}")
|
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
|
aggregatedSummary.isActive = content.isLive
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,11 +77,11 @@ internal class DefaultLiveLocationAggregationProcessor @Inject constructor() : L
|
|||||||
roomId = roomId,
|
roomId = roomId,
|
||||||
eventId = targetEventId
|
eventId = targetEventId
|
||||||
)
|
)
|
||||||
val updatedLocationTimestamp = content.getBestTimestampAsMilliseconds() ?: 0
|
val updatedLocationTimestamp = content.getBestTimestampMillis() ?: 0
|
||||||
val currentLocationTimestamp = ContentMapper
|
val currentLocationTimestamp = ContentMapper
|
||||||
.map(aggregatedSummary.lastLocationContent)
|
.map(aggregatedSummary.lastLocationContent)
|
||||||
.toModel<MessageBeaconLocationDataContent>()
|
.toModel<MessageBeaconLocationDataContent>()
|
||||||
?.getBestTimestampAsMilliseconds()
|
?.getBestTimestampMillis()
|
||||||
?: 0
|
?: 0
|
||||||
|
|
||||||
if (updatedLocationTimestamp.isMoreRecentThan(currentLocationTimestamp)) {
|
if (updatedLocationTimestamp.isMoreRecentThan(currentLocationTimestamp)) {
|
||||||
|
@ -261,7 +261,7 @@ internal class LocalEchoEventFactory @Inject constructor(
|
|||||||
eventId = beaconInfoEventId
|
eventId = beaconInfoEventId
|
||||||
),
|
),
|
||||||
unstableLocationInfo = LocationInfo(geoUri = geoUri, description = geoUri),
|
unstableLocationInfo = LocationInfo(geoUri = geoUri, description = geoUri),
|
||||||
unstableTimestampAsMilliseconds = System.currentTimeMillis(),
|
unstableTimestampMillis = System.currentTimeMillis(),
|
||||||
)
|
)
|
||||||
val localId = LocalEcho.createLocalEchoId()
|
val localId = LocalEcho.createLocalEchoId()
|
||||||
return Event(
|
return Event(
|
||||||
|
Loading…
Reference in New Issue
Block a user