Skip to content

Commit 71cbc88

Browse files
authored
Merge pull request #2 from segment-integrations/bsneed/atomic_fix
Fixed compile issue w/ Analytics-Swift 1.6
2 parents da8c497 + 552d955 commit 71cbc88

9 files changed

+51
-42
lines changed

.github/workflows/swift.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
with:
3737
xcode-version: latest-stable
3838
- uses: actions/checkout@v2
39-
- run: xcodebuild -scheme SegmentConsent test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13'
39+
- run: xcodebuild -scheme SegmentConsent test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15'
4040

4141
build_and_test_tvos:
4242
needs: cancel_previous

Package.resolved

+13-4
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,26 @@
55
"kind" : "remoteSourceControl",
66
"location" : "https://github.com/segmentio/analytics-swift.git",
77
"state" : {
8-
"revision" : "efc111b5fccaebd1063ef0db6d206c252da387ec",
9-
"version" : "1.4.8"
8+
"revision" : "338be8f55c83309f10d2cfd0193505117b4ab2d5",
9+
"version" : "1.6.0"
10+
}
11+
},
12+
{
13+
"identity" : "jsonsafeencoding-swift",
14+
"kind" : "remoteSourceControl",
15+
"location" : "https://github.com/segmentio/jsonsafeencoding-swift.git",
16+
"state" : {
17+
"revision" : "af6a8b360984085e36c6341b21ecb35c12f47ebd",
18+
"version" : "2.0.0"
1019
}
1120
},
1221
{
1322
"identity" : "sovran-swift",
1423
"kind" : "remoteSourceControl",
1524
"location" : "https://github.com/segmentio/Sovran-Swift.git",
1625
"state" : {
17-
"revision" : "64f3b5150c282a34af4578188dce2fd597e600e3",
18-
"version" : "1.1.0"
26+
"revision" : "24867f3e4ac62027db9827112135e6531b6f4051",
27+
"version" : "1.1.2"
1928
}
2029
}
2130
],

