Skip to content

Commit

Permalink
Code review fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Onuray Sahin committed Apr 1, 2022
1 parent 922d68c commit 97de6de
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 The Matrix.org Foundation C.I.C.
* Copyright 2022 The Matrix.org Foundation C.I.C.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,7 +14,7 @@
* limitations under the License.
*/

package org.matrix.android.sdk.api.session.room.model
package org.matrix.android.sdk.api.session.room.model.livelocation

import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 The Matrix.org Foundation C.I.C.
* Copyright (c) 2022 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,11 +14,12 @@
* limitations under the License.
*/

package org.matrix.android.sdk.api.session.room.model
package org.matrix.android.sdk.api.session.room.model.livelocation

import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import org.matrix.android.sdk.api.session.room.model.message.LocationAsset
import org.matrix.android.sdk.api.session.room.model.message.LocationAssetType

@JsonClass(generateAdapter = true)
data class LiveLocationBeaconContent(
Expand All @@ -31,17 +32,17 @@ data class LiveLocationBeaconContent(
* Beacon creation timestamp.
*/
@Json(name = "org.matrix.msc3488.ts") val unstableTimestampAsMilliseconds: Long? = null,
@Json(name = "m.ts") val timestampAsMillisecond: Long? = null,
@Json(name = "m.ts") val timestampAsMilliseconds: Long? = null,
/**
* Live location asset type.
*/
@Json(name = "org.matrix.msc3488.asset") val unstableLocationAsset: LocationAsset = LocationAsset("m.self"),
@Json(name = "org.matrix.msc3488.asset") val unstableLocationAsset: LocationAsset = LocationAsset(LocationAssetType.SELF),
@Json(name = "m.asset") val locationAsset: LocationAsset? = null
) {

fun getBestBeaconInfo() = beaconInfo ?: unstableBeaconInfo

fun getBestTimestampAsMilliseconds() = timestampAsMillisecond ?: unstableTimestampAsMilliseconds
fun getBestTimestampAsMilliseconds() = timestampAsMilliseconds ?: unstableTimestampAsMilliseconds

fun getBestLocationAsset() = locationAsset ?: unstableLocationAsset
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import kotlinx.parcelize.Parcelize
import org.matrix.android.sdk.api.session.Session
import org.matrix.android.sdk.api.session.events.model.EventType.generateBeaconInfoStateEventType
import org.matrix.android.sdk.api.session.events.model.toContent
import org.matrix.android.sdk.api.session.room.model.BeaconInfo
import org.matrix.android.sdk.api.session.room.model.LiveLocationBeaconContent
import org.matrix.android.sdk.api.session.room.model.livelocation.BeaconInfo
import org.matrix.android.sdk.api.session.room.model.livelocation.LiveLocationBeaconContent
import timber.log.Timber
import java.util.Timer
import java.util.TimerTask
Expand Down Expand Up @@ -83,7 +83,7 @@ class LocationSharingService : VectorService(), LocationTracker.Callback {
activeSessionHolder
.getSafeActiveSession()
?.let { session ->
session.coroutineScope.launch {
session.coroutineScope.launch(session.coroutineDispatchers.io) {
sendBeaconInfo(session, roomArgs)
}
}
Expand Down

0 comments on commit 97de6de

Please sign in to comment.