Open markst opened 4 months ago
One solution could be to use the TrackerDefaults.devicePlatform
for the nil coalescing optional TrackerConfiguration
initialiser:
if let devicePlatform = dictionary["devicePlatform"] as? String {
self.devicePlatform = stringToDevicePlatform(devicePlatform) ?? TrackerDefaults.devicePlatform
}
or in the getter optional rather than defaulting to mobile
:
@objc
public var devicePlatform: DevicePlatform {
get { return _devicePlatform ?? sourceConfig?.devicePlatform ?? TrackerDefaults.devicePlatform }
our solution for now is to simply provide a devicePlatform:
TrackerConfiguration()
.appId(appId)
.devicePlatform(.current)
extension DevicePlatform {
/// Local replacement for `Utilities.platform`
static var current: DevicePlatform {
#if os(tvOS)
return .connectedTV
#else
return .mobile
#endif
}
}
Describe the bug
If no
devicePlatform
is provided toTrackerConfiguration
, the device platform defaults tomobile
To Reproduce
Device platform is initialised here: https://github.com/snowplow/snowplow-ios-tracker/blob/master/Sources/Core/Utils/Utilities.swift#L45
Tracker adds
devicePlatform
with paramp
to payload: https://github.com/snowplow/snowplow-ios-tracker/blob/master/Sources/Core/Tracker/Tracker.swift#L525Which is redefined here when providing
TrackerConfiguration
: https://github.com/snowplow/snowplow-ios-tracker/blob/master/Sources/Core/Tracker/ServiceProvider.swift#L298Which defaults to
DevicePlatform.mobile
Device information (please complete the following information):