Skip to content

Commit

Permalink
Enable lifecycle autotracking by default (close #852) (#871)
Browse files Browse the repository at this point in the history
  • Loading branch information
matus-tomlein authored Jan 31, 2024
1 parent 3982f61 commit 6bf21d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/Core/Tracker/TrackerDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TrackerDefaults {
private(set) static var screenContext = true
private(set) static var applicationContext = true
private(set) static var autotrackScreenViews = true
private(set) static var lifecycleEvents = false
private(set) static var lifecycleEvents = true
private(set) static var exceptionEvents = true
private(set) static var installEvent = true
private(set) static var trackerDiagnostic = false
Expand Down
3 changes: 3 additions & 0 deletions Sources/Snowplow/Configurations/TrackerConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public protocol TrackerConfigurationProtocol: AnyObject {
@objc
var screenEngagementAutotracking: Bool { get set }
/// Whether to enable automatic tracking of background and foreground transitions.
/// Enabled by default.
@objc
var lifecycleAutotracking: Bool { get set }
/// Whether to enable automatic tracking of install event.
Expand Down Expand Up @@ -207,6 +208,7 @@ public class TrackerConfiguration: SerializableConfiguration, TrackerConfigurati

private var _lifecycleAutotracking: Bool?
/// Whether to enable automatic tracking of background and foreground transitions.
/// Enabled by default.
@objc
public var lifecycleAutotracking: Bool {
get { return _lifecycleAutotracking ?? sourceConfig?.lifecycleAutotracking ?? TrackerDefaults.lifecycleEvents }
Expand Down Expand Up @@ -479,6 +481,7 @@ public class TrackerConfiguration: SerializableConfiguration, TrackerConfigurati
}

/// Whether to enable automatic tracking of background and foreground transitions.
/// Enabled by default.
@objc
public func lifecycleAutotracking(_ lifecycleAutotracking: Bool) -> Self {
self.lifecycleAutotracking = lifecycleAutotracking
Expand Down

0 comments on commit 6bf21d4

Please sign in to comment.