Skip to content

Commit 7d8aa4a

Browse files
authored
Fix compilation issues & cleanup (#29)
* Get it compiling again & cleanup * Update example & analytics version
1 parent fe84990 commit 7d8aa4a

File tree

5 files changed

+26
-133
lines changed

5 files changed

+26
-133
lines changed

Example/BasicExample/BasicExample.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.resolved

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let package = Package(
1919
dependencies: [
2020
// Dependencies declare other packages that this package depends on.
2121
// .package(url: /* package url */, from: "1.0.0"),
22-
.package(url: "https://github.com/segmentio/analytics-swift.git", from: "1.5.9")
22+
.package(url: "https://github.com/segmentio/analytics-swift.git", from: "1.6.0")
2323
],
2424
targets: [
2525
// Targets are the basic building blocks of a package. A target can define a module or a test suite.

Sources/SegmentAmplitude/AmplitudeSession.swift

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,23 @@ public class AmplitudeSession: EventPlugin, iOSLifecycle {
4848
private var storage = Storage()
4949

5050
internal var eventSessionID: Int64 = -1
51-
@Atomic internal var sessionID: Int64 {
51+
@Atomic internal var sessionID: Int64 = -1 {
5252
didSet {
5353
storage.write(key: Storage.Constants.previousSessionID, value: sessionID)
5454
debugLog("sessionID set to: \(sessionID)")
5555
}
5656
}
5757

58-
@Atomic internal var lastEventTime: Int64 {
58+
@Atomic internal var lastEventTime: Int64 = -1 {
5959
didSet {
6060
storage.write(key: Storage.Constants.lastEventTime, value: lastEventTime)
6161
}
6262
}
6363

6464
public init() {
65-
self.sessionID = storage.read(key: Storage.Constants.previousSessionID) ?? -1
66-
self.lastEventTime = storage.read(key: Storage.Constants.lastEventTime) ?? -1
65+
_sessionID.set(storage.read(key: Storage.Constants.previousSessionID) ?? -1)
66+
_lastEventTime.set(storage.read(key: Storage.Constants.lastEventTime) ?? -1)
67+
6768
debugLog("startup sessionID = \(sessionID)")
6869
}
6970

@@ -81,9 +82,9 @@ public class AmplitudeSession: EventPlugin, iOSLifecycle {
8182
if type != .initial { return }
8283

8384
if settings.hasIntegrationSettings(key: key) {
84-
active = true
85+
_active.set(true)
8586
} else {
86-
active = false
87+
_active.set(false)
8788
}
8889
}
8990

@@ -118,7 +119,7 @@ public class AmplitudeSession: EventPlugin, iOSLifecycle {
118119

119120
// if it's a start event, set a new sessionID
120121
if eventName == Constants.ampSessionStartEvent {
121-
resetPending = false
122+
_resetPending.set(false)
122123
eventSessionID = sessionID
123124
debugLog("NewSession = \(eventSessionID)")
124125
}
@@ -137,7 +138,7 @@ public class AmplitudeSession: EventPlugin, iOSLifecycle {
137138
workingEvent = trackEvent as? T
138139
}
139140

140-
lastEventTime = newTimestamp()
141+
_lastEventTime.set(newTimestamp())
141142
return workingEvent
142143
}
143144

@@ -152,7 +153,7 @@ public class AmplitudeSession: EventPlugin, iOSLifecycle {
152153

153154
public func applicationWillResignActive(application: UIApplication?) {
154155
debugLog("Background: \(eventSessionID)")
155-
lastEventTime = newTimestamp()
156+
_lastEventTime.set(newTimestamp())
156157
}
157158
}
158159

@@ -192,8 +193,8 @@ extension AmplitudeSession {
192193

193194
private func startNewSession() {
194195
if resetPending { return }
195-
resetPending = true
196-
sessionID = newTimestamp()
196+
_resetPending.set(true)
197+
_sessionID.set(newTimestamp())
197198
if eventSessionID == -1 {
198199
// we only wanna do this if we had nothing before, so each
199200
// event actually HAS a sessionID of some kind associated.
@@ -217,7 +218,7 @@ extension AmplitudeSession {
217218
}
218219

219220
// we'll consider this our new lastEventTime
220-
lastEventTime = timestamp
221+
_lastEventTime.set(timestamp)
221222
// end previous session
222223
endSession()
223224
// start new session

Sources/SegmentAmplitude/Session.swift

Lines changed: 0 additions & 108 deletions
This file was deleted.

0 commit comments

Comments
 (0)