Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ import org.owntracks.android.preferences.Preferences
import org.owntracks.android.preferences.types.MonitoringMode

@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXTERNAL_PROPERTY, property = "_type")
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.EXTERNAL_PROPERTY,
property = "_type",
)
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
open class MessageLocation(
private val messageWithCreatedAtImpl: MessageWithCreatedAt = MessageCreatedAtNow(RealClock()),
private val messageWithId: MessageWithId = MessageWithRandomId()
private val messageWithId: MessageWithId = MessageWithRandomId(),
) :
MessageBase(),
MessageWithCreatedAt by messageWithCreatedAtImpl,
Expand Down Expand Up @@ -70,6 +73,8 @@ open class MessageLocation(

@JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty("tid") var trackerId: String? = null

@JsonProperty("address") var address: String? = null

override fun isValidMessage(): Boolean {
return timestamp > 0
}
Expand Down Expand Up @@ -108,7 +113,7 @@ open class MessageLocation(
@JvmStatic
fun fromLocationAndWifiInfo(
location: @NotNull Location,
wifiInfoProvider: WifiInfoProvider
wifiInfoProvider: WifiInfoProvider,
): @NotNull MessageLocation =
if (wifiInfoProvider.isConnected()) {
fromLocation(location).apply {
Expand All @@ -134,6 +139,6 @@ open class MessageLocation(
BEACON("b"), // Generated by iOS beacons
IOS_FREQUENT_LOCATIONS("v"), // Generated by iOS frequent locations
IOS_FOLLOW_CIRCULAR("C"), // Generated by iOS follow circular region
DEFAULT("")
DEFAULT(""),
}
}
Loading