Package.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ let package = Package(
88
platforms: [
99
.macOS("10.15"),
1010
.iOS("13.0"),
11-
.tvOS("11.0")
11+
.tvOS("13.0")
1212
],
1313
products: [
1414
// Products define the executables and libraries a package produces, and make them visible to other packages.
@@ -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.4.8")
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/SegmentConsent-Tests/ConsentBlockerTests.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ final class ConsentBlockerTests: XCTestCase {
1717
}
1818

1919
func testBlockWhenPartialConsentAvailable() {
20-
let analytics = Analytics(configuration: Configuration(writeKey: "test").trackApplicationLifecycleEvents(false))
20+
let analytics = Analytics(configuration: Configuration(writeKey: "cbt.testBlockWhenPartialConsentAvailable").trackApplicationLifecycleEvents(false))
2121

2222
// Artificially give segment.io destination some consent settings
2323
let segmentSettings = [
@@ -51,7 +51,7 @@ final class ConsentBlockerTests: XCTestCase {
5151
}
5252

5353
func testBlockBecauseNoConsentSettings() {
54-
let analytics = Analytics(configuration: Configuration(writeKey: "test").trackApplicationLifecycleEvents(false))
54+
let analytics = Analytics(configuration: Configuration(writeKey: "cbt.testBlockBecauseNoConsentSettings").trackApplicationLifecycleEvents(false))
5555
let output = OutputReaderPlugin()
5656
let consentManager = ConsentManager(provider: NoConsentProvider())
5757

@@ -72,7 +72,7 @@ final class ConsentBlockerTests: XCTestCase {
7272
}
7373

7474
func testBlockBecauseNoStamp() {
75-
let analytics = Analytics(configuration: Configuration(writeKey: "test").trackApplicationLifecycleEvents(false))
75+
let analytics = Analytics(configuration: Configuration(writeKey: "cbt.testBlockBecauseNoStamp").trackApplicationLifecycleEvents(false))
7676
let output = OutputReaderPlugin()
7777
let consentManager = ConsentManager(provider: AllConsentProvider())
7878

@@ -106,7 +106,7 @@ final class ConsentBlockerTests: XCTestCase {
106106
}
107107

108108
func testBlockBecauseNoConsent() {
109-
let analytics = Analytics(configuration: Configuration(writeKey: "test").trackApplicationLifecycleEvents(false))
109+
let analytics = Analytics(configuration: Configuration(writeKey: "cbt.testBlockBecauseNoConsent").trackApplicationLifecycleEvents(false))
110110
let output = OutputReaderPlugin()
111111
let consentManager = ConsentManager(provider: NoConsentProvider())
112112

Sources/SegmentConsent-Tests/ConsentNotEnabledAtSegment.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ final class ConsentNotEnabledAtSegment: XCTestCase {
2020
}
2121

2222
func testNoToAll() {
23-
removeUserDefaults(forWriteKey: "test")
23+
removeUserDefaults(forWriteKey: "testNoToAll")
2424

2525
let settings = Settings.load(resource: "ConsentNotEnabledAtSegment.json", bundle: Bundle.module)
26-
let analytics = Analytics(configuration: Configuration(writeKey: "test")
26+
let analytics = Analytics(configuration: Configuration(writeKey: "testNoToAll")
2727
.trackApplicationLifecycleEvents(false)
2828
.defaultSettings(settings)
2929
)
@@ -82,10 +82,10 @@ final class ConsentNotEnabledAtSegment: XCTestCase {
8282
}
8383

8484
func testYesToSome() {
85-
removeUserDefaults(forWriteKey: "test")
85+
removeUserDefaults(forWriteKey: "testYesToSome")
8686

8787
let settings = Settings.load(resource: "ConsentNotEnabledAtSegment.json", bundle: Bundle.module)
88-
let analytics = Analytics(configuration: Configuration(writeKey: "test")
88+
let analytics = Analytics(configuration: Configuration(writeKey: "testYesToSome")
8989
.trackApplicationLifecycleEvents(false)
9090
.defaultSettings(settings)
9191
)
@@ -144,10 +144,10 @@ final class ConsentNotEnabledAtSegment: XCTestCase {
144144
}
145145

146146
func testYesToAll() {
147-
removeUserDefaults(forWriteKey: "test")
147+
removeUserDefaults(forWriteKey: "testYesToAll")
148148

149149
let settings = Settings.load(resource: "ConsentNotEnabledAtSegment.json", bundle: Bundle.module)
150-
let analytics = Analytics(configuration: Configuration(writeKey: "test")
150+
let analytics = Analytics(configuration: Configuration(writeKey: "testYesToAll")
151151
.trackApplicationLifecycleEvents(false)
152152
.defaultSettings(settings)
153153
)

Sources/SegmentConsent-Tests/DestinationsMultipleCategories.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ final class DestinationsMultipleCategoriesTests: XCTestCase {
2020
}
2121

2222
func testNoToAll() {
23-
removeUserDefaults(forWriteKey: "test")
23+
removeUserDefaults(forWriteKey: "dmc.testNoToAll")
2424

2525
let settings = Settings.load(resource: "DestinationsMultipleCategories.json", bundle: Bundle.module)
26-
let analytics = Analytics(configuration: Configuration(writeKey: "test")
26+
let analytics = Analytics(configuration: Configuration(writeKey: "dmc.testNoToAll")
2727
.trackApplicationLifecycleEvents(false)
2828
.defaultSettings(settings)
2929
)
@@ -67,10 +67,10 @@ final class DestinationsMultipleCategoriesTests: XCTestCase {
6767
}
6868

6969
func testYesTo1() {
70-
removeUserDefaults(forWriteKey: "test")
70+
removeUserDefaults(forWriteKey: "dmc.testYesTo1")
7171

7272
let settings = Settings.load(resource: "DestinationsMultipleCategories.json", bundle: Bundle.module)
73-
let analytics = Analytics(configuration: Configuration(writeKey: "test")
73+
let analytics = Analytics(configuration: Configuration(writeKey: "dmc.testYesTo1")
7474
.trackApplicationLifecycleEvents(false)
7575
.defaultSettings(settings)
7676
)
@@ -114,10 +114,10 @@ final class DestinationsMultipleCategoriesTests: XCTestCase {
114114
}
115115

116116
func testYesTo2() {
117-
removeUserDefaults(forWriteKey: "test")
117+
removeUserDefaults(forWriteKey: "dmc.testYesTo2")
118118

119119
let settings = Settings.load(resource: "DestinationsMultipleCategories.json", bundle: Bundle.module)
120-
let analytics = Analytics(configuration: Configuration(writeKey: "test")
120+
let analytics = Analytics(configuration: Configuration(writeKey: "dmc.testYesTo2")
121121
.trackApplicationLifecycleEvents(false)
122122
.defaultSettings(settings)
123123
)
@@ -161,10 +161,10 @@ final class DestinationsMultipleCategoriesTests: XCTestCase {
161161
}
162162

163163
func testYesToAll() {
164-
removeUserDefaults(forWriteKey: "test")
164+
removeUserDefaults(forWriteKey: "dmc.testYesToAll")
165165

166166
let settings = Settings.load(resource: "DestinationsMultipleCategories.json", bundle: Bundle.module)
167-
let analytics = Analytics(configuration: Configuration(writeKey: "test")
167+
let analytics = Analytics(configuration: Configuration(writeKey: "dmc.testYesToAll")
168168
.trackApplicationLifecycleEvents(false)
169169
.defaultSettings(settings)
170170
)

Sources/SegmentConsent-Tests/NoUnmappedDestinationsTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ final class NoUnmappedDestinationsTests: XCTestCase {
2020
}
2121

2222
func testNoToAll() {
23-
removeUserDefaults(forWriteKey: "test")
23+
removeUserDefaults(forWriteKey: "nud.testNoToAll")
2424

2525
let settings = Settings.load(resource: "NoUnmappedDestinations.json", bundle: Bundle.module)
26-
let analytics = Analytics(configuration: Configuration(writeKey: "test")
26+
let analytics = Analytics(configuration: Configuration(writeKey: "nud.testNoToAll")
2727
.trackApplicationLifecycleEvents(false)
2828
.defaultSettings(settings)
2929
)

Sources/SegmentConsent-Tests/UnmappedDestinationsTests.swift

+14-14
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ final class UnmappedDestinationsTests: XCTestCase {
2020
}
2121

2222
func testNoToAll() {
23-
removeUserDefaults(forWriteKey: "test")
23+
removeUserDefaults(forWriteKey: "ud.testNoToAll")
2424

2525
let settings = Settings.load(resource: "UnmappedDestinations.json", bundle: Bundle.module)
26-
let analytics = Analytics(configuration: Configuration(writeKey: "test")
26+
let analytics = Analytics(configuration: Configuration(writeKey: "ud.testNoToAll")
2727
.trackApplicationLifecycleEvents(false)
2828
.defaultSettings(settings)
2929
)
@@ -82,10 +82,10 @@ final class UnmappedDestinationsTests: XCTestCase {
8282
}
8383

8484
func testYesTo1() {
85-
removeUserDefaults(forWriteKey: "test")
85+
removeUserDefaults(forWriteKey: "ud.testYesTo1")
8686

8787
let settings = Settings.load(resource: "UnmappedDestinations.json", bundle: Bundle.module)
88-
let analytics = Analytics(configuration: Configuration(writeKey: "test")
88+
let analytics = Analytics(configuration: Configuration(writeKey: "ud.testYesTo1")
8989
.trackApplicationLifecycleEvents(false)
9090
.defaultSettings(settings)
9191
)
@@ -144,10 +144,10 @@ final class UnmappedDestinationsTests: XCTestCase {
144144
}
145145

146146
func testYesTo2() {
147-
removeUserDefaults(forWriteKey: "test")
147+
removeUserDefaults(forWriteKey: "ud.testYesTo2")
148148

149149
let settings = Settings.load(resource: "UnmappedDestinations.json", bundle: Bundle.module)
150-
let analytics = Analytics(configuration: Configuration(writeKey: "test")
150+
let analytics = Analytics(configuration: Configuration(writeKey: "ud.testYesTo2")
151151
.trackApplicationLifecycleEvents(false)
152152
.defaultSettings(settings)
153153
)
@@ -206,10 +206,10 @@ final class UnmappedDestinationsTests: XCTestCase {
206206
}
207207

208208
func testYesTo3() {
209-
removeUserDefaults(forWriteKey: "test")
209+
removeUserDefaults(forWriteKey: "ud.testYesTo3")
210210

211211
let settings = Settings.load(resource: "UnmappedDestinations.json", bundle: Bundle.module)
212-
let analytics = Analytics(configuration: Configuration(writeKey: "test")
212+
let analytics = Analytics(configuration: Configuration(writeKey: "ud.testYesTo3")
213213
.trackApplicationLifecycleEvents(false)
214214
.defaultSettings(settings)
215215
)
@@ -268,10 +268,10 @@ final class UnmappedDestinationsTests: XCTestCase {
268268
}
269269

270270
func testYesTo4() {
271-
removeUserDefaults(forWriteKey: "test")
271+
removeUserDefaults(forWriteKey: "ud.testYesTo4")
272272

273273
let settings = Settings.load(resource: "UnmappedDestinations.json", bundle: Bundle.module)
274-
let analytics = Analytics(configuration: Configuration(writeKey: "test")
274+
let analytics = Analytics(configuration: Configuration(writeKey: "ud.testYesTo4")
275275
.trackApplicationLifecycleEvents(false)
276276
.defaultSettings(settings)
277277
)
@@ -330,10 +330,10 @@ final class UnmappedDestinationsTests: XCTestCase {
330330
}
331331

332332
func testYesTo1and2() {
333-
removeUserDefaults(forWriteKey: "test")
333+
removeUserDefaults(forWriteKey: "ud.testYesTo1and2")
334334

335335
let settings = Settings.load(resource: "UnmappedDestinations.json", bundle: Bundle.module)
336-
let analytics = Analytics(configuration: Configuration(writeKey: "test")
336+
let analytics = Analytics(configuration: Configuration(writeKey: "ud.testYesTo1and2")
337337
.trackApplicationLifecycleEvents(false)
338338
.defaultSettings(settings)
339339
)
@@ -392,10 +392,10 @@ final class UnmappedDestinationsTests: XCTestCase {
392392
}
393393

394394
func testYesToAll() {
395-
removeUserDefaults(forWriteKey: "test")
395+
removeUserDefaults(forWriteKey: "ud.testYesToAll")
396396

397397
let settings = Settings.load(resource: "UnmappedDestinations.json", bundle: Bundle.module)
398-
let analytics = Analytics(configuration: Configuration(writeKey: "test")
398+
let analytics = Analytics(configuration: Configuration(writeKey: "ud.testYesToAll")
399399
.trackApplicationLifecycleEvents(false)
400400
.defaultSettings(settings)
401401
)

Sources/SegmentConsent/Manager.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ extension ConsentManager {
8181
}
8282

8383
public func start() {
84-
started = true
84+
_started.set(true)
8585
// replay events. they'll be sent back through the system and get stamped above.
8686
for event in queuedEvents {
8787
analytics?.process(event: event)

0 commit comments

Comments
 (0)