Skip to content

Commit

Permalink
Merge branch 'issue/parsely_tracker_kotlin_migration' into introduce_…
Browse files Browse the repository at this point in the history
…binary_compatibility_validator
  • Loading branch information
wzieba committed Jan 15, 2024
2 parents 43453f3 + c2cb617 commit 884ed90
Show file tree
Hide file tree
Showing 7 changed files with 393 additions and 356 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class FunctionalTests {
// when
startTimestamp = System.currentTimeMillis().milliseconds
parselyTracker.trackPageview("url")
parselyTracker.startEngagement(engagementUrl, null)
parselyTracker.startEngagement(engagementUrl)
}

Thread.sleep((firstInterval + secondInterval + pauseInterval).inWholeMilliseconds)
Expand Down Expand Up @@ -315,7 +315,7 @@ class FunctionalTests {
activity: Activity,
flushInterval: Duration = defaultFlushInterval
): ParselyTracker {
val field: Field = ParselyTracker::class.java.getDeclaredField("ROOT_URL")
val field: Field = ParselyTrackerInternal::class.java.getDeclaredField("ROOT_URL")
field.isAccessible = true
field.set(this, url)
return ParselyTracker.sharedInstance(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import kotlinx.coroutines.launch
* 2. Progressive backoff for long engagements to save data.
*/
internal class EngagementManager(
private val parselyTracker: ParselyTracker,
private val eventQueuer: EventQueuer,
private var latestDelayMillis: Long,
private val baseEvent: Map<String, Any>,
private val intervalCalculator: HeartbeatIntervalCalculator,
Expand Down Expand Up @@ -76,7 +76,7 @@ internal class EngagementManager(
totalTime += inc
event["inc"] = inc / 1000
event["tt"] = totalTime
parselyTracker.enqueueEvent(event)
eventQueuer.enqueueEvent(event)
}

val intervalMillis: Double
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.parsely.parselyandroid

internal interface EventQueuer {
fun enqueueEvent(event: Map<String, Any>)
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ internal class FlushQueue(
log("Sending request with %d events", eventsToSend.size)
val jsonPayload = toParselyEventsPayload(eventsToSend)
log("POST Data %s", jsonPayload)
log("Requested %s", ParselyTracker.ROOT_URL)
log("Requested %s", ParselyTrackerInternal.ROOT_URL)
restClient.send(jsonPayload)
.fold(
onSuccess = {
Expand Down
Loading

0 comments on commit 884ed90

Please sign in to comment.