-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ios): add screen view event (#1721)
- Loading branch information
Showing
15 changed files
with
152 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// | ||
// ScreenViewData.swift | ||
// MeasureSDK | ||
// | ||
// Created by Adwin Ross on 08/01/25. | ||
// | ||
|
||
import Foundation | ||
|
||
struct ScreenViewData: Codable { | ||
let name: String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// UserTriggeredEventCollector.swift | ||
// MeasureSDK | ||
// | ||
// Created by Adwin Ross on 08/01/25. | ||
// | ||
|
||
import Foundation | ||
|
||
protocol UserTriggeredEventCollector { | ||
func trackScreenView(_ screenName: String) | ||
func enable() | ||
func disable() | ||
} | ||
|
||
final class BaseUserTriggeredEventCollector: UserTriggeredEventCollector { | ||
private let eventProcessor: EventProcessor | ||
private let timeProvider: TimeProvider | ||
private var isEnabled = false | ||
|
||
init(eventProcessor: EventProcessor, timeProvider: TimeProvider) { | ||
self.eventProcessor = eventProcessor | ||
self.timeProvider = timeProvider | ||
} | ||
|
||
func enable() { | ||
isEnabled = true | ||
} | ||
|
||
func disable() { | ||
isEnabled = false | ||
} | ||
|
||
func trackScreenView(_ screenName: String) { | ||
guard isEnabled else { return } | ||
|
||
let data = ScreenViewData(name: screenName) | ||
eventProcessor.trackUserTriggered(data: data, | ||
timestamp: timeProvider.now(), | ||
type: .screenView, | ||
attributes: nil, | ||
sessionId: nil, | ||
attachments: nil, | ||
userDefinedAttributes: nil) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters