Skip to content

Commit

Permalink
Merge branch 'release/6.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mscwilson committed Feb 14, 2024
2 parents e86d218 + c2a6d56 commit 6b50e44
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 6 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.1 (2024-02-14)
--------------------------
Make EmitterEvent constructor public (#876)
Add percent progress to event (#875)

Version 6.0.0 (2024-02-01)
--------------------------
- Add screen engagement tracking of time spent and list items scrolled on a screen (#851)
Expand Down
2 changes: 1 addition & 1 deletion Examples
2 changes: 1 addition & 1 deletion SnowplowTracker.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SnowplowTracker"
s.version = "6.0.0"
s.version = "6.0.1"
s.summary = "Snowplow event tracker for iOS, macOS, tvOS, watchOS for apps and games."
s.description = <<-DESC
Snowplow is a mobile and event analytics platform with a difference: rather than tell our users how they should analyze their data, we deliver their event-level data in their own data warehouse, on their own Amazon Redshift or Postgres database, so they can analyze it any way they choose. Snowplow mobile is used by data-savvy games companies and app developers to better understand their users and how they engage with their games and applications. Snowplow is open source using the business-friendly Apache License, Version 2.0 and scales horizontally to many billions of events.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Core/Media/Controllers/MediaTrackingImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class MediaTrackingImpl: MediaTracking {
addEntitiesAndTrack(event: event)
}
if shouldSendPercentProgress() {
addEntitiesAndTrack(event: MediaPercentProgressEvent())
addEntitiesAndTrack(event: MediaPercentProgressEvent(percentProgress: self.player.percentProgress))
}

// update state for events after this one
Expand Down
9 changes: 9 additions & 0 deletions Sources/Core/Media/Events/MediaPercentProgressEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,20 @@ import Foundation
/** Media player event fired when a percentage boundary set in the `boundaries` list in `MediaTrackingConfiguration` is reached. */
class MediaPercentProgressEvent: SelfDescribingAbstract {

let percentProgress: Int?

override var schema: String {
return MediaSchemata.eventSchema("percent_progress")
}

override var payload: [String : Any] {
if let percentProgress = percentProgress {
return ["percentProgress": percentProgress]
}
return [:]
}

public init(percentProgress: Int?) {
self.percentProgress = percentProgress
}
}
2 changes: 1 addition & 1 deletion Sources/Core/TrackerConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import Foundation

// --- Version
let kSPRawVersion = "6.0.0"
let kSPRawVersion = "6.0.1"
#if os(iOS)
let kSPVersion = "ios-\(kSPRawVersion)"
#elseif os(tvOS)
Expand Down
3 changes: 2 additions & 1 deletion Sources/Snowplow/Emitter/EmitterEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public class EmitterEvent: NSObject {
private(set) var payload: Payload
private(set) var storeId: Int64

init(payload: Payload, storeId: Int64) {
@objc
public init(payload: Payload, storeId: Int64) {
self.payload = payload
self.storeId = storeId
}
Expand Down
19 changes: 19 additions & 0 deletions Tests/Media/TestMediaController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,25 @@ class TestMediaController: XCTestCase {
XCTAssertEqual(3, trackedEvents.filter { $0.schema?.contains("percent_progress") ?? false }.count)
}

func testProgressEventsShouldHavePercentValue() {
let configuration = MediaTrackingConfiguration(id: "media",
player: MediaPlayerEntity(duration: 100))
.boundaries([5])
let media = mediaController?.startMediaTracking(configuration: configuration)

media?.track(MediaPlayEvent())
for i in 1..<10 {
media?.update(player: MediaPlayerEntity(currentTime: Double(i)))
}

waitForEventsToBeTracked()

XCTAssertEqual(2, trackedEvents.count)
let progressEvents = trackedEvents.filter { $0.schema?.contains("percent_progress") ?? false }
XCTAssertEqual(1, progressEvents.count)
XCTAssertEqual(5, progressEvents[0].payload["percentProgress"] as? Int)
}

func testDoesntSendProgressEventsIfPaused() {
let configuration = MediaTrackingConfiguration(id: "media",
player: MediaPlayerEntity(duration: 100))
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.0
6.0.1

0 comments on commit 6b50e44

Please sign in to comment.