Skip to content

Commit e813edb

Browse files
committed
Performed fixup for url options, lifecycle updates, objc compat
1 parent cb3ff57 commit e813edb

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

Sources/Segment/ObjC/ObjCConfiguration.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ public class ObjCConfiguration: NSObject {
2929

3030
/// Opt-in/out of tracking lifecycle events. The default value is `false`.
3131
@objc
32-
public var trackApplicationLifecycleEvents: TrackedLifecycleEvent {
32+
public var trackApplicationLifecycleEvents: Bool {
3333
get {
34-
return configuration.values.trackedApplicationLifecycleEvents
34+
return (configuration.values.trackedApplicationLifecycleEvents != .none)
3535
}
3636
set(value) {
37-
configuration.setTrackedApplicationLifecycleEvents(value)
37+
configuration.setTrackedApplicationLifecycleEvents(.all)
3838
}
3939
}
4040

Sources/Segment/Plugins/Platforms/iOS/iOSLifecycleEvents.swift

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class iOSLifecycleEvents: PlatformPlugin, iOSLifecycle {
5555

5656
if analytics?.configuration.values.trackedApplicationLifecycleEvents.contains(.applicationOpened) == true {
5757
let sourceApp: String = launchOptions?[UIApplication.LaunchOptionsKey.sourceApplication] as? String ?? ""
58-
let url: String = launchOptions?[UIApplication.LaunchOptionsKey.url] as? String ?? ""
58+
let url = urlFrom(launchOptions)
5959

6060
analytics?.track(name: "Application Opened", properties: [
6161
"from_background": false,
@@ -65,17 +65,6 @@ class iOSLifecycleEvents: PlatformPlugin, iOSLifecycle {
6565
"url": url
6666
])
6767
}
68-
69-
let sourceApp: String = launchOptions?[UIApplication.LaunchOptionsKey.sourceApplication] as? String ?? ""
70-
let url = urlFrom(launchOptions)
71-
72-
analytics?.track(name: "Application Opened", properties: [
73-
"from_background": false,
74-
"version": currentVersion,
75-
"build": currentBuild,
76-
"referring_application": sourceApp,
77-
"url": url
78-
])
7968

8069
UserDefaults.standard.setValue(currentVersion, forKey: Self.versionKey)
8170
UserDefaults.standard.setValue(currentBuild, forKey: Self.buildKey)

0 commit comments

Comments
 (0)