Skip to content

Commit

Permalink
Merge branch 'release/6.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
mscwilson committed Apr 19, 2024
2 parents c1be49c + 26d2ce3 commit 07536ea
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 67 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Version 6.0.3 (2024-04-18)
--------------------------
Add Subject config flag to avoid WindowManager bug (#657)
Catch more generic exceptions for InstallReferrer (#647)

Version 6.0.2 (2024-02-28)
--------------------------
Fix createTracker call hanging for 10 seconds if run on a background thread (#620)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.2
6.0.3
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ plugins {

subprojects {
group = 'com.snowplowanalytics'
version = '6.0.2'
version = '6.0.3'
repositories {
google()
maven {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ systemProp.org.gradle.internal.http.socketTimeout=120000
SONATYPE_STAGING_PROFILE=comsnowplowanalytics
GROUP=com.snowplowanalytics
POM_ARTIFACT_ID=snowplow-android-tracker
VERSION_NAME=6.0.2
VERSION_NAME=6.0.3

POM_NAME=snowplow-android-tracker
POM_PACKAGING=aar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ApplicationInstallEventTest {
.installAutotracking(true)
createTracker(listOf(trackerConfiguration, plugin))

Thread.sleep(1000)
Thread.sleep(1500)

// check if event was tracked
Assert.assertTrue(eventTracked)
Expand All @@ -67,7 +67,7 @@ class ApplicationInstallEventTest {
.installAutotracking(true)
createTracker(listOf(trackerConfiguration, plugin))

Thread.sleep(1000)
Thread.sleep(1500)

// check if event was tracked
Assert.assertTrue(eventTracked)
Expand All @@ -78,7 +78,7 @@ class ApplicationInstallEventTest {
// create tracker again
createTracker(listOf(trackerConfiguration, plugin))

Thread.sleep(1000)
Thread.sleep(1500)

// check if event was tracked
Assert.assertFalse(eventTracked)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class TestMediaController {
)
media?.track(MediaPlayEvent())

Thread.sleep(100)
Thread.sleep(200)

assertEquals(1, trackedEvents.size)
assertEquals(eventSchema("play"), firstEvent.schema)
Expand All @@ -102,7 +102,7 @@ class TestMediaController {
)
media?.track(MediaEndEvent())

Thread.sleep(100)
Thread.sleep(200)

assertEquals(1, trackedEvents.size)
assertEquals(eventSchema("end"), firstEvent.schema)
Expand All @@ -119,7 +119,7 @@ class TestMediaController {
media?.track(event = MediaSeekEndEvent(), player = MediaPlayerEntity(currentTime = 2.0))
media?.track(event = MediaSeekStartEvent(), player = MediaPlayerEntity(currentTime = 3.0))

Thread.sleep(100)
Thread.sleep(200)

assertEquals(3, trackedEvents.size)
assertEquals(2, trackedEvents.filter { it.schema == eventSchema("seek_start") }.size)
Expand All @@ -136,7 +136,7 @@ class TestMediaController {
media?.track(MediaPlayEvent())
media?.track(MediaPauseEvent())

Thread.sleep(100)
Thread.sleep(200)

assertEquals(1, trackedEvents.size)
assertEquals(eventSchema("play"), firstEvent.schema)
Expand All @@ -154,7 +154,7 @@ class TestMediaController {

media?.track(MediaPlayEvent())

Thread.sleep(100)
Thread.sleep(200)

assertEquals(1, trackedEvents.size)
assertNotNull(
Expand All @@ -178,7 +178,7 @@ class TestMediaController {
)
)

Thread.sleep(100)
Thread.sleep(200)

assertEquals(1, trackedEvents.size)
assertNotNull(
Expand All @@ -199,7 +199,7 @@ class TestMediaController {
media?.track(MediaPlaybackRateChangeEvent(newRate = 1.5))
media?.track(MediaPauseEvent())

Thread.sleep(100)
Thread.sleep(200)

assertEquals(2, trackedEvents.size)
val rateEvent = trackedEvents.find { it.schema == eventSchema("playback_rate_change") }
Expand Down Expand Up @@ -238,7 +238,7 @@ class TestMediaController {

media?.track(MediaFullscreenChangeEvent(fullscreen = true))

Thread.sleep(100)
Thread.sleep(200)

assertEquals(true, firstEvent.payload.get("fullscreen"))
assertEquals(true, firstPlayer?.get("fullscreen"))
Expand All @@ -253,7 +253,7 @@ class TestMediaController {

media?.track(MediaPictureInPictureChangeEvent(pictureInPicture = true))

Thread.sleep(100)
Thread.sleep(200)

assertEquals(true, firstEvent.payload.get("pictureInPicture"))
assertEquals(true, firstPlayer?.get("pictureInPicture"))
Expand All @@ -265,7 +265,7 @@ class TestMediaController {

media?.track(MediaAdFirstQuartileEvent())

Thread.sleep(100)
Thread.sleep(200)

assertEquals(25, firstEvent.payload.get("percentProgress"))
}
Expand All @@ -276,7 +276,7 @@ class TestMediaController {

media?.track(MediaAdMidpointEvent())

Thread.sleep(100)
Thread.sleep(200)

assertEquals(50, firstEvent.payload.get("percentProgress"))
}
Expand All @@ -287,7 +287,7 @@ class TestMediaController {

media?.track(MediaAdThirdQuartileEvent())

Thread.sleep(100)
Thread.sleep(200)

assertEquals(75, firstEvent.payload.get("percentProgress"))
}
Expand All @@ -301,7 +301,7 @@ class TestMediaController {
media?.track(MediaAdResumeEvent(percentProgress = 40))
media?.track(MediaAdPauseEvent(percentProgress = 50))

Thread.sleep(100)
Thread.sleep(200)

val adClickEvent = trackedEvents.find { it.schema == eventSchema("ad_click") }
assertEquals(15, adClickEvent?.payload?.get("percentProgress"))
Expand All @@ -326,7 +326,7 @@ class TestMediaController {
framesPerSecond = 60
))

Thread.sleep(100)
Thread.sleep(200)

assertEquals("720p", firstEvent.payload.get("previousQuality"))
assertEquals("1080p", firstEvent.payload.get("newQuality"))
Expand All @@ -344,7 +344,7 @@ class TestMediaController {
errorDescription = "Failed to load media"
))

Thread.sleep(100)
Thread.sleep(200)

assertEquals("501", firstEvent.payload.get("errorCode"))
assertEquals("forbidden", firstEvent.payload.get("errorName"))
Expand All @@ -363,7 +363,7 @@ class TestMediaController {
mapOf("url" to "https://www.youtube.com/watch?v=12345")
))

Thread.sleep(100)
Thread.sleep(200)

assertEquals("iglu:com.acme/video_played/jsonschema/1-0-0", firstEvent.schema)
assertEquals("Video", firstPlayer?.get("label"))
Expand All @@ -377,7 +377,7 @@ class TestMediaController {

media?.track(MediaPlayEvent())

Thread.sleep(100)
Thread.sleep(200)

assertEquals("media1", firstSession?.get("mediaSessionId"))
}
Expand All @@ -401,7 +401,7 @@ class TestMediaController {
media.update(player = MediaPlayerEntity(currentTime = 10.0))
media.track(MediaEndEvent())

Thread.sleep(100)
Thread.sleep(200)

val endEvent = trackedEvents.find { it.schema == eventSchema("end") }
val lastSession = endEvent?.entities?.find { it.map.get("schema") == sessionSchema }?.map?.get("data") as? Map<*, *>
Expand All @@ -427,7 +427,7 @@ class TestMediaController {

timer.fire()

Thread.sleep(100)
Thread.sleep(200)

assertEquals(1, trackedEvents.size)
assertEquals(10000L, timer.delay)
Expand All @@ -452,7 +452,7 @@ class TestMediaController {
media.track(MediaPauseEvent())
timer.fire()

Thread.sleep(100)
Thread.sleep(200)

assertEquals(4, trackedEvents.size)
}
Expand All @@ -475,7 +475,7 @@ class TestMediaController {
timer.fire()
}

Thread.sleep(100)
Thread.sleep(200)

assertEquals(2, trackedEvents.size)
}
Expand All @@ -498,7 +498,7 @@ class TestMediaController {
timer.fire()
}

Thread.sleep(100)
Thread.sleep(200)

assertEquals(5, trackedEvents.size)
}
Expand All @@ -519,7 +519,7 @@ class TestMediaController {
media?.update(player = MediaPlayerEntity(currentTime = i.toDouble()))
}

Thread.sleep(100)
Thread.sleep(200)

assertEquals(4, trackedEvents.size)
assertEquals(3, trackedEvents.filter { it.schema == eventSchema("percent_progress") }.size)
Expand All @@ -539,7 +539,7 @@ class TestMediaController {
media?.update(player = MediaPlayerEntity(currentTime = i.toDouble()))
}

Thread.sleep(100)
Thread.sleep(200)

assertEquals(2, trackedEvents.size)

Expand All @@ -562,7 +562,7 @@ class TestMediaController {
media?.update(player = MediaPlayerEntity(currentTime = i.toDouble()))
}

Thread.sleep(100)
Thread.sleep(200)

assertEquals(1, trackedEvents.size)
}
Expand All @@ -586,7 +586,7 @@ class TestMediaController {
media?.update(player = MediaPlayerEntity(currentTime = i.toDouble()))
}

Thread.sleep(100)
Thread.sleep(200)

assertEquals(5, trackedEvents.size)
assertEquals(3, trackedEvents.filter { it.schema == eventSchema("percent_progress") }.size)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class PluginsTest {
val tracker = createTracker(listOf(plugin, testPlugin))
tracker.track(Structured("cat", "act"))

Thread.sleep(100)
Thread.sleep(200)
Assert.assertTrue(expectation)
}

Expand All @@ -84,7 +84,7 @@ class PluginsTest {
val tracker = createTracker(listOf(plugin1, plugin2, testPlugin))
tracker.track(ScreenView("sv"))

Thread.sleep(100)
Thread.sleep(200)
Assert.assertTrue(expectation)
}

Expand Down Expand Up @@ -112,7 +112,7 @@ class PluginsTest {
tracker.track(SelfDescribing("schema1", emptyMap()))
tracker.track(SelfDescribing("schema2", emptyMap()))

Thread.sleep(100)
Thread.sleep(200)
Assert.assertTrue(event1HasEntity!!)
Assert.assertFalse(event2HasEntity!!)
}
Expand All @@ -135,7 +135,7 @@ class PluginsTest {
tracker.track(SelfDescribing("schema2", emptyMap()))
tracker.track(Structured("cat", "act"))

Thread.sleep(100)
Thread.sleep(200)
Assert.assertTrue(event1Called)
Assert.assertFalse(event2Called)
Assert.assertFalse(event3Called)
Expand All @@ -156,7 +156,7 @@ class PluginsTest {
tracker.track(SelfDescribing("schema1", emptyMap()))
tracker.track(Structured("cat", "act"))

Thread.sleep(100)
Thread.sleep(200)
Assert.assertTrue(structuredCalled)
Assert.assertFalse(selfDescribingCalled)
}
Expand All @@ -172,7 +172,7 @@ class PluginsTest {

tracker.track(ScreenView("sv"))

Thread.sleep(100)
Thread.sleep(200)
Assert.assertTrue(expectation)
}

Expand All @@ -187,7 +187,7 @@ class PluginsTest {

tracker.track(ScreenView("sv"))

Thread.sleep(100)
Thread.sleep(200)
Assert.assertFalse(pluginCalled)
}

Expand All @@ -203,12 +203,12 @@ class PluginsTest {
val tracker = createTracker(listOf(filterPlugin, afterTrackPlugin))

tracker.track(SelfDescribing("s1", emptyMap()))
Thread.sleep(100)
Thread.sleep(200)

Assert.assertFalse(afterTrackCalled)

tracker.track(SelfDescribing("s2", emptyMap()))
Thread.sleep(100)
Thread.sleep(200)

Assert.assertTrue(afterTrackCalled)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ class InstallReferrerDetails(
} catch (_: RemoteException) {
Logger.d(TAG, "Install referrer API remote exception.")
callback(null)
} catch (_: NoSuchMethodError) {
Logger.d(TAG, "Upgrade InstallReferrer package to v1.1 or higher to add the install referrer details entity.")
callback(null)
}
}
InstallReferrerResponse.FEATURE_NOT_SUPPORTED -> {
Expand All @@ -99,7 +102,7 @@ class InstallReferrerDetails(
})
}

fun isInstallReferrerPackageAvailable(): Boolean {
private fun isInstallReferrerPackageAvailable(): Boolean {
try {
Class.forName("com.android.installreferrer.api.InstallReferrerStateListener")
return true
Expand Down
Loading

0 comments on commit 07536ea

Please sign in to comment.