Skip to content

Commit

Permalink
Fixes to api helper
Browse files Browse the repository at this point in the history
  • Loading branch information
lmeier committed Nov 7, 2024
1 parent 0a4d040 commit 2236405
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sdk/src/main/java/io/radar/sdk/RadarApiHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@ internal open class RadarApiHelper(
val replays = params.optJSONArray("replays")

if (updatedAtMsDiff != -1L || replays != null) {
val nowMs = SystemClock.elapsedRealtimeNanos() / 1000000

val locationMs = params.optLong("locationMs", -1L)
val nowMs = SystemClock.elapsedRealtime()
if (locationMs != -1L){
val updatedAtMsDiff = nowMs - locationMs
params.put("updatedAtMsDiff", updatedAtMsDiff)
}

if (replays != null) {
val updatedReplays = ArrayList<JSONObject>(replays.length())
for (i in 0 until replays.length()) {
Expand All @@ -101,6 +103,7 @@ internal open class RadarApiHelper(
updatedReplays.add(it)
}
}
params.put("replays", updatedReplays)
}
}
urlConnection.doOutput = true
Expand Down

0 comments on commit 2236405

Please sign in to comment.